Skip to contentSkip to conversation

x86/pvqspinlock: Use LOCK_PREFIX in __pv_queued_spin_unlock assembly code

PATCH In review Waiman Long 3 participants 4 messages Jul 17, 2018 – Jul 25, 2018 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pvqspinlock: Use LOCK_PREFIX in __pv_queued_spin_unlock assembly code

The LOCK_PREFIX macro should be used in the assembly __raw_callee_save___pv_queued_spin_unlock code so that the lock prefix can be patched out on UP systems.

---
 arch/x86/include/asm/qspinlock_paravirt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/qspinlock_paravirt.h +1 -1
index 9ef5ee0..159622e 100644
@@ -43,7 +43,7 @@
 	"push  %rdx;"
 	"mov   $0x1,%eax;"
 	"xor   %edx,%edx;"
-	"lock cmpxchg %dl,(%rdi);"
+	LOCK_PREFIX "cmpxchg %dl,(%rdi);"
 	"cmp   $0x1,%al;"
 	"jne   .slowpath;"
 	"pop   %rdx;"
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 3 lines · Waiman Long

The LOCK_PREFIX macro should be used in the assembly __raw_callee_save___pv_queued_spin_unlock code so that the lock prefix can be patched out on UP systems.

True; but does paravirt locking realy make sense on UP guests?

Quoted 21 lines
---
 arch/x86/include/asm/qspinlock_paravirt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/qspinlock_paravirt.h +1 -1
index 9ef5ee0..159622e 100644
@@ -43,7 +43,7 @@
 	"push  %rdx;"
 	"mov   $0x1,%eax;"
 	"xor   %edx,%edx;"
-	"lock cmpxchg %dl,(%rdi);"
+	LOCK_PREFIX "cmpxchg %dl,(%rdi);"
 	"cmp   $0x1,%al;"
 	"jne   .slowpath;"
 	"pop   %rdx;"
Signature · 1 line
1.8.3.1
#2 lore raw
Quoted 6 lines · Peter Zijlstra
Quoted 3 lines · Waiman Long

The LOCK_PREFIX macro should be used in the assembly __raw_callee_save___pv_queued_spin_unlock code so that the lock prefix can be patched out on UP systems.

True; but does paravirt locking realy make sense on UP guests?

Yes, it doesn't make sense. That is why I have another kvm patch that turns off pvqspinlock for UP guest. However, I am not that familiar with the Xen code. So I don't have a corresponding one for Xen.

Cheers,
Longman

#3 lore raw

[tip:locking/urgent] locking/pvqspinlock/x86: Use LOCK_PREFIX in __pv_queued_spin_unlock() assembly code

In reply to Waiman Long
locking/pvqspinlock/x86: Use LOCK_PREFIX in __pv_queued_spin_unlock() assembly code
Commit-ID:  c0dc373a780f4ec63e45a573b9551763abd8cd1a
Gitweb:     https://git.kernel.org/tip/c0dc373a780f4ec63e45a573b9551763abd8cd1a
Author:     Waiman Long <[email protected]>
AuthorDate: Tue, 17 Jul 2018 16:16:00 -0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Jul 2018 11:22:20 +0200

locking/pvqspinlock/x86: Use LOCK_PREFIX in __pv_queued_spin_unlock() assembly code

The LOCK_PREFIX macro should be used in the __raw_callee_save___pv_queued_spin_unlock() assembly code, so that the lock prefix can be patched out on UP systems.

---
 arch/x86/include/asm/qspinlock_paravirt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/qspinlock_paravirt.h +1 -1
index 9ef5ee03d2d7..159622ee0674 100644
@@ -43,7 +43,7 @@ asm    (".pushsection .text;"
 	"push  %rdx;"
 	"mov   $0x1,%eax;"
 	"xor   %edx,%edx;"
-	"lock cmpxchg %dl,(%rdi);"
+	LOCK_PREFIX "cmpxchg %dl,(%rdi);"
 	"cmp   $0x1,%al;"
 	"jne   .slowpath;"
 	"pop   %rdx;"