]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.14.13/kvm-s390-fix-cmma-migration-for-multiple-memory-slots.patch
Fix up backported ptrace patch
[thirdparty/kernel/stable-queue.git] / releases / 4.14.13 / kvm-s390-fix-cmma-migration-for-multiple-memory-slots.patch
CommitLineData
e5d76626
GKH
1From 32aa144fc32abfcbf7140f473dfbd94c5b9b4105 Mon Sep 17 00:00:00 2001
2From: Christian Borntraeger <borntraeger@de.ibm.com>
3Date: Fri, 15 Dec 2017 13:14:31 +0100
4Subject: KVM: s390: fix cmma migration for multiple memory slots
5
6From: Christian Borntraeger <borntraeger@de.ibm.com>
7
8commit 32aa144fc32abfcbf7140f473dfbd94c5b9b4105 upstream.
9
10When multiple memory slots are present the cmma migration code
11does not allocate enough memory for the bitmap. The memory slots
12are sorted in reverse order, so we must use gfn and size of
13slot[0] instead of the last one.
14
15Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
16Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
17Fixes: 190df4a212a7 (KVM: s390: CMMA tracking, ESSA emulation, migration mode)
18Reviewed-by: Cornelia Huck <cohuck@redhat.com>
19Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21---
22 arch/s390/kvm/kvm-s390.c | 9 +++++----
23 1 file changed, 5 insertions(+), 4 deletions(-)
24
25--- a/arch/s390/kvm/kvm-s390.c
26+++ b/arch/s390/kvm/kvm-s390.c
27@@ -794,11 +794,12 @@ static int kvm_s390_vm_start_migration(s
28
29 if (kvm->arch.use_cmma) {
30 /*
31- * Get the last slot. They should be sorted by base_gfn, so the
32- * last slot is also the one at the end of the address space.
33- * We have verified above that at least one slot is present.
34+ * Get the first slot. They are reverse sorted by base_gfn, so
35+ * the first slot is also the one at the end of the address
36+ * space. We have verified above that at least one slot is
37+ * present.
38 */
39- ms = slots->memslots + slots->used_slots - 1;
40+ ms = slots->memslots;
41 /* round up so we only use full longs */
42 ram_pages = roundup(ms->base_gfn + ms->npages, BITS_PER_LONG);
43 /* allocate enough bytes to store all the bits */