From: Xin Li <xin@zytor.com>
To: "H. Peter Anvin" <hpa@zytor.com>, linux-kernel@vger.kernel.org
Cc: luto@kernel.org, tglx@linutronix.de, mingo@redhat.com,
bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
brgerst@gmail.com
Subject: Re: [PATCH v1 1/1] x86/entry/64: Skip SYSRET validation tests when FRED is enabled
Date: Wed, 10 Apr 2024 09:44:05 -0700 [thread overview]
Message-ID: <ad5bd7f5-3290-4ddc-83bd-41a18fa1beee@zytor.com> (raw)
In-Reply-To: <56cbf1f0-0867-44c2-a9fd-712bf3549cbb@zytor.com>
On 4/9/2024 4:35 PM, H. Peter Anvin wrote:
> Now, for a FRED system the return value is ignored anyway, so the only
> benefit of this is skipping the test, correct?
Yes, and as syscalls are hot paths, we should save some cycles.
>
> I do observe than what is left of do_fast_syscall_32 is a single
> assignment followed by __do_fast_syscall_32(), which could be turned
> into a tailcall.
Ah, I didn't realize this is a better way, will change.
>
> Another thing that has been added lately is a bunch of tests on the int
> $0x80 path. This is a slow path *on legacy hardware*, but on FRED
> systems it is the *fast* path for IA32 emulation. These tests are also
> totally unnecessary *AND IN FACT, WRONG* on a FRED system, as FRED
> distinguishes external interrupts from software interrupts.
>
> Furthermore, under FRED interrupt 0x80 is available as a hardware
> interrupt (since there is no reason to block it out.) Therefore, going
> and poking the APIC as in int80_is_external() is INCORRECT and possibly
> fatal.
>
> Again, the easiest way to fix that is to follow what XenPV does in
> int80_is_external(), but there is more unnecessary stuff:
> !user_mode(regs) cannot happen on FRED, and the stuff in the
> int80_emulation assembly function should, if it is needed at all on any
> FRED-compatible hardware (I don't believe so) should be done in the FRED
> user mode assembly entry stub.
>
> Thus, it might be better to strip down do_int80_emulation() to a lean
> fred_int80_emulation().
Yeah, FRED is fundamentally better with its nature. Will do!
Thanks!
Xin
>
> -hpa
>
> On 4/2/24 23:24, Xin Li (Intel) wrote:
>> Don't do SYSRET validation tests when FRED is enabled, since ERETU is
>> the only legit instruction to return to user level.
>>
>> Signed-off-by: Xin Li (Intel) <xin@zytor.com>
>> ---
>> arch/x86/entry/common.c | 12 ++++++++++--
>> 1 file changed, 10 insertions(+), 2 deletions(-)
prev parent reply other threads:[~2024-04-10 16:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-03 6:24 Xin Li (Intel)
2024-04-09 23:35 ` H. Peter Anvin
2024-04-10 16:44 ` Xin Li [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=ad5bd7f5-3290-4ddc-83bd-41a18fa1beee@zytor.com \
--to=xin@zytor.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--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®