[pve-devel] [PATCH kernel] fix freeze of VMs on live migration

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Feb 26 11:21:55 CET 2016


A side effect triggered by a backported patch from upstream
freezes VMs on live migrations and renders them completely
unusable.

This reverts the backported patch, even if it's not the root cause,
it works around the problem. Upstream has been notified.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

I tested live migration with following OSes:
* Windows 7 (provoked some MSR reads which the reverted patch
  should fix, no crash produced.)
* Ubuntu Server 15.04
* Linux Mint
* Alpine Linux

This patch makes these work again (the failed all without it).
Found no regression or crash.

Will look around with a "reverse" bisect in 4.4 and try to find the
root cause.

 ...t-KVM-x86-expose-MSR_TSC_AUX-to-userspace.patch | 59 ++++++++++++++++++++++
 Makefile                                           |  2 +
 2 files changed, 61 insertions(+)
 create mode 100644 0001-Revert-KVM-x86-expose-MSR_TSC_AUX-to-userspace.patch

diff --git a/0001-Revert-KVM-x86-expose-MSR_TSC_AUX-to-userspace.patch b/0001-Revert-KVM-x86-expose-MSR_TSC_AUX-to-userspace.patch
new file mode 100644
index 0000000..fbc94f9
--- /dev/null
+++ b/0001-Revert-KVM-x86-expose-MSR_TSC_AUX-to-userspace.patch
@@ -0,0 +1,59 @@
+From 792c5133c47b6599231ca11a95d38f18142dc8b5 Mon Sep 17 00:00:00 2001
+From: Thomas Lamprecht <t.lamprecht at proxmox.com>
+Date: Fri, 26 Feb 2016 09:56:10 +0100
+Subject: [PATCH] Revert "KVM: x86: expose MSR_TSC_AUX to userspace"
+
+This reverts commit 3f11933efc9ef55ecb2ac7e6d626e8d05a99a4b1.
+
+We get a bad side effect which freezes VMs with a graphical
+interface on live migration completely and renders them unusable.
+
+This patch reverts the commit causing this, found with git bisect.
+
+*But* the revertet commit is not the main culprit but causes a side
+effect as its included in the ubuntu-xenial 4.4 repo where it causes
+*no* problems with live migrations like this!
+
+Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
+---
+ arch/x86/kvm/x86.c | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
+index 2134f84..bf098ac 100644
+--- a/arch/x86/kvm/x86.c
++++ b/arch/x86/kvm/x86.c
+@@ -941,7 +941,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_TSC_AUX,
++	MSR_IA32_FEATURE_CONTROL, MSR_IA32_BNDCFGS
+ };
+ 
+ static unsigned num_msrs_to_save;
+@@ -4053,17 +4053,16 @@ 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.
++		 * 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.
+ 		 */
+ 		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;
+ 		}
+-- 
+2.1.4
+
diff --git a/Makefile b/Makefile
index e0a9ea6..2535f5d 100644
--- a/Makefile
+++ b/Makefile
@@ -238,6 +238,8 @@ ${KERNEL_SRC}/README ${KERNEL_CFG_ORG}: ${KERNELSRCTAR}
 	cd ${KERNEL_SRC}; patch -p1 <../override_for_missing_acs_capabilities.patch
 	#cd ${KERNEL_SRC}; patch -p1 <../vhost-net-extend-device-allocation-to-vmalloc.patch
 	cd ${KERNEL_SRC}; patch -p1 <../kvmstealtime.patch
+	# fix live migration freeze bug, should be fixed in 4.4
+	cd ${KERNEL_SRC}; patch -p1 <../0001-Revert-KVM-x86-expose-MSR_TSC_AUX-to-userspace.patch
 	# backport iSCSI fix from 4.4rc5
 	cd ${KERNEL_SRC}; patch -p1 <../iSCSI-block-sd-Fix-device-imposed-transfer-length-limits.patch
 	# backport aacraid update from kernel 4.4rc5
-- 
2.1.4





More information about the pve-devel mailing list