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

[PATCH] 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>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 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 b3a41881a17a..ed093fbb0861 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 04824c3633cf..b6e8de5e864d 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);
-- 
2.39.5




 


Rackspace

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