]> git.proxmox.com Git - pve-kernel-jessie.git/commitdiff
add KVM cherry-pick for Windows live-migration
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 24 Feb 2017 08:46:39 +0000 (09:46 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 1 Mar 2017 08:21:07 +0000 (09:21 +0100)
the following three cherry-picks from 4.6, first introduced
in Ubuntu-4.4.0-63.84 to fix LP#1649718 break Windows live
migration:

commit 296cb660d22c3732e08464f456d9336392b94c60
    kvm: x86: Check dest_map->vector to match eoi signals for rtc
    (cherry picked from commit 4d99ba898dd0c521ca6cdfdde55c9b58aea3cb3d)

commit f05aa1ca76109353c9421dfe1421d2fa42bd1605
    kvm: x86: Track irq vectors in ioapic->rtc_status.dest_map
    (cherry picked from commit 9daa50076f585854f0040aa8403eac020d6f5d64)

commit aee4b7a8ebc1496f55299241ba96590f80acdc19
    kvm: x86: Convert ioapic->rtc_status.dest_map to a struct
    (cherry picked from commit 9e4aabe2bb3454c83dac8139cf9974503ee044db)

cherry-pick a follow up commit from Linux 4.8, which fixes
the issue:

b0eaf4506f5f95d15d6731d72c0ddf4a2179eefa
    kvm: x86: correctly reset dest_map->vector when restoring LAPIC state

    When userspace sends KVM_SET_LAPIC, KVM schedules a check between
    the vCPU's IRR and ISR and the IOAPIC redirection table, in order
    to re-establish the IOAPIC's dest_map (the list of CPUs servicing
    the real-time clock interrupt with the corresponding vectors).

    However, __rtc_irq_eoi_tracking_restore_one was forgetting to
    set dest_map->vectors.  Because of this, the IOAPIC did not process
    the real-time clock interrupt EOI, ioapic->rtc_status.pending_eoi
    got stuck at a non-zero value, and further RTC interrupts were
    reported to userspace as coalesced.

Fixes: 9e4aabe2bb3454c83dac8139cf9974503ee044db
Fixes: 4d99ba898dd0c521ca6cdfdde55c9b58aea3cb3d
0001-kvm-x86-correctly-reset-dest_map-vector-when-restori.patch [new file with mode: 0644]
Makefile

diff --git a/0001-kvm-x86-correctly-reset-dest_map-vector-when-restori.patch b/0001-kvm-x86-correctly-reset-dest_map-vector-when-restori.patch
new file mode 100644 (file)
index 0000000..da9f4f8
--- /dev/null
@@ -0,0 +1,68 @@
+From b0eaf4506f5f95d15d6731d72c0ddf4a2179eefa Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <pbonzini@redhat.com>
+Date: Wed, 14 Sep 2016 23:39:12 +0200
+Subject: [PATCH] kvm: x86: correctly reset dest_map->vector when restoring
+ LAPIC state
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When userspace sends KVM_SET_LAPIC, KVM schedules a check between
+the vCPU's IRR and ISR and the IOAPIC redirection table, in order
+to re-establish the IOAPIC's dest_map (the list of CPUs servicing
+the real-time clock interrupt with the corresponding vectors).
+
+However, __rtc_irq_eoi_tracking_restore_one was forgetting to
+set dest_map->vectors.  Because of this, the IOAPIC did not process
+the real-time clock interrupt EOI, ioapic->rtc_status.pending_eoi
+got stuck at a non-zero value, and further RTC interrupts were
+reported to userspace as coalesced.
+
+Fixes: 9e4aabe2bb3454c83dac8139cf9974503ee044db
+Fixes: 4d99ba898dd0c521ca6cdfdde55c9b58aea3cb3d
+Cc: stable@vger.kernel.org
+Cc: Joerg Roedel <jroedel@suse.de>
+Cc: David Gilbert <dgilbert@redhat.com>
+Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
+---
+ arch/x86/kvm/ioapic.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c
+index 5f42d03..c7220ba 100644
+--- a/arch/x86/kvm/ioapic.c
++++ b/arch/x86/kvm/ioapic.c
+@@ -109,6 +109,7 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu)
+ {
+       bool new_val, old_val;
+       struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic;
++      struct dest_map *dest_map = &ioapic->rtc_status.dest_map;
+       union kvm_ioapic_redirect_entry *e;
+       e = &ioapic->redirtbl[RTC_GSI];
+@@ -117,16 +118,17 @@ static void __rtc_irq_eoi_tracking_restore_one(struct kvm_vcpu *vcpu)
+               return;
+       new_val = kvm_apic_pending_eoi(vcpu, e->fields.vector);
+-      old_val = test_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map);
++      old_val = test_bit(vcpu->vcpu_id, dest_map->map);
+       if (new_val == old_val)
+               return;
+       if (new_val) {
+-              __set_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map);
++              __set_bit(vcpu->vcpu_id, dest_map->map);
++              dest_map->vectors[vcpu->vcpu_id] = e->fields.vector;
+               ioapic->rtc_status.pending_eoi++;
+       } else {
+-              __clear_bit(vcpu->vcpu_id, ioapic->rtc_status.dest_map.map);
++              __clear_bit(vcpu->vcpu_id, dest_map->map);
+               ioapic->rtc_status.pending_eoi--;
+               rtc_status_pending_eoi_check_valid(ioapic);
+       }
+-- 
+2.1.4
+
index 7fa9bc25a646cb487b9ea852f0426462c6150f89..866db24aa81010474e38c6e5f42fa80c72286e65 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -265,6 +265,7 @@ ${KERNEL_SRC}/README ${KERNEL_CFG_ORG}: ${KERNELSRCTAR}
        # IPoIB performance regression fix
        cd ${KERNEL_SRC}; patch -p1 < ../IB-ipoib-move-back-the-IB-LL-address-into-the-hard-header.patch
        cd ${KERNEL_SRC}; patch -p1 < ../cgroup-cpuset-add-cpuset.remap_cpus.patch
+       cd ${KERNEL_SRC}; patch -p1 < ../0001-kvm-x86-correctly-reset-dest_map-vector-when-restori.patch
        cd ${KERNEL_SRC}; patch -p1 < ../CVE-2017-2596-kvm-page-reference-leakage-in-handle_vmon.patch
        cd ${KERNEL_SRC}; patch -p1 < ../CVE-2017-6074-dccp-fix-freeing-skb-too-early-for-IPV6_RECVPKTINFO.patch
        sed -i ${KERNEL_SRC}/Makefile -e 's/^EXTRAVERSION.*$$/EXTRAVERSION=${EXTRAVERSION}/'