[Skiboot] [PATCH 2/5] lock: Increase con_suspend before __try_lock

Benjamin Herrenschmidt benh at kernel.crashing.org
Wed Aug 15 15:10:36 AEST 2018


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 at kernel.crashing.org>
---
 core/lock.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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;
 }
 
-- 
2.17.1



More information about the Skiboot mailing list