* [PATCH -tip v2 1/2] x86/asm: Rename rep_nop() to native_pause()
@ 2025-04-18 8:07 Uros Bizjak
2025-04-18 8:07 ` [PATCH -tip v2 2/2] x86/asm: Replace "REP; NOP" with PAUSE mnemonic Uros Bizjak
2025-04-18 8:46 ` [tip: x86/asm] x86/asm: Rename rep_nop() to native_pause() tip-bot2 for Uros Bizjak
0 siblings, 2 replies; 4+ messages in thread
From: Uros Bizjak @ 2025-04-18 8:07 UTC (permalink / raw)
To: x86, linux-kernel
Cc: Uros Bizjak, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, H. Peter Anvin
Rename rep_nop() function to what it really does.
No functional change intended.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
v2: Rename rep_nop() to native_pause() first.
---
arch/x86/include/asm/vdso/processor.h | 4 ++--
arch/x86/kernel/apic/io_apic.c | 2 +-
arch/x86/lib/delay.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/vdso/processor.h b/arch/x86/include/asm/vdso/processor.h
index c9b2ba7a9ec4..895333b52cb3 100644
--- a/arch/x86/include/asm/vdso/processor.h
+++ b/arch/x86/include/asm/vdso/processor.h
@@ -8,14 +8,14 @@
#ifndef __ASSEMBLER__
/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
-static __always_inline void rep_nop(void)
+static __always_inline void native_pause(void)
{
asm volatile("rep; nop" ::: "memory");
}
static __always_inline void cpu_relax(void)
{
- rep_nop();
+ native_pause();
}
struct getcpu_cache;
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index eebc360ed1bb..ba5a4ccda37a 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1486,7 +1486,7 @@ static void __init delay_with_tsc(void)
* 1 GHz == 40 jiffies
*/
do {
- rep_nop();
+ native_pause();
now = rdtsc();
} while ((now - start) < 40000000000ULL / HZ && time_before_eq(jiffies, end));
}
diff --git a/arch/x86/lib/delay.c b/arch/x86/lib/delay.c
index e86eda2c0b04..eb2d2e1cbddd 100644
--- a/arch/x86/lib/delay.c
+++ b/arch/x86/lib/delay.c
@@ -75,7 +75,7 @@ static void delay_tsc(u64 cycles)
/* Allow RT tasks to run */
preempt_enable();
- rep_nop();
+ native_pause();
preempt_disable();
/*
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH -tip v2 2/2] x86/asm: Replace "REP; NOP" with PAUSE mnemonic
2025-04-18 8:07 [PATCH -tip v2 1/2] x86/asm: Rename rep_nop() to native_pause() Uros Bizjak
@ 2025-04-18 8:07 ` Uros Bizjak
2025-04-18 8:46 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2025-04-18 8:46 ` [tip: x86/asm] x86/asm: Rename rep_nop() to native_pause() tip-bot2 for Uros Bizjak
1 sibling, 1 reply; 4+ messages in thread
From: Uros Bizjak @ 2025-04-18 8:07 UTC (permalink / raw)
To: x86, linux-kernel
Cc: Uros Bizjak, Nikolay Borisov, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, H. Peter Anvin
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.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
v2: Rename rep_nop() to native_pause() first.
---
arch/x86/boot/boot.h | 2 +-
arch/x86/include/asm/vdso/processor.h | 4 ++--
arch/x86/kernel/relocate_kernel_64.S | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index f3771a6373c7..60580836daf7 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 895333b52cb3..7000aeb59aa2 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 native_pause(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:
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [tip: x86/asm] x86/asm: Rename rep_nop() to native_pause()
2025-04-18 8:07 [PATCH -tip v2 1/2] x86/asm: Rename rep_nop() to native_pause() Uros Bizjak
2025-04-18 8:07 ` [PATCH -tip v2 2/2] x86/asm: Replace "REP; NOP" with PAUSE mnemonic Uros Bizjak
@ 2025-04-18 8:46 ` tip-bot2 for Uros Bizjak
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-04-18 8:46 UTC (permalink / raw)
To: linux-tip-commits
Cc: David Laight, Uros Bizjak, Ingo Molnar, H. Peter Anvin, x86,
linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 3ce4b1f1f24bbd9f1c349ecb6641dfa038bd0b5a
Gitweb: https://git.kernel.org/tip/3ce4b1f1f24bbd9f1c349ecb6641dfa038bd0b5a
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Fri, 18 Apr 2025 10:07:43 +02:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 18 Apr 2025 10:19:26 +02:00
x86/asm: Rename rep_nop() to native_pause()
Rename rep_nop() function to what it really does.
No functional change intended.
Suggested-by: David Laight <david.laight.linux@gmail.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-1-ubizjak@gmail.com
---
arch/x86/include/asm/vdso/processor.h | 4 ++--
arch/x86/kernel/apic/io_apic.c | 2 +-
arch/x86/lib/delay.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/vdso/processor.h b/arch/x86/include/asm/vdso/processor.h
index 240d761..7000aeb 100644
--- a/arch/x86/include/asm/vdso/processor.h
+++ b/arch/x86/include/asm/vdso/processor.h
@@ -8,14 +8,14 @@
#ifndef __ASSEMBLER__
/* PAUSE is a good thing to insert into busy-wait loops. */
-static __always_inline void rep_nop(void)
+static __always_inline void native_pause(void)
{
asm volatile("pause" ::: "memory");
}
static __always_inline void cpu_relax(void)
{
- rep_nop();
+ native_pause();
}
struct getcpu_cache;
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index eebc360..ba5a4cc 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1486,7 +1486,7 @@ static void __init delay_with_tsc(void)
* 1 GHz == 40 jiffies
*/
do {
- rep_nop();
+ native_pause();
now = rdtsc();
} while ((now - start) < 40000000000ULL / HZ && time_before_eq(jiffies, end));
}
diff --git a/arch/x86/lib/delay.c b/arch/x86/lib/delay.c
index e86eda2..eb2d2e1 100644
--- a/arch/x86/lib/delay.c
+++ b/arch/x86/lib/delay.c
@@ -75,7 +75,7 @@ static void delay_tsc(u64 cycles)
/* Allow RT tasks to run */
preempt_enable();
- rep_nop();
+ native_pause();
preempt_disable();
/*
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [tip: x86/asm] x86/asm: Replace "REP; NOP" with PAUSE mnemonic
2025-04-18 8:07 ` [PATCH -tip v2 2/2] x86/asm: Replace "REP; NOP" with PAUSE mnemonic Uros Bizjak
@ 2025-04-18 8:46 ` tip-bot2 for Uros Bizjak
0 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Uros Bizjak @ 2025-04-18 8:46 UTC (permalink / raw)
To: linux-tip-commits
Cc: Nikolay Borisov, Uros Bizjak, Ingo Molnar, H. Peter Anvin, x86,
linux-kernel
The following commit has been merged into the x86/asm branch of tip:
Commit-ID: d109ff4f0bc32de354247a6e8ede3ffc8ef14cd0
Gitweb: https://git.kernel.org/tip/d109ff4f0bc32de354247a6e8ede3ffc8ef14cd0
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Fri, 18 Apr 2025 10:07:44 +02:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 18 Apr 2025 10:19:25 +02:00
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
---
arch/x86/boot/boot.h | 2 +-
arch/x86/include/asm/vdso/processor.h | 4 ++--
arch/x86/kernel/relocate_kernel_64.S | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index 38f17a1..f899717 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 c9b2ba7..240d761 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 1d63552..ea604f4 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:
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-18 8:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-18 8:07 [PATCH -tip v2 1/2] x86/asm: Rename rep_nop() to native_pause() Uros Bizjak
2025-04-18 8:07 ` [PATCH -tip v2 2/2] x86/asm: Replace "REP; NOP" with PAUSE mnemonic Uros Bizjak
2025-04-18 8:46 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2025-04-18 8:46 ` [tip: x86/asm] x86/asm: Rename rep_nop() to native_pause() tip-bot2 for Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox