[Devel] [PATCH RHEL7 COMMIT] KVM: x86: add a stub for MSR_PLATFORM_INFO

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 6 15:17:02 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.12
------>
commit 69288ddadbefd10c2b0d56f0719761bace8e0421
Author: Denis Plotnikov <dplotnikov at virtuozzo.com>
Date:   Thu Jun 6 15:17:00 2019 +0300

    KVM: x86: add a stub for MSR_PLATFORM_INFO
    
    This is done to prevent windows guest crashing while running
    PassMark benchmark which calls rdmsr(0xce) - MSR_PLATFORM_INFO
    from PassMark driver.
    
    The reason why the test driver does so is unclear, since
    MSR_PLATFORM_INFO is used to calibrate tsc for certain Intel Atom
    cpus (please, refer to try_msr_calibrate_tsc in arch/x86/kernel/tsc_msr.c).
    
    Anyway, KVM so far didn't have MSR_PLATFORM_INFO MSR implemented and
    this didn't cause any problems with guest crashes on both Linux and Windows
    platforms. So, the only reason why the crashes started now is that
    the customer started using PassMark test on KVM platform recently.
    
    https://jira.sw.ru/browse/PSBM-95187
    
    Signed-off-by: Denis Plotnikov <dplotnikov at virtuozzo.com>
---
 arch/x86/kvm/x86.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f1230a251add..b855f03477f4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1018,6 +1018,7 @@ static u32 emulated_msrs[] = {
 	MSR_IA32_MCG_EXT_CTL,
 	MSR_IA32_SMBASE,
 	MSR_AMD64_VIRT_SPEC_CTRL,
+	MSR_PLATFORM_INFO,
 };
 
 static unsigned num_emulated_msrs;
@@ -2300,6 +2301,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 			return 1;
 		vcpu->arch.osvw.status = data;
 		break;
+	case MSR_PLATFORM_INFO:
+		return 1;
+		break;
 	default:
 		if (msr && (msr == vcpu->kvm->arch.xen_hvm_config.msr))
 			return xen_hvm_config(vcpu, data);
@@ -2517,6 +2521,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 			return 1;
 		msr_info->data = vcpu->arch.osvw.status;
 		break;
+	case MSR_PLATFORM_INFO:
+		msr_info->data = 0;
+		break;
 	default:
 		if (kvm_pmu_is_valid_msr(vcpu, msr_info->index))
 			return kvm_pmu_get_msr(vcpu, msr_info->index, &msr_info->data);



More information about the Devel mailing list