diff mbox series

[2/5] lock: Increase con_suspend before __try_lock

Message ID 20180815051039.7019-2-benh@kernel.crashing.org
State Accepted
Headers show
Series [1/5] phb4: Workaround PHB errata with CFG write UR/CA errors | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied

Commit Message

Benjamin Herrenschmidt Aug. 15, 2018, 5:10 a.m. UTC
Otherwise, we might have the lock and hit prlog's inside
__try_lock() in the list check (among others) in debug
builds.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 core/lock.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/core/lock.c b/core/lock.c
index 4ae3a213..c320f2c3 100644
--- a/core/lock.c
+++ b/core/lock.c
@@ -193,13 +193,15 @@  bool try_lock_caller(struct lock *l, const char *owner)
 	if (bust_locks)
 		return true;
 
+	if (l->in_con_path)
+		cpu->con_suspend++;
 	if (__try_lock(cpu, l)) {
 		l->owner = owner;
-		if (l->in_con_path)
-			cpu->con_suspend++;
 		list_add(&cpu->locks_held, &l->list);
 		return true;
 	}
+	if (l->in_con_path)
+		cpu->con_suspend--;
 	return false;
 }