Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <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

authored by

Uros Bizjak and committed by
Ingo Molnar
d109ff4f 42c782fa

+5 -5
+1 -1
arch/x86/boot/boot.h
··· 34 34 extern struct setup_header hdr; 35 35 extern struct boot_params boot_params; 36 36 37 - #define cpu_relax() asm volatile("rep; nop") 37 + #define cpu_relax() asm volatile("pause") 38 38 39 39 static inline void io_delay(void) 40 40 {
+2 -2
arch/x86/include/asm/vdso/processor.h
··· 7 7 8 8 #ifndef __ASSEMBLER__ 9 9 10 - /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ 10 + /* PAUSE is a good thing to insert into busy-wait loops. */ 11 11 static __always_inline void rep_nop(void) 12 12 { 13 - asm volatile("rep; nop" ::: "memory"); 13 + asm volatile("pause" ::: "memory"); 14 14 } 15 15 16 16 static __always_inline void cpu_relax(void)
+2 -2
arch/x86/kernel/relocate_kernel_64.S
··· 405 405 inb %dx, %al 406 406 testb $XMTRDY, %al 407 407 jnz .Lready 408 - rep nop 408 + pause 409 409 jmp .Lxmtrdy_loop 410 410 411 411 .Lready: ··· 426 426 movb (LSR*4)(%rdx), %ah 427 427 testb $XMTRDY, %ah 428 428 jnz .Lready_mmio 429 - rep nop 429 + pause 430 430 jmp .Lxmtrdy_loop_mmio 431 431 432 432 .Lready_mmio: