Skip to contentSkip to conversation

locking/pvqspinlock/x86: Use _Q_LOCKED_VAL in PV_UNLOCK_ASM macro

PATCH Applied Uros Bizjak 3 participants 7 messages Apr 22, 2024 – Apr 24, 2024 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 locking/pvqspinlock/x86: Use _Q_LOCKED_VAL in PV_UNLOCK_ASM macro

Use _Q_LOCKED_VAL instead of hardcoded $0x1 in PV_UNLOCK_ASM macro.

No functional changes intended.

Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Will Deacon <[email protected]>
Cc Waiman Long <[email protected]>
Cc Boqun Feng <[email protected]>
---
 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 466af57b8ed6..0a985784be9b 100644
@@ -40,7 +40,7 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text");
 #define PV_UNLOCK_ASM							\
 	FRAME_BEGIN							\
 	"push  %rdx\n\t"						\
-	"mov   $0x1,%eax\n\t"						\
+	"mov   $" __stringify(_Q_LOCKED_VAL) ",%eax\n\t"		\
 	"xor   %edx,%edx\n\t"						\
 	LOCK_PREFIX "cmpxchg %dl,(%rdi)\n\t"				\
 	"jne   .slowpath\n\t"						\
Signature · 1 line
2.42.0
#1 lore raw
Quoted 19 lines · Uros Bizjak

Use _Q_LOCKED_VAL instead of hardcoded $0x1 in PV_UNLOCK_ASM macro.

No functional changes intended.

Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Will Deacon <[email protected]>
Cc Waiman Long <[email protected]>
Cc Boqun Feng <[email protected]>
---
 arch/x86/include/asm/qspinlock_paravirt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/qspinlock_paravirt.h +0 -0
index 466af57b8ed6..0a985784be9b 100644

arch/x86/include/asm/qspinlock_paravirt.h __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text"); · line 46

Quoted 8 lines
arch/x86/include/asm/qspinlock_paravirt.h +1 -1
@@ -40,7 +40,7 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text");
 #define PV_UNLOCK_ASM							\
 	FRAME_BEGIN							\
 	"push  %rdx\n\t"						\
-	"mov   $0x1,%eax\n\t"						\
+	"mov   $" __stringify(_Q_LOCKED_VAL) ",%eax\n\t"		\
 	"xor   %edx,%edx\n\t"						\
 	LOCK_PREFIX "cmpxchg %dl,(%rdi)\n\t"				\
 	"jne   .slowpath\n\t"						\

There is also a "cmp $0x1,%al" afterwards.

Regards,
Boqun

Quoted 3 lines
Signature · 1 line
2.42.0
#2 lore raw
Quoted 7 lines · Boqun Feng
Quoted 7 lines
arch/x86/include/asm/qspinlock_paravirt.h +0 -0
index 466af57b8ed6..0a985784be9b 100644
@@ -40,7 +40,7 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text");
 #define PV_UNLOCK_ASM                                                        \
      FRAME_BEGIN                                                     \
Quoted 8 lines

arch/x86/include/asm/qspinlock_paravirt.h __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text"); · line 46

Quoted 6 lines
arch/x86/include/asm/qspinlock_paravirt.h +1 -1
      "push  %rdx\n\t"                                                \
-     "mov   $0x1,%eax\n\t"                                           \
+     "mov   $" __stringify(_Q_LOCKED_VAL) ",%eax\n\t"                \
      "xor   %edx,%edx\n\t"                                           \
      LOCK_PREFIX "cmpxchg %dl,(%rdi)\n\t"                            \
      "jne   .slowpath\n\t"                                           \

There is also a "cmp $0x1,%al" afterwards.

Not anymore. Please note that the patch is against -tip, where we have:

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=91095666125a666c8f20c2323b742c53165c0325

Thanks,
Uros.

#3 lore raw
Quoted 18 lines · Uros Bizjak
Quoted 7 lines · Boqun Feng
Quoted 7 lines
arch/x86/include/asm/qspinlock_paravirt.h +0 -0
index 466af57b8ed6..0a985784be9b 100644
@@ -40,7 +40,7 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text");
 #define PV_UNLOCK_ASM                                                        \
      FRAME_BEGIN                                                     \
Quoted 8 lines

arch/x86/include/asm/qspinlock_paravirt.h __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text"); · line 46

Quoted 6 lines
arch/x86/include/asm/qspinlock_paravirt.h +1 -1
      "push  %rdx\n\t"                                                \
-     "mov   $0x1,%eax\n\t"                                           \
+     "mov   $" __stringify(_Q_LOCKED_VAL) ",%eax\n\t"                \
      "xor   %edx,%edx\n\t"                                           \
      LOCK_PREFIX "cmpxchg %dl,(%rdi)\n\t"                            \
      "jne   .slowpath\n\t"                                           \

