[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] x86: Drop rep_nop() and use the PAUSE mnemonic directly



commit 9b744ca7c06b27f848634374408efbd1ca79267b
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Jul 15 20:02:40 2025 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Jul 17 18:54:49 2025 +0100

    x86: Drop rep_nop() and use the PAUSE mnemonic directly
    
    In udelay(), use cpu_relax() directly which, for better or worse, is the
    common way to refer to the PAUSE instruction.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/delay.c                 | 2 +-
 xen/arch/x86/include/asm/processor.h | 9 ++-------
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/delay.c b/xen/arch/x86/delay.c
index b3a41881a1..ed093fbb08 100644
--- a/xen/arch/x86/delay.c
+++ b/xen/arch/x86/delay.c
@@ -23,7 +23,7 @@ void udelay(unsigned long usecs)
     s = rdtsc_ordered();
     do
     {
-        rep_nop();
+        cpu_relax();
         e = rdtsc_ordered();
     } while ((e-s) < ticks);
 }
diff --git a/xen/arch/x86/include/asm/processor.h 
b/xen/arch/x86/include/asm/processor.h
index 04824c3633..b6e8de5e86 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -340,13 +340,8 @@ DECLARE_PER_CPU(root_pgentry_t *, root_pgt);
 
 extern void write_ptbase(struct vcpu *v);
 
-/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
-static always_inline void rep_nop(void)
-{
-    asm volatile ( "rep;nop" : : : "memory" );
-}
-
-#define cpu_relax() rep_nop()
+/* PAUSE (encoding: REP NOP) is a good thing to insert into busy-wait loops. */
+#define cpu_relax() asm volatile ( "pause" ::: "memory" )
 
 void show_code(const struct cpu_user_regs *regs);
 void show_stack_overflow(unsigned int cpu, const struct cpu_user_regs *regs);
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.