[Skiboot] [PATCH v3 19/29] core/lock: improve bust_locks

Nicholas Piggin npiggin at gmail.com
Wed Nov 29 16:36:57 AEDT 2017


Prevent try_lock from modifying the lock state when bust_locks is set.
unlock will not unlock it in that case, so locks will get taken and
never released while bust_locks is set.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 core/lock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/core/lock.c b/core/lock.c
index 916a02412..b5e3323f2 100644
--- a/core/lock.c
+++ b/core/lock.c
@@ -93,6 +93,9 @@ bool try_lock(struct lock *l)
 {
 	struct cpu_thread *cpu = this_cpu();
 
+	if (bust_locks)
+		return true;
+
 	if (__try_lock(cpu, l)) {
 		if (l->in_con_path)
 			cpu->con_suspend++;
-- 
2.15.0



More information about the Skiboot mailing list