diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2015-02-18 14:57:18 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-02-18 15:20:53 +1100 |
commit | acad6ae04cb9064a47ea86902d1b8495fab8a929 (patch) | |
tree | 0d4a941f0b6a64660f8bea2b84254a9388ba366e /core/lock.c | |
parent | 539487bae4b77d66b5966f5396609f28312bd6ae (diff) | |
download | skiboot-acad6ae04cb9064a47ea86902d1b8495fab8a929.zip skiboot-acad6ae04cb9064a47ea86902d1b8495fab8a929.tar.gz skiboot-acad6ae04cb9064a47ea86902d1b8495fab8a929.tar.bz2 |
lock: Add lock depth recording per CPU
We want to move to pollers being run inly when no lock is held
so let's start recording lock depth. It will also be a useful
debugging tool.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/lock.c')
-rw-r--r-- | core/lock.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/lock.c b/core/lock.c index d916141..ac6cb3b 100644 --- a/core/lock.c +++ b/core/lock.c @@ -54,6 +54,9 @@ static void unlock_check(struct lock *l) if (l->in_con_path && this_cpu()->con_suspend == 0) lock_error(l, "Unlock con lock with console not suspended", 3); + + if (this_cpu()->lock_depth == 0) + lock_error(l, "Releasing lock with 0 depth", 4); } #else @@ -73,6 +76,7 @@ bool try_lock(struct lock *l) if (__try_lock(l)) { if (l->in_con_path) this_cpu()->con_suspend++; + this_cpu()->lock_depth++; return true; } return false; @@ -101,6 +105,7 @@ void unlock(struct lock *l) unlock_check(l); lwsync(); + this_cpu()->lock_depth--; l->lock_val = 0; if (l->in_con_path) { |