Re: [PATCH] KVM: selftests: Avoid KVM_SET_CPUID2 after KVM_RUN in vmx_pmu_msrs_test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 16, 2021, Vitaly Kuznetsov wrote:
> Sean Christopherson <seanjc@xxxxxxxxxx> writes:
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index 85127b3e3690..65e297875405 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -3424,7 +3424,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> >
> >                 if (!msr_info->host_initiated)
> >                         return 1;
> > -               if (guest_cpuid_has(vcpu, X86_FEATURE_PDCM) && kvm_get_msr_feature(&msr_ent))
> > +               if (kvm_get_msr_feature(&msr_ent))
> >                         return 1;
> >                 if (data & ~msr_ent.data)
> >                         return 1;
> 
> This looks OK.
> 
> > @@ -3779,14 +3779,12 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> >                 msr_info->data = vcpu->arch.microcode_version;
> >                 break;
> >         case MSR_IA32_ARCH_CAPABILITIES:
> > -               if (!msr_info->host_initiated &&
> > -                   !guest_cpuid_has(vcpu, X86_FEATURE_ARCH_CAPABILITIES))
> > +               if (!msr_info->host_initiated)
> >                         return 1;
> >                 msr_info->data = vcpu->arch.arch_capabilities;
> >                 break;
> >         case MSR_IA32_PERF_CAPABILITIES:
> > -               if (!msr_info->host_initiated &&
> > -                   !guest_cpuid_has(vcpu, X86_FEATURE_PDCM))
> > +               if (!msr_info->host_initiated)
> >                         return 1;
> >                 msr_info->data = vcpu->arch.perf_capabilities;
> >                 break;
> >
> 
> Hm, this change will unconditionally forbid reading
> MSR_IA32_ARCH_CAPABILITIES/MSR_IA32_PERF_CAPABILITIES from the guest. Is
> this what we want?

No, I completely misread the code.  The kvm_set_msr_common() goof seems to be
the only bug, and that would also explain the selftest's bad testcase.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux