From: "H. Peter Anvin" <hpa@zytor.com>
To: "Xin Li (Intel)" <xin@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
Subject: Re: [PATCH v2 1/1] x86/fred: Fix INT80 emulation for FRED
Date: Tue, 16 Apr 2024 11:23:24 -0700 [thread overview]
Message-ID: <ece31eca-37bc-4b39-9fc9-7e6fda741729@zytor.com> (raw)
In-Reply-To: <20240416175804.3328999-1-xin@zytor.com>
On 4/16/24 10:58, Xin Li (Intel) wrote:
> Add a FRED-specific INT80 handler fred_int80_emulation().
>
> Commit
> 55617fb991df ("x86/entry: Do not allow external 0x80 interrupts")
> added a bunch of checks to the int $0x80 path, however they are
> unnecessary and event wrong in fact under FRED.
I think the following points should be added to the head comment, and
not just the commit log:
> 1) FRED distinguishes external interrupts from software interrupts,
> thus int80_emulation() should NEVER be called for handling an
> external interrupt, and then int80_is_external() is meaningless
> when FRED is enabled.
1a) As INT instructions and hardware interrupts are separate event
types, FRED does not preclude the use of vector 0x80 for external
interrupts. As a result the FRED setup code does *NOT* reserve vector
0x80 and calling int80_is_external() is not merely suboptimal but
actively incorrect: it could could cause a system call to be incorrectly
ignored.
> 2) The FRED kernel entry handler NEVER dispatches INTx, which is
> of event type EVENT_TYPE_SWINT, so the user mode checking in
> do_int80_emulation() is redundant.
>
> 3) int80_emulation() does a CLEAR_BRANCH_HISTORY, which is likly
s/likly/likely/
> an overkill for new x86 CPU implementations that support FRED.
s/an //
4) int $0x80 is the FAST path for 32-bit system calls under FRED.
[...]
> A dedicated FRED INT80 handler duplicates most of the code in
s/most/quite a bit/
(I think there is actually less than half the code left. This could be
further cleaned up by inlining the common code, but if I were still
maintainer I would not want that for x86/urgent. This patch has the very
nice property for x86/urgent purposes that it doesn't touch non-FRED
code at all.)
> do_int80_emulation(), but it avoids sprinkling moar tests and
s/moar/more/
> seems more readable.
>
> Suggested-by: H. Peter Anvin (Intel) <hpa@zytor.com>
> Signed-off-by: Xin Li (Intel) <xin@zytor.com>
So, as Borislav pointed out:
Fixes: 55617fb991df ("x86/entry: Do not allow external 0x80 interrupts")
My fault.
next prev parent reply other threads:[~2024-04-16 18:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 17:58 Xin Li (Intel)
2024-04-16 18:23 ` H. Peter Anvin [this message]
2024-04-16 18:28 ` Borislav Petkov
2024-04-16 18:33 ` H. Peter Anvin
2024-04-17 6:51 ` Xin Li
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=ece31eca-37bc-4b39-9fc9-7e6fda741729@zytor.com \
--to=hpa@zytor.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xin@zytor.com \
/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®