From: Marc Zyngier <maz@kernel.org>
To: Kashyap Chamarthy <kchamart@redhat.com>
Cc: "Eric Auger" <eric.auger@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Daniel \"P. Berrangé\"" <berrange@redhat.com>,
eric.auger.pro@gmail.com, qemu-devel@nongnu.org,
qemu-arm@nongnu.org, kvmarm@lists.linux.dev,
peter.maydell@linaro.org, richard.henderson@linaro.org,
alex.bennee@linaro.org, oliver.upton@linux.dev,
sebott@redhat.com, shameerali.kolothum.thodi@huawei.com,
armbru@redhat.com, abologna@redhat.com, jdenemar@redhat.com,
shahuang@redhat.com, mark.rutland@arm.com, philmd@linaro.org,
pbonzini@redhat.com
Subject: Re: [PATCH RFCv2 00/20] kvm/arm: Introduce a customizable aarch64 KVM host model
Date: Sat, 21 Dec 2024 14:45:03 +0000 [thread overview]
Message-ID: <86o715p028.wl-maz@kernel.org> (raw)
In-Reply-To: <Z2Vak-hbCMaxm-JJ@gezellig>
On Fri, 20 Dec 2024 11:52:51 +0000,
Kashyap Chamarthy <kchamart@redhat.com> wrote:
>
> On Thu, Dec 19, 2024 at 03:41:56PM +0000, Marc Zyngier wrote:
> > On Thu, 19 Dec 2024 15:07:25 +0000,
> > Kashyap Chamarthy <kchamart@redhat.com> wrote:
> > >
> > > On Thu, Dec 19, 2024 at 12:26:29PM +0000, Marc Zyngier wrote:
> > > > On Thu, 19 Dec 2024 11:35:16 +0000,
> > > > Kashyap Chamarthy <kchamart@redhat.com> wrote:
>
> [...]
>
> > > > You can't rely on userspace for security, that'd be completely
> > > > ludicrous.
> > >
> > > As Dan Berrangé points out, it's the bog-standard way QEMU deals with
> > > some of the CPU-related issues on x86 today. See this "important CPU
> > > flags"[2] section in the QEMU docs.
> >
> > I had a look, and we do things quite differently. For example, the
> > spec-ctrl equivalent in implemented in FW and in KVM, and is exposed
> > by default if the HW is vulnerable. Userspace could hide that the
> > mitigation is there, but that's the extent of the configurability.
>
> Noted. As Dan says, as long as QEMU can toggle the feature on/off, then
> that might be sufficient in the context of migratability.
>
> [...]
>
> > > To reply to your other question on this thread[3] about "which ABI?" I
> > > think Dan is talking about the *guest* ABI: the virtual "chipset" that
> > > is exposed to a guest (e.g. PCI(e) topology, ACPI tables, CPU model,
> > > etc). As I understand it, this "guest ABI" should remain predictable,
> > > regardless of:
> > >
> > > - whether you're updating KVM, QEMU, or the underlying physical
> > > hardware itself; or
> > > - if the guest is migrated, live or offline
> > >
> > > (As you might know, QEMU's "machine types" concept allows to create a
> > > stable guest ABI.)
> >
> > All of this is under control of QEMU, *except* for the "maximum" of
> > the architectural features exposed to the guest. All you can do is
> > *downgrade* from there, and only to a limited extent.
> >
> > That, in turn has a direct impact on what you call the "CPU model",
> > which for the ARM architecture really doesn't exist. All we have is a
> > bag of discrete features, with intricate dependencies between them.
>
> I see; thanks for this explanation. Your last sentence above is the
> shortest summary of the CPU features situation on ARM I've ever read so
> far.
>
> So, I infer this from what you're saying (do correct if it's wrong):
>
> • Currently it is impractical (not feasible?) to pull together a
> minimal-and-usable set of CPU features + their dependencies on ARM
> to come up with a "CPU model" that can work across a reasonable set
> of hardware.
It isn't quite that. It *is* technically possible, and KVM does give
you the tools you need for that. In practice, the diversity of the
ecosystem is so huge that you can only rely on some very basic stuff
unless the implementations are already very close. And that "small
details" such as the timer frequency are strictly identical.
>
> • If the above is true, then the ability to toggle CPU features on and
> off might become even more important for QEMU — if it wants to be
> able to support live migration across mixed set of hardware on ARM.
Turning CPU features off is not always possible. Hiding them is
generally possible, with a number of exceptions. We try our best to
provide both, but it's... complicated.
[...]
> Related tangent on CPU feature discoverability on ARM:
>
> Speaking of "Neoverse-N1", looking at a system that I have access to,
> the `lscpu` output does not say anything about who the integrator is; it
> only says:
>
> ...
> Vendor ID: ARM
> Model name: Neoverse-N1
> ...
>
> I realize, `lscpu` displays only whatever the kernel knows. Nothing in
> `dmidecode` either.
The kernel does not know anything about the "Neoverse-N1" string. It
can match some MIDR_EL1 values for errata workaround purposes, but
doesn't gives two hoots about a human readable string.
Every other year, we get asked to add a full database of strings in
the kernel. The answer is a simple, polite, and final "no way". This
serves no purpose at all. lscpu does have that database, and that's
the right place to do it.
When it comes to integration, the firmware can optionally report some
information, which is the EL3 version of a commercial break (see the
SOC_ID stuff). This isn't wildly deployed, thankfully.
> Also, it looks like there's no equivalent of a "CPUID" instruction (I
> realize it is x86-specific) on ARM. Although, I came across a Google
> Git repo that seems to implement a bespoke, "aarch64_cpuid". From a
> what I see, it seems to fetch the "Main ID Register" (MIDR_EL1) - I
> don't know enough about it to understand its implications:
>
> https://github.com/google/cpu_features/blob/main/src/impl_aarch64_cpuid.c
MIDR_EL1 doesn't give you much, and you cannot assume anything about
the the feature set from it. Linux already allows you to inspect the
ID registers from userspace (by trapping, emulating, and sanitising
the result). That's the only reliable source of information.
>
> > That's why I don't see CPU models as a viable thing in terms of ABI.
> > They are an approximation of what you could have, but the ABI is
> > elsewhere.
>
> Hmm, this is "significant new information" for me. If CPU models can't
> be part of the guest ABI on ARM, then the whole "migratability across
> heterogenous hardware" on QEMU requires deeper thinking.
As I said all along, the only source of truth is the set of ID
registers. Nothing else. You can build a "model" on top of that, but
not the other way around.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2024-12-21 14:45 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 11:21 [PATCH RFCv2 00/20] kvm/arm: Introduce a customizable aarch64 KVM host model Cornelia Huck
2024-12-06 11:21 ` [PATCH RFCv2 01/20] kvm: kvm_get_writable_id_regs Cornelia Huck
2024-12-12 13:59 ` Richard Henderson
2024-12-12 14:12 ` Eric Auger
2024-12-13 15:43 ` Cornelia Huck
2024-12-06 11:21 ` [PATCH RFCv2 02/20] arm/cpu: Add sysreg definitions in cpu-sysregs.h Cornelia Huck
2024-12-12 14:37 ` Richard Henderson
2024-12-12 17:46 ` Eric Auger
2024-12-12 18:12 ` Richard Henderson
2024-12-13 16:16 ` Cornelia Huck
2024-12-06 11:21 ` [PATCH RFCv2 03/20] arm/cpu: Store aa64isar0 into the idregs arrays Cornelia Huck
2024-12-06 11:21 ` [PATCH RFCv2 04/20] arm/cpu: Store aa64isar1/2 into the idregs array Cornelia Huck
2024-12-06 11:21 ` [PATCH RFCv2 05/20] arm/cpu: Store aa64drf0/1 " Cornelia Huck
2024-12-06 11:21 ` [PATCH RFCv2 06/20] arm/cpu: Store aa64mmfr0-3 " Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 07/20] arm/cpu: Store aa64drf0/1 " Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 08/20] arm/cpu: Store aa64smfr0 " Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 09/20] arm/cpu: Store id_isar0-7 " Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 10/20] arm/cpu: Store id_mfr0/1 " Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 11/20] arm/cpu: Store id_dfr0/1 " Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 12/20] arm/cpu: Store id_mmfr0-5 " Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 13/20] arm/cpu: Add infra to handle generated ID register definitions Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 14/20] arm/cpu: Add sysreg generation scripts Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 15/20] arm/cpu: Add generated files Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 16/20] arm/kvm: Allow reading all the writable ID registers Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 17/20] arm/kvm: write back modified ID regs to KVM Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 18/20] arm/cpu: more customization for the kvm host cpu model Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 19/20] arm-qmp-cmds: introspection for ID register props Cornelia Huck
2024-12-06 11:22 ` [PATCH RFCv2 20/20] arm/cpu-features: document ID reg properties Cornelia Huck
2024-12-12 7:41 ` [PATCH RFCv2 00/20] kvm/arm: Introduce a customizable aarch64 KVM host model Eric Auger
2024-12-12 8:12 ` Eric Auger
2024-12-12 8:42 ` Eric Auger
2024-12-12 13:09 ` Shameerali Kolothum Thodi
2024-12-12 13:09 ` Shameerali Kolothum Thodi via
2024-12-12 13:29 ` Eric Auger
2024-12-12 9:10 ` Daniel P. Berrangé
2024-12-12 9:36 ` Cornelia Huck
2024-12-12 10:04 ` Eric Auger
2024-12-12 14:46 ` Cornelia Huck
2024-12-19 11:35 ` Kashyap Chamarthy
2024-12-19 12:26 ` Marc Zyngier
2024-12-19 12:38 ` Daniel P. Berrangé
2024-12-19 13:01 ` Marc Zyngier
2024-12-19 15:07 ` Kashyap Chamarthy
2024-12-19 15:41 ` Marc Zyngier
2024-12-19 17:51 ` Daniel P. Berrangé
2024-12-20 16:04 ` Cornelia Huck
2024-12-21 13:02 ` Marc Zyngier
2024-12-20 11:52 ` Kashyap Chamarthy
2024-12-20 16:17 ` Cornelia Huck
2024-12-21 14:45 ` Marc Zyngier [this message]
2024-12-16 16:42 ` Cornelia Huck
2024-12-16 16:58 ` Cornelia Huck
2024-12-12 13:13 ` Sebastian Ott
2024-12-12 14:46 ` Cornelia Huck
2024-12-17 15:21 ` Marc Zyngier
2024-12-17 18:05 ` Eric Auger
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=86o715p028.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=abologna@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=cohuck@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=eric.auger@redhat.com \
--cc=jdenemar@redhat.com \
--cc=kchamart@redhat.com \
--cc=kvmarm@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=oliver.upton@linux.dev \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sebott@redhat.com \
--cc=shahuang@redhat.com \
--cc=shameerali.kolothum.thodi@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.