Re: [PATCH v9 19/26] KVM: nVMX: Enable support for secondary VM exit controls

From: Sohil Mehta

Date: Thu Sep 03 2026 - 15:09:56 EST


On 9/2/2026 1:49 PM, Sean Christopherson wrote:

> Normally I want MSR accesses to have the same fault semantics for userspace and
> guest accesses, but for the VMX MSRs, I think we should let userspace read at all
> times since they're feature MSRs. E.g. I don't want to end up in a state where
> userspace can't read an MSR because it restored/set MSRs in the "wrong" order.
>

Thanks Sean for the clarification.

> We could plumb in @host_initiated to vmx_get_vmx_msr(), but I think I would rather
> add the check in vmx_get_msr(). E.g. shoot for something like:
>

Happy to not be the bottleneck here since this is FRED independent.
Emily, do you want to pursue this given that you reported the original
issue?

If not, I can probably take a look after I send the FRED patches out. I
am sure Sashiko will report other such pre-existing stuff based on the
FRED patchset :)

> diff --git arch/x86/kvm/vmx/vmx.c arch/x86/kvm/vmx/vmx.c
> index 504630f0eb40..a99cebfe50e0 100644
> --- arch/x86/kvm/vmx/vmx.c
> +++ arch/x86/kvm/vmx/vmx.c
> @@ -2200,6 +2200,10 @@ int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> case KVM_FIRST_EMULATED_VMX_MSR ... KVM_LAST_EMULATED_VMX_MSR:
> if (!guest_cpu_cap_has(vcpu, X86_FEATURE_VMX))
> return 1;
> + if (!msr_info->host_initiated &&
> + !guest_cpu_has_vmx_msr(msr_info->index))
> + return 1;
> +
> if (vmx_get_vmx_msr(&vmx->nested.msrs, msr_info->index,
> &msr_info->data))
> return 1;
>
>
> That'll require yet another switch(), but reading these MSRs should never be a
> hot path.
>