On Fri, Sep 11, 2026 at 09:19:51AM -0700, Sean Christopherson wrote: > On Thu, Sep 10, 2026, Ewan Hai-oc wrote: > > From: Frank Zhu <[email protected]> > > > > KVM allows userspace to query MSR_IA32_PERF_CAPABILITIES through > > KVM_GET_MSRS even when PDCM is not exposed in KVM_GET_SUPPORTED_CPUID. > > However, vCPU accesses to the MSR fail without PDCM. > > Hrm, no, KVM is supposed to allow reads and drop writes of '0' for MSRs that > are > advertised to userspace, but ultimately unsupported. I'm pretty sure this is > a > KVM bug. I think MSR_IA32_ARCH_CAPABILITIES is also affected. > > Completely untested, but I think this? > > diff --git a/arch/x86/kvm/msrs.c b/arch/x86/kvm/msrs.c > index dd3bb04878ca..fa77cfdbda7e 100644 > --- a/arch/x86/kvm/msrs.c > +++ b/arch/x86/kvm/msrs.c > @@ -512,9 +512,15 @@ static int kvm_get_feature_msr(struct kvm_vcpu *vcpu, > u32 index, u64 *data, > > switch (index) { > case MSR_IA32_ARCH_CAPABILITIES: > + if (!kvm_cpu_cap_has(X86_FEATURE_ARCH_CAPABILITIES)) > + return KVM_MSR_RET_UNSUPPORTED; > + > *data = kvm_get_arch_capabilities(); > break; > case MSR_IA32_PERF_CAPABILITIES: > + if (!kvm_cpu_cap_has(X86_FEATURE_PDCM)) > + return KVM_MSR_RET_UNSUPPORTED; > + > *data = kvm_caps.supported_perf_cap; > break; > case MSR_PLATFORM_INFO: >
I saw that you applied eight patches from the series to the kvm-x86 selftests branch and skipped patch 6 as a KVM bug. We are testing the change you suggested on Zhaoxin systems with and without PDCM support. We expect to report the results within the next few weeks. Thanks for applying the patches and for looking into the patch 6 issue.

