From: "H. Peter Anvin" <hpa@zytor.com>
To: Brian Gerst <brgerst@gmail.com>
Cc: Uros Bizjak <ubizjak@gmail.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH -tip] x86/mm: Use %RIP-relative address in untagged_addr()
Date: Fri, 17 Nov 2023 12:17:58 -0800 [thread overview]
Message-ID: <45a7d005-ec54-43c8-8111-7712c3c2561f@zytor.com> (raw)
In-Reply-To: <CAMzpN2hY=JJRKPqsXr2BuyPZ5AJP3UzUPyMZoUNzTE00uN3iOw@mail.gmail.com>
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
prev parent reply other threads:[~2023-11-17 20:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-16 19:10 Uros Bizjak
2023-11-17 9:41 ` Peter Zijlstra
2023-11-17 10:45 ` kirill.shutemov
2023-11-17 18:15 ` H. Peter Anvin
2023-11-17 19:43 ` Brian Gerst
2023-11-17 20:17 ` H. Peter Anvin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45a7d005-ec54-43c8-8111-7712c3c2561f@zytor.com \
--to=hpa@zytor.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=ubizjak@gmail.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®