aboutsummaryrefslogtreecommitdiff
path: root/core/opal.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2017-12-20 13:16:23 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-12-20 22:15:36 -0600
commit76d9bcdca58936d761458f8f05960239c4dd8dec (patch)
treec8377b11be33e62d312810645b8044d3a6f427aa /core/opal.c
parentca612b802adac0c72cd0f10c51a51275e5914101 (diff)
downloadskiboot-76d9bcdca58936d761458f8f05960239c4dd8dec.zip
skiboot-76d9bcdca58936d761458f8f05960239c4dd8dec.tar.gz
skiboot-76d9bcdca58936d761458f8f05960239c4dd8dec.tar.bz2
lock: Add additional lock auditing code
Keep track of lock owner name and replace lock_depth counter with a per-cpu list of locks held by the cpu. This allows us to print the actual locks held in case we hit the (in)famous message about opal_pollers being run with a lock held. It also allows us to warn (and drop them) if locks are still held when returning to the OS or completing a scheduled job. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Reviewed-by: Nicholas Piggin <npiggin@gmail.com> [stewart: fix unit tests] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/opal.c')
-rw-r--r--core/opal.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/opal.c b/core/opal.c
index d33d527..1bca774 100644
--- a/core/opal.c
+++ b/core/opal.c
@@ -182,6 +182,11 @@ int64_t opal_exit_check(int64_t retval, struct stack_frame *eframe)
printf("CPU UN-ACCOUNTED FIRMWARE ENTRY! PIR=%04lx cpu @%p -> pir=%04x token=%llu retval=%lld\n",
mfspr(SPR_PIR), cpu, cpu->pir, token, retval);
} else {
+ if (!list_empty(&cpu->locks_held)) {
+ prlog(PR_ERR, "OPAL exiting with locks held, token=%llu retval=%lld\n",
+ token, retval);
+ drop_my_locks(true);
+ }
sync(); /* release barrier vs quiescing */
cpu->in_opal_call--;
}
@@ -557,7 +562,7 @@ void opal_run_pollers(void)
}
this_cpu()->in_poller = true;
- if (this_cpu()->lock_depth && pollers_with_lock_warnings < 64) {
+ if (!list_empty(&this_cpu()->locks_held) && pollers_with_lock_warnings < 64) {
/**
* @fwts-label OPALPollerWithLock
* @fwts-advice opal_run_pollers() was called with a lock
@@ -565,6 +570,7 @@ void opal_run_pollers(void)
* lucky/careful.
*/
prlog(PR_ERR, "Running pollers with lock held !\n");
+ dump_locks_list();
backtrace();
pollers_with_lock_warnings++;
if (pollers_with_lock_warnings == 64) {