[PATCH RESEND 2/2] x86/paravirt: Use XOR r32,r32 to clear register in pv_vcpu_is_preempted()

From: Uros Bizjak

Date: Wed Jan 14 2026 - 16:20:04 EST


x86_64 zero extends 32bit operations, so for 64bit operands,
XOR r32,r32 is functionally equal to XOR r64,r64, but avoids
a REX prefix byte when legacy registers are used.

Signed-off-by: Uros Bizjak <ubizjak@xxxxxxxxx>
Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
Acked-by: "H. Peter Anvin" <hpa@xxxxxxxxx>
Acked-by: Alexey Makhalov <alexey.makhalov@xxxxxxxxxxxx>
Cc: Ajay Kaher <ajay.kaher@xxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
---
arch/x86/include/asm/paravirt-spinlock.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/paravirt-spinlock.h b/arch/x86/include/asm/paravirt-spinlock.h
index 458b888aba84..7beffcb08ed6 100644
--- a/arch/x86/include/asm/paravirt-spinlock.h
+++ b/arch/x86/include/asm/paravirt-spinlock.h
@@ -45,7 +45,7 @@ static __always_inline void pv_queued_spin_unlock(struct qspinlock *lock)
static __always_inline bool pv_vcpu_is_preempted(long cpu)
{
return PVOP_ALT_CALLEE1(bool, pv_ops_lock, vcpu_is_preempted, cpu,
- "xor %%" _ASM_AX ", %%" _ASM_AX,
+ "xor %%eax, %%eax",
ALT_NOT(X86_FEATURE_VCPUPREEMPT));
}

--
2.52.0