[pve-devel] [PATCH kernel] migration: backport missing upstream patch not revert
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Feb 26 15:40:26 CET 2016
At first we reverted the patch which caused the issue with the
failing live migration.
A second "reverse" (i.e. switch good and bad) bisect of the ubuntu
xenial 4.4 kernel I found the patch that fixed this issue the right
way and backported it to the 4.2 upstream upbuntu will be again
notified.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
Sorry for shooting this patch that fast after the other out
but I did not thought that it was a much nastier side effect
and not that I find the upstream fix that fast.
Anyway, here it is.
Tested successfully with:
* Windows 7 VM
* Linux Mint Live ISO
...-host-initiated-access-to-guest-MSR_TSC_A.patch | 45 +++++++++++++++++
...t-KVM-x86-expose-MSR_TSC_AUX-to-userspace.patch | 59 ----------------------
Makefile | 2 +-
3 files changed, 46 insertions(+), 60 deletions(-)
create mode 100644 0001-KVM-VMX-Fix-host-initiated-access-to-guest-MSR_TSC_A.patch
delete mode 100644 0001-Revert-KVM-x86-expose-MSR_TSC_AUX-to-userspace.patch
diff --git a/0001-KVM-VMX-Fix-host-initiated-access-to-guest-MSR_TSC_A.patch b/0001-KVM-VMX-Fix-host-initiated-access-to-guest-MSR_TSC_A.patch
new file mode 100644
index 0000000..c5d872a
--- /dev/null
+++ b/0001-KVM-VMX-Fix-host-initiated-access-to-guest-MSR_TSC_A.patch
@@ -0,0 +1,45 @@
+From 81b1b9ca6d5ca5f3ce91c0095402def657cf5db3 Mon Sep 17 00:00:00 2001
+From: Haozhong Zhang <haozhong.zhang at intel.com>
+Date: Mon, 14 Dec 2015 23:13:38 +0800
+Subject: [PATCH] KVM: VMX: Fix host initiated access to guest MSR_TSC_AUX
+
+commit 81b1b9ca6d5ca5f3ce91c0095402def657cf5db3 upstream.
+
+The current handling of accesses to guest MSR_TSC_AUX returns error if
+vcpu does not support rdtscp, though those accesses are initiated by
+host. This can result in the reboot failure of some versions of
+QEMU. This patch fixes this issue by passing those host initiated
+accesses for further handling instead.
+
+Signed-off-by: Haozhong Zhang <haozhong.zhang at intel.com>
+Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
+Backported-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
+---
+ arch/x86/kvm/vmx.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
+index 6b56056..44976a5 100644
+--- a/arch/x86/kvm/vmx.c
++++ b/arch/x86/kvm/vmx.c
+@@ -2673,7 +2673,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
+ msr_info->data = vcpu->arch.ia32_xss;
+ break;
+ case MSR_TSC_AUX:
+- if (!to_vmx(vcpu)->rdtscp_enabled)
++ if (!to_vmx(vcpu)->rdtscp_enabled && !msr_info->host_initiated)
+ return 1;
+ /* Otherwise falls through */
+ default:
+@@ -2779,7 +2779,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
+ clear_atomic_switch_msr(vmx, MSR_IA32_XSS);
+ break;
+ case MSR_TSC_AUX:
+- if (!vmx->rdtscp_enabled)
++ if (!vmx->rdtscp_enabled && !msr_info->host_initiated)
+ return 1;
+ /* Check reserved bit, higher 32 bits should be zero */
+ if ((data >> 32) != 0)
+--
+2.1.4
+
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
deleted file mode 100644
index fbc94f9..0000000
--- a/0001-Revert-KVM-x86-expose-MSR_TSC_AUX-to-userspace.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-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 2535f5d..c465a48 100644
--- a/Makefile
+++ b/Makefile
@@ -239,7 +239,7 @@ ${KERNEL_SRC}/README ${KERNEL_CFG_ORG}: ${KERNELSRCTAR}
#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
+ cd ${KERNEL_SRC}; patch -p1 <../0001-KVM-VMX-Fix-host-initiated-access-to-guest-MSR_TSC_A.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