[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <45a7d005-ec54-43c8-8111-7712c3c2561f@zytor.com>
Date: Fri, 17 Nov 2023 12:17:58 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Brian Gerst <brgerst@...il.com>
Cc: Uros Bizjak <ubizjak@...il.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH -tip] x86/mm: Use %RIP-relative address in untagged_addr()
On 11/17/23 11:43, Brian Gerst wrote:>>
>> Why don't we simply have %gs_base == 0 as an invariant for !SMP?
>
> The reason is stack protector, which is still stuck at %gs:40. So
> GSBASE has to point at fixed_percpu_data, even on a UP build. That is
> corrected by the patch series I recently posted, though.
>
Right, that problem is gone.
>> If we
>> *REALLY* care to skip SWAPGS on !SMP systems, we could use alternativesYep, that is
>> to patch out %gs: and lock (wouldn't even have to be explicit: this is
>> the kind of thing that objtool does really well.) We can use
>> alternatives without anything special, since it only matters after we
>> have entered user spae for the first time and would be concurrent with
>> patching out SWAPGS itself.
>
> There is already support to patch out LOCK prefixes when running an
> SMP build on a single CPU (.smp_locks section). Patching out the GS
> prefix would only work if the initial percpu area is not freed.
> Beyond that I don't think other optimizations are worth the effort,
> and would get very little testing.
Yes, that is basically my point.
-hpa
Powered by blists - more mailing lists