From: Uros Bizjak Date: Fri, 18 Apr 2025 08:07:44 +0000 (+0200) Subject: x86/asm: Replace "REP; NOP" with PAUSE mnemonic X-Git-Tag: block-6.16-20250606~23^2~32^2~4 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=d109ff4f0bc32de354247a6e8ede3ffc8ef14cd0;p=linux-block.git x86/asm: Replace "REP; NOP" with PAUSE mnemonic 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 Signed-off-by: Uros Bizjak Signed-off-by: Ingo Molnar Cc: H. Peter Anvin Link: https://lore.kernel.org/r/20250418080805.83679-2-ubizjak@gmail.com --- diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h index 38f17a1e1e36..f899717f9e48 100644 --- a/arch/x86/boot/boot.h +++ b/arch/x86/boot/boot.h @@ -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) { diff --git a/arch/x86/include/asm/vdso/processor.h b/arch/x86/include/asm/vdso/processor.h index c9b2ba7a9ec4..240d761b8ce4 100644 --- a/arch/x86/include/asm/vdso/processor.h +++ b/arch/x86/include/asm/vdso/processor.h @@ -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) diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S index 1d6355227bf6..ea604f4d0b52 100644 --- a/arch/x86/kernel/relocate_kernel_64.S +++ b/arch/x86/kernel/relocate_kernel_64.S @@ -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: