aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatt Brown <matthew.brown.dev@gmail.com>2017-07-07 11:52:43 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2018-03-07 17:15:02 +1100
commit2d4c774c2a3ad5413272e9d17827e4eb3956be87 (patch)
tree8696fe9463fc43946d9061fb7c11dda12ac5fe11 /include
parent217f74b0c40e176917f604e0b3d40fb44598f07c (diff)
downloadskiboot-2d4c774c2a3ad5413272e9d17827e4eb3956be87.zip
skiboot-2d4c774c2a3ad5413272e9d17827e4eb3956be87.tar.gz
skiboot-2d4c774c2a3ad5413272e9d17827e4eb3956be87.tar.bz2
core/lock: Add deadlock detection
This adds simple deadlock detection. The detection looks for circular dependencies in the lock requests. It will abort and display a stack trace when a deadlock occurs. The detection is enabled by DEBUG_LOCKS (enabled by default). While the detection may have a slight performance overhead, as there are not a huge number of locks in skiboot this overhead isn't significant. Signed-off-by: Matt Brown <matthew.brown.dev@gmail.com> [stewart: fix build with DEBUG_LOCKS off] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/cpu.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/cpu.h b/include/cpu.h
index 2ec6f03..220fa1d 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -120,6 +120,11 @@ struct cpu_thread {
u32 sensor_attr;
u32 token;
bool dts_read_in_progress;
+
+#ifdef DEBUG_LOCKS
+ /* The lock requested by this cpu, used for deadlock detection */
+ struct lock *requested_lock;
+#endif
};
/* This global is set to 1 to allow secondaries to callin,