aboutsummaryrefslogtreecommitdiff
path: root/core/cpu.c
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 /core/cpu.c
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 'core/cpu.c')
-rw-r--r--core/cpu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/cpu.c b/core/cpu.c
index 7a9dbe5..4914d30 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -1082,6 +1082,9 @@ void init_all_cpus(void)
t->node = cpu;
t->chip_id = chip_id;
t->icp_regs = NULL; /* Will be set later */
+#ifdef DEBUG_LOCKS
+ t->requested_lock = NULL;
+#endif
t->core_hmi_state = 0;
t->core_hmi_state_ptr = &t->core_hmi_state;
t->thread_mask = 1;