Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: SVM: Skip OSVW MSR reads if current CPU doesn't support the feature

Skip the OSVW RDMSRs if the current CPU doesn't enumerate support for the
MSRs. In practice, checking only the boot CPU's capabilities is
sufficient, as the RDMSRs should fault when unsupported, but there's no
downside to being more precise, and checking only the boot CPU _looks_
wrong given the rather odd semantics of the MSRs. E.g. if a CPU doesn't
support OVSW, then KVM must assume all errata are present.

Link: https://patch.msgid.link/20251113231420.1695919-6-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>

+2 -6
+2 -6
arch/x86/kvm/svm/svm.c
··· 447 447 if (!osvw_len) 448 448 return; 449 449 450 - if (!boot_cpu_has(X86_FEATURE_OSVW)) { 451 - osvw_status = osvw_len = 0; 452 - return; 453 - } 454 - 455 - if (native_read_msr_safe(MSR_AMD64_OSVW_ID_LENGTH, &len) || 450 + if (!this_cpu_has(X86_FEATURE_OSVW) || 451 + native_read_msr_safe(MSR_AMD64_OSVW_ID_LENGTH, &len) || 456 452 native_read_msr_safe(MSR_AMD64_OSVW_STATUS, &status)) 457 453 len = status = 0; 458 454