From: Jan Beulich <jbeulich@suse.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Jun Nakajima <jun.nakajima@intel.com>,
Kevin Tian <kevin.tian@intel.com>,
Andrew Cooper <andrew.cooper3@citrix.com>, Wei Liu <wl@xen.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2] x86/vmx: add support for virtualize SPEC_CTRL
Date: Thu, 15 Feb 2024 17:07:51 +0100 [thread overview]
Message-ID: <67306bde-9877-4d6d-a964-3ea964256ce4@suse.com> (raw)
In-Reply-To: <Zc4zyLgM-OUNc6xG@macbook>
On 15.02.2024 16:54, Roger Pau Monné wrote:
> On Mon, Feb 12, 2024 at 03:09:01PM +0100, Jan Beulich wrote:
>> On 09.02.2024 12:40, Roger Pau Monne wrote:
>>> --- a/xen/arch/x86/hvm/vmx/vmx.c
>>> +++ b/xen/arch/x86/hvm/vmx/vmx.c
>>> @@ -823,18 +823,29 @@ static void cf_check vmx_cpuid_policy_changed(struct vcpu *v)
>>> {
>>> vmx_clear_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
>>>
>>> - rc = vmx_add_guest_msr(v, MSR_SPEC_CTRL, 0);
>>> - if ( rc )
>>> - goto out;
>>> + if ( !cpu_has_vmx_virt_spec_ctrl )
>>> + {
>>> + rc = vmx_add_guest_msr(v, MSR_SPEC_CTRL, 0);
>>> + if ( rc )
>>> + goto out;
>>> + }
>>> }
>>> else
>>> {
>>> vmx_set_msr_intercept(v, MSR_SPEC_CTRL, VMX_MSR_RW);
>>>
>>> - rc = vmx_del_msr(v, MSR_SPEC_CTRL, VMX_MSR_GUEST);
>>> - if ( rc && rc != -ESRCH )
>>> - goto out;
>>> - rc = 0; /* Tolerate -ESRCH */
>>> + /*
>>> + * NB: there's no need to clear the virtualize SPEC_CTRL control, as
>>> + * the MSR intercept takes precedence. The SPEC_CTRL shadow VMCS field
>>> + * is also not loaded on guest entry/exit if the intercept is set.
>>> + */
>>
>> It wasn't so much the shadow field than the mask one that I was concerned
>> might be used in some way. The shadow one clearly is used only during
>> guest RDMSR/WRMSR processing. To not focus on "shadow", maybe simple say
>> "The SPEC_CTRL shadow VMCS fields are also not ..."?
>
> What about:
>
> "The SPEC_CTRL shadow and mask VMCS fields don't take effect if the
> intercept is set."
SGTM.
Jan
prev parent reply other threads:[~2024-02-15 16:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-09 11:40 [PATCH v2] x86/vmx: add support for virtualize SPEC_CTRL Roger Pau Monne
2024-02-12 14:09 ` Jan Beulich
2024-02-15 15:54 ` Roger Pau Monné
2024-02-15 16:07 ` Jan Beulich [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=67306bde-9877-4d6d-a964-3ea964256ce4@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.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.