Re: [PATCH -tip 1/3] x86/fsgsbase: Remove unnecessary "memory" clobbers from FS/GS base accessors

From: Peter Zijlstra

Date: Tue Mar 10 2026 - 14:14:15 EST


On Tue, Mar 10, 2026 at 04:48:34PM +0100, Uros Bizjak wrote:
> On 3/10/26 11:27, Peter Zijlstra wrote:
>
> On Tue, Mar 10, 2026 at 09:21:22AM +0100, Uros Bizjak wrote:
>
> >> 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.
> >
> > The point isn't that this accesses memory, but that prior or later
> > accesses would end up at different memory locations (as would happen
> > when setting the per-cpu segment.
>
> Please note that the above comment is talking about rd[fs,gs]base
> instructions that only *read* the segment register into GPR. They do
> not affect memory in any way and can be scheduled anywhere, but they
> should not be scheduled over segment register *setting* instructions.

Yes, we are in violent agreement :-) I just took issue with the way your
changelog expressed things. The memory clobber isn't about the asm
accessing memory or not, it is about adding a scheduling constraint.

> > Anyway, aside from that nit, yes these 3 patches look good to me.
>
> Can this be considered as Acked-by: from your side?

Yep.