From: Will Deacon <will@kernel.org>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Ard Biesheuvel <ardb@kernel.org>,
Ard Biesheuvel <ardb@google.com>,
linux-arm-kernel@lists.infradead.org,
Catalin Marinas <catalin.marinas@arm.com>,
Marc Zyngier <maz@kernel.org>
Subject: Re: [PATCH v2 1/3] arm64: Avoid enabling KPTI unnecessarily
Date: Mon, 11 Dec 2023 11:39:39 +0000 [thread overview]
Message-ID: <20231211113939.GA24899@willie-the-truck> (raw)
In-Reply-To: <ZWX1fHAaiaxLoX8O@FVFF77S0Q05N.cambridge.arm.com>
On Tue, Nov 28, 2023 at 02:13:16PM +0000, Mark Rutland wrote:
> On Tue, Nov 28, 2023 at 11:03:40AM +0000, Will Deacon wrote:
> > On Mon, Nov 27, 2023 at 05:49:21PM +0000, Mark Rutland wrote:
> > > In addition to that intent, these functions are executed precisely once during
> > > boot, so using cpus_have_cap() avoids the space for the alt_instr and the cost
> > > of the patching of the site for a single check. I was also hoping to get rid of
> > > most of the feature check helpers now that they're largely trivial wrappers
> > > around alternative_has_cap(), which'd make it clearer which callsites care
> > > about the alterntive-ness and clear up the inconsistent naming.
> >
> > We can always remove the helpers when you get round to it, but ideally
> > many of these things would BUG() if they're called too early, much like
> > e.g. cpus_have_final_cap(). Inlining the alternative is going to make that
> > more difficult.
>
> That's fair.
>
> My major goal is that it's clear where we're using an altnernative and where
> we're not; if the thinking is the vast majority *should* be alternatives, I can
> annotate the non-alternative cases to make that clear.
>
> > > If you want these cases moves back to alternatives-based feature check helpers,
> > > I can go do that.
> >
> > I was thinking of something like the diff below to start with.
>
> Sure; as-is that breaks the hyp offset patching, and we'll need ensure we still
> call hyp_mode_check() before apply_alternatives_all(). In hyp_mode_check() we
> call kvm_compute_layout(), which generates the 'va_mask', 'tag_val', and
> 'tag_lsb' values which are used by the kvm_update_va_mask() patching callback
> (for kern_hyp_va() and __kern_hyp_va()).
>
> I think that can be moved before enable_cpu_capabilities() ratehr than needing
> to be between enable_cpu_capabilities() and apply_alternatives_all(), but I'll
> need to go digging to make certain.
>
> Do you want this as a cleanup for v6.7-rc*, or as something to queue for
> v6.8-rc1?
Sorry, I keep forgetting to reply to this after we spoke in-person. If
you're able to spin something in the next day or so, I can pick it up for
the next merge window. In the meantime, I'll grab Ard's changes so this can
go on top.
Cheers,
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-12-11 11:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 12:00 [PATCH v2 0/3] arm64 kpti fixes Ard Biesheuvel
2023-11-27 12:00 ` [PATCH v2 1/3] arm64: Avoid enabling KPTI unnecessarily Ard Biesheuvel
2023-11-27 15:48 ` Will Deacon
2023-11-27 15:52 ` Ard Biesheuvel
2023-11-27 16:31 ` Will Deacon
2023-11-27 16:39 ` Ard Biesheuvel
2023-11-27 16:41 ` Will Deacon
2023-11-27 17:49 ` Mark Rutland
2023-11-28 11:03 ` Will Deacon
2023-11-28 14:13 ` Mark Rutland
2023-12-11 11:39 ` Will Deacon [this message]
2023-12-12 17:16 ` Mark Rutland
2023-11-28 11:06 ` Will Deacon
2023-11-27 12:00 ` [PATCH v2 2/3] arm64: mm: Only map KPTI trampoline if it is going to be used Ard Biesheuvel
2023-11-27 12:00 ` [PATCH v2 3/3] arm64: Kconfig: drop KAISER reference from KPTI option description Ard Biesheuvel
2023-11-27 12:47 ` [PATCH v2 0/3] arm64 kpti fixes Mark Rutland
2023-11-30 19:14 ` (subset) " Catalin Marinas
2023-12-11 20:27 ` Will Deacon
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=20231211113939.GA24899@willie-the-truck \
--to=will@kernel.org \
--cc=ardb@google.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=maz@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