Re: [PATCH 1/2] KVM: vmx, pmu: accept 0 for absent MSRs when host-initiated

From: Paolo Bonzini
Date: Wed Jun 01 2022 - 04:54:26 EST


On 5/31/22 20:37, Sean Christopherson wrote:
+
/*
* Writing depth MSR from guest could either setting the
* MSR or resetting the LBR records with the side-effect.
@@ -535,6 +542,8 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
case MSR_ARCH_LBR_CTL:
if (!arch_lbr_ctl_is_valid(vcpu, data))
break;
+ if (!guest_cpuid_has(vcpu, X86_FEATURE_ARCH_LBR))
+ return 0;

Similar bug here.

Can we just punt this out of kvm/queue until its been properly reviewed?

Yes, I agree. I have started making some changes and pushed the result to kvm/arch-lbr-for-weijiang.

Most of the MSR handling is rewritten (and untested).

The nested VMX handling was also completely broken so I just removed it. Instead, KVM should be adjusted so that it does not whine.

Paolo