[Devel,RHEL7,COMMIT] ms/KVM: x86: expose MSR_TSC_AUX to userspace

Submitted by Konstantin Khorenko on Dec. 1, 2016, 9:51 a.m.

Details

Message ID 201612010951.uB19pCds020676@finist_cl7.x64_64.work.ct
State New
Series "KVM: x86: expose MSR_TSC_AUX to userspace"
Headers show

Commit Message

Konstantin Khorenko Dec. 1, 2016, 9:51 a.m.
The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.20.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.36.1.vz7.20.8
------>
commit 37f023b9287ec994f33a676f280ebd26816b2dfa
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Thu Dec 1 13:51:12 2016 +0400

    ms/KVM: x86: expose MSR_TSC_AUX to userspace
    
    If we do not do this, it is not properly saved and restored across
    migration.  Windows notices due to its self-protection mechanisms,
    and is very upset about it (blue screen of death).
    
    Cc: Radim Krcmar <rkrcmar@redhat.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    
    ms commit: 9dbe6cf ("KVM: x86: expose MSR_TSC_AUX to userspace")
    https://jira.sw.ru/browse/PSBM-55531
    
    Signed-off-by: Evgeny Yakovlev <eyakovlev@virtuozzo.com>
---
 arch/x86/kvm/x86.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 4b2754b..78ea28c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -953,7 +953,7 @@  static u32 msrs_to_save[] = {
 	MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR,
 #endif
 	MSR_IA32_TSC, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA,
-	MSR_IA32_FEATURE_CONTROL, MSR_IA32_BNDCFGS
+	MSR_IA32_FEATURE_CONTROL, MSR_IA32_BNDCFGS, MSR_TSC_AUX,
 };
 
 static unsigned num_msrs_to_save;
@@ -4148,16 +4148,17 @@  static void kvm_init_msr_list(void)
 
 		/*
 		 * Even MSRs that are valid in the host may not be exposed
-		 * to the guests in some cases.  We could work around this
-		 * in VMX with the generic MSR save/load machinery, but it
-		 * is not really worthwhile since it will really only
-		 * happen with nested virtualization.
+		 * to the guests in some cases.
 		 */
 		switch (msrs_to_save[i]) {
 		case MSR_IA32_BNDCFGS:
 			if (!kvm_x86_ops->mpx_supported())
 				continue;
 			break;
+		case MSR_TSC_AUX:
+			if (!kvm_x86_ops->rdtscp_supported())
+				continue;
+			break;
 		default:
 			break;
 		}