[RFC PATCH] powerpc/powernv: recheck lock bit in core_idle_lock_held after lwarx
Li Zhong
zhong at linux.vnet.ibm.com
Tue Oct 25 14:24:34 AEDT 2016
The core_idle_lock_held loops when the lock bit is held by others.
However, it is possible that after the lock bit is cleared, some one
else sees it first and sets the lock bit. And lwarx loads a value with
lock bit set, and the lock bit may be cleared in the following stwcx.
It is possible the first one is still executing in the critical section.
This patch rechecks the lock bit after lwarx, and go back to loop if it
is set.
Signed-off-by: Li Zhong <zhong at linux.vnet.ibm.com>
---
arch/powerpc/kernel/idle_book3s.S | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index bd739fe..ce07b3f 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -99,6 +99,8 @@ core_idle_lock_held:
bne 3b
HMT_MEDIUM
lwarx r15,0,r14
+ andi. r9,r15,PNV_CORE_IDLE_LOCK_BIT
+ bne- core_idle_lock_held
blr
/*
--
1.9.1
More information about the Linuxppc-dev
mailing list