Skip to content

Commit 6593039

Browse files
Like Xusean-jc
authored andcommitted
KVM: x86: Explicitly zero cpuid "0xa" leaf when PMU is disabled
Add an explicit !enable_pmu check as relying on kvm_pmu_cap to be zeroed isn't obvious. Although when !enable_pmu, KVM will have zero-padded kvm_pmu_cap to do subsequent CPUID leaf assignments. Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Like Xu <likexu@tencent.com> Link: https://lore.kernel.org/r/20230603011058.1038821-7-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 13afa29 commit 6593039

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/cpuid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
948948
union cpuid10_eax eax;
949949
union cpuid10_edx edx;
950950

951-
if (!static_cpu_has(X86_FEATURE_ARCH_PERFMON)) {
951+
if (!enable_pmu || !static_cpu_has(X86_FEATURE_ARCH_PERFMON)) {
952952
entry->eax = entry->ebx = entry->ecx = entry->edx = 0;
953953
break;
954954
}

0 commit comments

Comments
 (0)