lkml.org 
[lkml]   [2021]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] KVM: selftests: Avoid KVM_SET_CPUID2 after KVM_RUN in vmx_pmu_msrs_test
Date
Sean Christopherson <seanjc@google.com> writes:

> On Thu, Dec 16, 2021, Vitaly Kuznetsov wrote:
>> Sean Christopherson <seanjc@google.com> 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.
>

Ok then, v2 is coming.

--
Vitaly

\
 
 \ /
  Last update: 2021-12-16 17:00    [W:0.041 / U:0.792 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site