Thread (5 messages) flat view 5 messages, 3 authors, 2016-09-01

[PATCH] [bugfix] replace unnessary ldax with common ldr

From: Vladimir Murzin <hidden>
Date: 2016-08-31 13:31:04
Also in: lkml

On 30/08/16 10:07, Catalin Marinas wrote:
On Tue, Aug 30, 2016 at 02:35:31PM +0800, Kenneth Lee wrote:
quoted
(add comment for the previous mail, sorry for the duplication)

There is no store_ex pairing with this load_ex. It is not necessary and
gave wrong hint to the cache system.

Signed-off-by: Kenneth Lee <redacted>
---
 arch/arm64/include/asm/spinlock.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/spinlock.h b/arch/arm64/include/asm/spinlock.h
index c85e96d..3334c4f 100644
--- a/arch/arm64/include/asm/spinlock.h
+++ b/arch/arm64/include/asm/spinlock.h
@@ -63,7 +63,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
 	 */
 "	sevl\n"
 "2:	wfe\n"
-"	ldaxrh	%w2, %4\n"
+"	ldrh	%w2, %4\n"
 "	eor	%w1, %w2, %w0, lsr #16\n"
 "	cbnz	%w1, 2b\n"
 	/* We got the lock. Critical section starts here. */
This is needed because the arch_spin_unlock() code only uses an STLR
without an explicit SEV (like we have on AArch32). An event is
automatically generated when the exclusive monitor is cleared by STLR.
But without setting it with a load exclusive in arch_spin_lock() (even
though it does not acquire the lock), there won't be anything to clear,
hence no event to be generated. In this case, the WFE would wait
indefinitely.
Maybe worth to add this as a comment, no?

Cheers
Vladimir
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help