There is also a "cmp $0x1,%al" afterwards.

Quoted 2 lines

Not anymore. Please note that the patch is against -tip, where we have:

Oh, thanks for the information. Maybe it makes sense to mention the patches dependency in the commit log?

Regards,
Boqun

Quoted 4 lines

https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=91095666125a666c8f20c2323b742c53165c0325

Thanks,
Uros.

#4 lore raw
Quoted 20 lines · Boqun Feng
Quoted 18 lines · Uros Bizjak
Quoted 15 lines · Boqun Feng

arch/x86/include/asm/qspinlock_paravirt.h __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text"); · line 46

Quoted 13 lines
arch/x86/include/asm/qspinlock_paravirt.h +1 -1
index 466af57b8ed6..0a985784be9b 100644
@@ -40,7 +40,7 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text");
 #define PV_UNLOCK_ASM                                                        \
      FRAME_BEGIN                                                     \
      "push  %rdx\n\t"                                                \
-     "mov   $0x1,%eax\n\t"                                           \
+     "mov   $" __stringify(_Q_LOCKED_VAL) ",%eax\n\t"                \
      "xor   %edx,%edx\n\t"                                           \
      LOCK_PREFIX "cmpxchg %dl,(%rdi)\n\t"                            \
      "jne   .slowpath\n\t"                                           \

There is also a "cmp $0x1,%al" afterwards.

Quoted 5 lines
Quoted 2 lines

Not anymore. Please note that the patch is against -tip, where we have:

Oh, thanks for the information. Maybe it makes sense to mention the patches dependency in the commit log?

Hm, yes ... I should mention this as "[PATCH -tip]" in the subject line to avoid confusion with this particular patch.

Thanks,
Uros.

Acked-by
#5 lore raw
Quoted 21 lines · Uros Bizjak
Quoted 20 lines · Boqun Feng
Quoted 18 lines · Uros Bizjak
Quoted 15 lines · Boqun Feng

arch/x86/include/asm/qspinlock_paravirt.h __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text"); · line 46

Quoted 13 lines
arch/x86/include/asm/qspinlock_paravirt.h +1 -1
index 466af57b8ed6..0a985784be9b 100644
@@ -40,7 +40,7 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text");
 #define PV_UNLOCK_ASM                                                        \
      FRAME_BEGIN                                                     \
      "push  %rdx\n\t"                                                \
-     "mov   $0x1,%eax\n\t"                                           \
+     "mov   $" __stringify(_Q_LOCKED_VAL) ",%eax\n\t"                \
      "xor   %edx,%edx\n\t"                                           \
      LOCK_PREFIX "cmpxchg %dl,(%rdi)\n\t"                            \
      "jne   .slowpath\n\t"                                           \

There is also a "cmp $0x1,%al" afterwards.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Not anymore. Please note that the patch is against -tip, where we have:

Oh, thanks for the information. Maybe it makes sense to mention the patches dependency in the commit log?

Hm, yes ... I should mention this as "[PATCH -tip]" in the subject line to avoid confusion with this particular patch.

Anyway, the code looks good to me.

Regards,
Boqun

Quoted 2 lines

Thanks,
Uros.

merge bot Applied
#6 lore raw
In reply to Uros Bizjak
The following commit has been merged into the locking/core branch of tip:

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     532453e7aa78f3962fb4d86caf40ff81ebf62160
Gitweb:        https://git.kernel.org/tip/532453e7aa78f3962fb4d86caf40ff81ebf62160
Author:        Uros Bizjak <[email protected]>
AuthorDate:    Mon, 22 Apr 2024 17:17:35 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Wed, 24 Apr 2024 11:48:08 +02:00

locking/pvqspinlock/x86: Use _Q_LOCKED_VAL in PV_UNLOCK_ASM macro

Use _Q_LOCKED_VAL instead of hardcoded $0x1 in PV_UNLOCK_ASM macro.

No functional changes intended.

---
 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 466af57..0a98578 100644
@@ -40,7 +40,7 @@ __PV_CALLEE_SAVE_REGS_THUNK(__pv_queued_spin_unlock_slowpath, ".spinlock.text");
 #define PV_UNLOCK_ASM							\
 	FRAME_BEGIN							\
 	"push  %rdx\n\t"						\
-	"mov   $0x1,%eax\n\t"						\
+	"mov   $" __stringify(_Q_LOCKED_VAL) ",%eax\n\t"		\
 	"xor   %edx,%edx\n\t"						\
 	LOCK_PREFIX "cmpxchg %dl,(%rdi)\n\t"				\
 	"jne   .slowpath\n\t"						\