All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -tip 1/3] x86/fsgsbase: Remove unnecessary "memory" clobbers from FS/GS base accessors
@ 2026-03-10  8:21 Uros Bizjak
  2026-03-10  8:21 ` [PATCH -tip 2/3] x86/segment: Remove unnecessary memory clobber from savesegment() Uros Bizjak
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Uros Bizjak @ 2026-03-10  8:21 UTC (permalink / raw)
  To: x86, linux-kernel
  Cc: Uros Bizjak, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, Peter Zijlstra (Intel)

The rdfsbase() and rdgsbase() helpers currently include a "memory" clobber
in their inline assembly definitions. However, the RDFSBASE and RDGSBASE
instructions only read the FS/GS base MSRs into a general-purpose register
and do not access memory. As such, the "memory" clobber is unnecessary.

No functional change intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Thomas Gleixner <tglx@kernel.org>
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>
Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
---
 arch/x86/include/asm/fsgsbase.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/fsgsbase.h b/arch/x86/include/asm/fsgsbase.h
index ab2547f97c2c..70ff4ef457b1 100644
--- a/arch/x86/include/asm/fsgsbase.h
+++ b/arch/x86/include/asm/fsgsbase.h
@@ -25,7 +25,7 @@ static __always_inline unsigned long rdfsbase(void)
 {
 	unsigned long fsbase;
 
-	asm volatile("rdfsbase %0" : "=r" (fsbase) :: "memory");
+	asm volatile("rdfsbase %0" : "=r" (fsbase));
 
 	return fsbase;
 }
@@ -34,7 +34,7 @@ static __always_inline unsigned long rdgsbase(void)
 {
 	unsigned long gsbase;
 
-	asm volatile("rdgsbase %0" : "=r" (gsbase) :: "memory");
+	asm volatile("rdgsbase %0" : "=r" (gsbase));
 
 	return gsbase;
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-03-10 18:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10  8:21 [PATCH -tip 1/3] x86/fsgsbase: Remove unnecessary "memory" clobbers from FS/GS base accessors Uros Bizjak
2026-03-10  8:21 ` [PATCH -tip 2/3] x86/segment: Remove unnecessary memory clobber from savesegment() Uros Bizjak
2026-03-10  8:21 ` [PATCH -tip 3/3] x86/segment: Use ASM_INPUT_RM in __loadsegment_fs() Uros Bizjak
2026-03-10 10:27 ` [PATCH -tip 1/3] x86/fsgsbase: Remove unnecessary "memory" clobbers from FS/GS base accessors Peter Zijlstra
2026-03-10 14:11   ` David Laight
2026-03-10 14:12     ` Peter Zijlstra
2026-03-10 15:48       ` Uros Bizjak
2026-03-10 18:11         ` Peter Zijlstra
2026-03-10 18:27           ` Uros Bizjak
2026-03-10 14:59     ` Uros Bizjak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.