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

From: Uros Bizjak

Date: Tue Mar 10 2026 - 11:54:18 EST


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.

> Anyway, aside from that nit, yes these 3 patches look good to me.

Can this be considered as Acked-by: from your side?

Thanks,
Uros.