|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2] x86/vmx: add support for virtualize SPEC_CTRL
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |