diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2018-08-15 15:10:38 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-08-16 18:41:17 +1000 |
commit | 2f2e0ee95a3da96e669b40dcb41ac14177dcac8d (patch) | |
tree | ce6b551bfda50081d30d8f261d6684508376080e /include | |
parent | 2925dd08c5e39e5c82286dc65a15fce6623694b2 (diff) | |
download | blackbird-skiboot-2f2e0ee95a3da96e669b40dcb41ac14177dcac8d.tar.gz blackbird-skiboot-2f2e0ee95a3da96e669b40dcb41ac14177dcac8d.zip |
lock: Fix interactions between lock dependency checker and stack checker
The lock dependency checker does a few nasty things that can cause
re-entrancy deadlocks in conjunction with the stack checker or
in fact other debug tests.
A lot of it revolves around taking a new lock (dl_lock) as part
of the locking process.
This tries to fix it by making sure we do not hit the stack
checker while holding dl_lock.
We achieve that in part by directly using the low-level __try_lock
and manually unlocking on the dl_lock, and making some functions
"nomcount".
In addition, we mark the dl_lock as being in the console path to
avoid deadlocks with the UART driver.
We move the enabling of the deadlock checker to a separate config
option from DEBUG_LOCKS as well, in case we chose to disable it
by default later on.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/config.h | 3 | ||||
-rw-r--r-- | include/cpu.h | 3 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h index cd8a0a65..6b36590c 100644 --- a/include/config.h +++ b/include/config.h @@ -39,6 +39,9 @@ /* Enable lock debugging */ #define DEBUG_LOCKS 1 +/* Enable lock dependency checker */ +#define DEADLOCK_CHECKER 1 + /* Enable malloc debugging */ #define DEBUG_MALLOC 1 diff --git a/include/cpu.h b/include/cpu.h index ae318572..2fe47982 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -174,6 +174,9 @@ extern struct cpu_thread *find_cpu_by_node(struct dt_node *cpu); extern struct cpu_thread *find_cpu_by_server(u32 server_no); extern struct cpu_thread *find_cpu_by_pir(u32 pir); +/* Used for lock internals to avoid re-entrancy */ +extern struct __nomcount cpu_thread *find_cpu_by_pir_nomcount(u32 pir); + extern struct dt_node *get_cpu_node(u32 pir); /* Iterator */ |