From: Alejandro Vallejo <alejandro.vallejo@cloud.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 3/3] x86: Use CpuidUserDis if an AMD HVM guest toggles CPUID faulting
Date: Wed, 10 May 2023 11:52:28 +0100 [thread overview]
Message-ID: <645b776e.5d0a0220.3ff50.bf0e@mx.google.com> (raw)
In-Reply-To: <7d41940f-e671-954c-1afc-510e4fa674fa@suse.com>
On Wed, May 10, 2023 at 10:15:31AM +0200, Jan Beulich wrote:
> On 09.05.2023 12:05, Andrew Cooper wrote:
> > On 08/05/2023 2:18 pm, Jan Beulich wrote:
> >> On 05.05.2023 19:57, Alejandro Vallejo wrote:
> >>> This is in order to aid guests of AMD hardware that we have exposed
> >>> CPUID faulting to. If they try to modify the Intel MSR that enables
> >>> the feature, trigger levelling so AMD's version of it (CpuidUserDis)
> >>> is used instead.
> >>>
> >>> Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
> >>> ---
> >>> xen/arch/x86/msr.c | 9 ++++++++-
> >>> 1 file changed, 8 insertions(+), 1 deletion(-)
> >> Don't you also need to update cpu-policy.c:calculate_host_policy()
> >> for the guest to actually know it can use the functionality? Which
> >> in turn would appear to require some form of adjustment to
> >> lib/x86/policy.c:x86_cpu_policies_are_compatible().
> >
> > I asked Alejandro to do it like this.
> >
> > Advertising this to guests requires plumbing another MSR into the
> > infrastructure which isn't quite set up properly let, and is in flux
> > from my work.
>
> Maybe there was some misunderstanding here, as I realize only now. I
> wasn't asking to expose the AMD feature, but instead I was after
>
> /* 0x000000ce MSR_INTEL_PLATFORM_INFO */
> /* probe_cpuid_faulting() sanity checks presence of MISC_FEATURES_ENABLES */
> p->platform_info.cpuid_faulting = cpu_has_cpuid_faulting;
>
> wanting to be extended by "|| boot_cpu_has(X86_FEATURE_CPUID_USER_DIS)".
> That, afaict, has no connection to plumbing yet another MSR.
>
> Jan
Let me backtrack a little. There's 2 different (but related) matters under
discussion:
1. Trapping PV guest attempts to run the cpuid instruction
2. Providing a virtualized CPUID faulting interface so a guest kernel
can intercept the CPUID instructions of code running under it.
This series was meant to provide fix (1) on AMD hardware. I did go a bit
beyond in v1, trying to provide support for a unified faulting mechanism
on AMD, but providing a virtualized CPUID faulting interface needs to be
done a bit more carefully than that. Doing it partially now just adds tech
debt to be paid when CpuidUserDis is exposed to the domains.
Changing the policy to expose the Intel interface when AMD is the backend
falls on (2), which is probably better off done separately in a unified way.
v2 removes the changes to x86/msr.c so only (1) is addressed.
Does this make sense?
Alejandro
next prev parent reply other threads:[~2023-05-10 10:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-05 17:57 [PATCH 0/3] Add CpuidUserDis support Alejandro Vallejo
2023-05-05 17:57 ` [PATCH 1/3] x86: Add AMD's CpuidUserDis bit definitions Alejandro Vallejo
2023-05-05 17:57 ` [PATCH 2/3] x86: Add support for CpuidUserDis Alejandro Vallejo
2023-05-08 9:17 ` Jan Beulich
2023-05-05 17:57 ` [PATCH 3/3] x86: Use CpuidUserDis if an AMD HVM guest toggles CPUID faulting Alejandro Vallejo
2023-05-08 13:18 ` Jan Beulich
2023-05-09 10:05 ` Andrew Cooper
2023-05-09 14:41 ` Jan Beulich
2023-05-09 14:57 ` Alejandro Vallejo
2023-05-10 8:15 ` Jan Beulich
2023-05-10 10:52 ` Alejandro Vallejo [this message]
2023-05-10 13:17 ` Jan Beulich
2023-05-08 9:06 ` [PATCH 0/3] Add CpuidUserDis support Jan Beulich
2023-05-10 11:28 ` Alejandro Vallejo
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=645b776e.5d0a0220.3ff50.bf0e@mx.google.com \
--to=alejandro.vallejo@cloud.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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 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.