x86/asm: Replace "REP; NOP" with PAUSE mnemonic
authorUros Bizjak <ubizjak@gmail.com>
Fri, 18 Apr 2025 08:07:44 +0000 (10:07 +0200)
committerIngo Molnar <mingo@kernel.org>
Fri, 18 Apr 2025 08:19:25 +0000 (10:19 +0200)
Current minimum required version of binutils is 2.25,
which supports PAUSE instruction mnemonic.

Replace "REP; NOP" with this proper mnemonic.

No functional change intended.

Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Link: https://lore.kernel.org/r/20250418080805.83679-2-ubizjak@gmail.com
arch/x86/boot/boot.h
arch/x86/include/asm/vdso/processor.h
arch/x86/kernel/relocate_kernel_64.S

index 38f17a1e1e367f5d554f62bcf2959c9c28634a63..f899717f9e48a932d4839978be095b4a16b1a758 100644 (file)
@@ -34,7 +34,7 @@
 extern struct setup_header hdr;
 extern struct boot_params boot_params;
 
-#define cpu_relax()    asm volatile("rep; nop")
+#define cpu_relax()    asm volatile("pause")
 
 static inline void io_delay(void)
 {
index c9b2ba7a9ec4c993150b50ea5289aff094f2cc3a..240d761b8ce412177e5c524d9899ab8caa2accdb 100644 (file)
@@ -7,10 +7,10 @@
 
 #ifndef __ASSEMBLER__
 
-/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
+/* PAUSE is a good thing to insert into busy-wait loops. */
 static __always_inline void rep_nop(void)
 {
-       asm volatile("rep; nop" ::: "memory");
+       asm volatile("pause" ::: "memory");
 }
 
 static __always_inline void cpu_relax(void)
index 1d6355227bf60d13d8d3313702bfedbe3e06114f..ea604f4d0b52bd879ba594adf96154182cecb191 100644 (file)
@@ -405,7 +405,7 @@ SYM_CODE_START_LOCAL_NOALIGN(pr_char_8250)
        inb     %dx, %al
        testb   $XMTRDY, %al
        jnz     .Lready
-       rep nop
+       pause
        jmp .Lxmtrdy_loop
 
 .Lready:
@@ -426,7 +426,7 @@ SYM_CODE_START_LOCAL_NOALIGN(pr_char_8250_mmio32)
        movb    (LSR*4)(%rdx), %ah
        testb   $XMTRDY, %ah
        jnz     .Lready_mmio
-       rep nop
+       pause
        jmp .Lxmtrdy_loop_mmio
 
 .Lready_mmio: