* [Qemu-devel] [PATCH v3 1/1] s390x/storage attributes: fix CMMA_BLOCK_SIZE usage
@ 2018-07-05 10:39 Claudio Imbrenda
2018-07-05 17:00 ` Cornelia Huck
0 siblings, 1 reply; 2+ messages in thread
From: Claudio Imbrenda @ 2018-07-05 10:39 UTC (permalink / raw)
To: cohuck; +Cc: borntraeger, qemu-s390x, qemu-devel
The macro CMMA_BLOCK_SIZE was defined but not used, and a hardcoded
value was instead used in the code.
This patch fixes the value of CMMA_BLOCK_SIZE and uses it in the
appropriate place in the code, and fixes another case of hardcoded
value in the KVM backend, replacing it with the more appropriate
constant KVM_S390_CMMA_SIZE_MAX.
Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
---
hw/s390x/s390-stattrib-kvm.c | 3 ++-
hw/s390x/s390-stattrib.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/s390x/s390-stattrib-kvm.c b/hw/s390x/s390-stattrib-kvm.c
index 480551c..c7e1f35 100644
--- a/hw/s390x/s390-stattrib-kvm.c
+++ b/hw/s390x/s390-stattrib-kvm.c
@@ -105,7 +105,8 @@ static void kvm_s390_stattrib_synchronize(S390StAttribState *sa)
KVMS390StAttribState *sas = KVM_S390_STATTRIB(sa);
MachineState *machine = MACHINE(qdev_get_machine());
unsigned long max = machine->maxram_size / TARGET_PAGE_SIZE;
- unsigned long cx, len = 1 << 19;
+ /* We do not need to reach the maximum buffer size allowed */
+ unsigned long cx, len = KVM_S390_SKEYS_MAX / 2;
int r;
struct kvm_s390_cmma_log clog = {
.flags = 0,
diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
index 5161a16..766f201 100644
--- a/hw/s390x/s390-stattrib.c
+++ b/hw/s390x/s390-stattrib.c
@@ -21,7 +21,8 @@
#include "qapi/error.h"
#include "qapi/qmp/qdict.h"
-#define CMMA_BLOCK_SIZE (1 * KiB)
+/* 512KiB cover 2GB of guest memory */
+#define CMMA_BLOCK_SIZE (512 * KiB)
#define STATTR_FLAG_EOS 0x01ULL
#define STATTR_FLAG_MORE 0x02ULL
@@ -203,7 +204,7 @@ static int cmma_save(QEMUFile *f, void *opaque, int final)
S390StAttribClass *sac = S390_STATTRIB_GET_CLASS(sas);
uint8_t *buf;
int r, cx, reallen = 0, ret = 0;
- uint32_t buflen = 1 << 19; /* 512kB cover 2GB of guest memory */
+ uint32_t buflen = CMMA_BLOCK_SIZE;
uint64_t start_gfn = sas->migration_cur_gfn;
buf = g_try_malloc(buflen);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v3 1/1] s390x/storage attributes: fix CMMA_BLOCK_SIZE usage
2018-07-05 10:39 [Qemu-devel] [PATCH v3 1/1] s390x/storage attributes: fix CMMA_BLOCK_SIZE usage Claudio Imbrenda
@ 2018-07-05 17:00 ` Cornelia Huck
0 siblings, 0 replies; 2+ messages in thread
From: Cornelia Huck @ 2018-07-05 17:00 UTC (permalink / raw)
To: Claudio Imbrenda; +Cc: borntraeger, qemu-s390x, qemu-devel
On Thu, 5 Jul 2018 12:39:30 +0200
Claudio Imbrenda <imbrenda@linux.vnet.ibm.com> wrote:
> The macro CMMA_BLOCK_SIZE was defined but not used, and a hardcoded
> value was instead used in the code.
>
> This patch fixes the value of CMMA_BLOCK_SIZE and uses it in the
> appropriate place in the code, and fixes another case of hardcoded
> value in the KVM backend, replacing it with the more appropriate
> constant KVM_S390_CMMA_SIZE_MAX.
>
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>
> ---
> hw/s390x/s390-stattrib-kvm.c | 3 ++-
> hw/s390x/s390-stattrib.c | 5 +++--
> 2 files changed, 5 insertions(+), 3 deletions(-)
Thanks, applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-05 17:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-05 10:39 [Qemu-devel] [PATCH v3 1/1] s390x/storage attributes: fix CMMA_BLOCK_SIZE usage Claudio Imbrenda
2018-07-05 17:00 ` Cornelia Huck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.