Blame SOURCES/kvm-s390x-storage-attributes-fix-CMMA_BLOCK_SIZE-usage.patch

ae23c9
From aaec9beefcdc4e8cbef669d0115f4405498400de Mon Sep 17 00:00:00 2001
ae23c9
From: Cornelia Huck <cohuck@redhat.com>
ae23c9
Date: Wed, 17 Apr 2019 13:57:21 +0100
ae23c9
Subject: [PATCH 04/24] s390x/storage attributes: fix CMMA_BLOCK_SIZE usage
ae23c9
ae23c9
RH-Author: Cornelia Huck <cohuck@redhat.com>
ae23c9
Message-id: <20190417135741.25297-5-cohuck@redhat.com>
ae23c9
Patchwork-id: 85786
ae23c9
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH v2 04/24] s390x/storage attributes: fix CMMA_BLOCK_SIZE usage
ae23c9
Bugzilla: 1699070
ae23c9
RH-Acked-by: David Hildenbrand <david@redhat.com>
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
ae23c9
ae23c9
From: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
ae23c9
ae23c9
The macro CMMA_BLOCK_SIZE was defined but not used, and a hardcoded
ae23c9
value was instead used in the code.
ae23c9
ae23c9
This patch fixes the value of CMMA_BLOCK_SIZE and uses it in the
ae23c9
appropriate place in the code, and fixes another case of hardcoded
ae23c9
value in the KVM backend, replacing it with the more appropriate
ae23c9
constant KVM_S390_CMMA_SIZE_MAX.
ae23c9
ae23c9
Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
ae23c9
Message-Id: <1530787170-3101-1-git-send-email-imbrenda@linux.vnet.ibm.com>
ae23c9
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
(cherry picked from commit 17f4566657df51c5e0cb40f30491e058d74d63c8)
ae23c9
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 hw/s390x/s390-stattrib-kvm.c | 3 ++-
ae23c9
 hw/s390x/s390-stattrib.c     | 5 +++--
ae23c9
 2 files changed, 5 insertions(+), 3 deletions(-)
ae23c9
ae23c9
diff --git a/hw/s390x/s390-stattrib-kvm.c b/hw/s390x/s390-stattrib-kvm.c
ae23c9
index 480551c..c7e1f35 100644
ae23c9
--- a/hw/s390x/s390-stattrib-kvm.c
ae23c9
+++ b/hw/s390x/s390-stattrib-kvm.c
ae23c9
@@ -105,7 +105,8 @@ static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)
ae23c9
     KVMS390StAttribState *sas = KVM_S390_STATTRIB(sa);
ae23c9
     MachineState *machine = MACHINE(qdev_get_machine());
ae23c9
     unsigned long max = machine->maxram_size / TARGET_PAGE_SIZE;
ae23c9
-    unsigned long cx, len = 1 << 19;
ae23c9
+    /* We do not need to reach the maximum buffer size allowed */
ae23c9
+    unsigned long cx, len = KVM_S390_SKEYS_MAX / 2;
ae23c9
     int r;
ae23c9
     struct kvm_s390_cmma_log clog = {
ae23c9
         .flags = 0,
ae23c9
diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
ae23c9
index 5161a16..766f201 100644
ae23c9
--- a/hw/s390x/s390-stattrib.c
ae23c9
+++ b/hw/s390x/s390-stattrib.c
ae23c9
@@ -21,7 +21,8 @@
ae23c9
 #include "qapi/error.h"
ae23c9
 #include "qapi/qmp/qdict.h"
ae23c9
 
ae23c9
-#define CMMA_BLOCK_SIZE  (1 * KiB)
ae23c9
+/* 512KiB cover 2GB of guest memory */
ae23c9
+#define CMMA_BLOCK_SIZE  (512 * KiB)
ae23c9
 
ae23c9
 #define STATTR_FLAG_EOS     0x01ULL
ae23c9
 #define STATTR_FLAG_MORE    0x02ULL
ae23c9
@@ -203,7 +204,7 @@ static int cmma_save(QEMUFile *f, void *opaque, int final)
ae23c9
     S390StAttribClass *sac = S390_STATTRIB_GET_CLASS(sas);
ae23c9
     uint8_t *buf;
ae23c9
     int r, cx, reallen = 0, ret = 0;
ae23c9
-    uint32_t buflen = 1 << 19;   /* 512kB cover 2GB of guest memory */
ae23c9
+    uint32_t buflen = CMMA_BLOCK_SIZE;
ae23c9
     uint64_t start_gfn = sas->migration_cur_gfn;
ae23c9
 
ae23c9
     buf = g_try_malloc(buflen);
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9