From nobody Wed Nov 5 00:13:26 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531388084656166.83984714841029; Thu, 12 Jul 2018 02:34:44 -0700 (PDT) Received: from localhost ([::1]:58295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdXzi-0001Sm-Nx for importer@patchew.org; Thu, 12 Jul 2018 05:34:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdXyK-0000oT-EN for qemu-devel@nongnu.org; Thu, 12 Jul 2018 05:33:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdXyJ-0000hq-HK for qemu-devel@nongnu.org; Thu, 12 Jul 2018 05:33:12 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59868 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fdXyJ-0000hS-Cs; Thu, 12 Jul 2018 05:33:11 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB789818BAFC; Thu, 12 Jul 2018 09:33:10 +0000 (UTC) Received: from localhost (dhcp-192-215.str.redhat.com [10.33.192.215]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3AA0A111AF0E; Thu, 12 Jul 2018 09:33:08 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Date: Thu, 12 Jul 2018 11:33:00 +0200 Message-Id: <20180712093301.9343-2-cohuck@redhat.com> In-Reply-To: <20180712093301.9343-1-cohuck@redhat.com> References: <20180712093301.9343-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 12 Jul 2018 09:33:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 12 Jul 2018 09:33:10 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL for-3.0 1/2] s390x/storage attributes: fix CMMA_BLOCK_SIZE usage X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , qemu-devel@nongnu.org, Christian Borntraeger , qemu-s390x@nongnu.org, Claudio Imbrenda , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Claudio Imbrenda 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 Message-Id: <1530787170-3101-1-git-send-email-imbrenda@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck --- 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 480551c3db..c7e1f35524 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(S390StAttribS= tate *sa) KVMS390StAttribState *sas =3D KVM_S390_STATTRIB(sa); MachineState *machine =3D MACHINE(qdev_get_machine()); unsigned long max =3D machine->maxram_size / TARGET_PAGE_SIZE; - unsigned long cx, len =3D 1 << 19; + /* We do not need to reach the maximum buffer size allowed */ + unsigned long cx, len =3D KVM_S390_SKEYS_MAX / 2; int r; struct kvm_s390_cmma_log clog =3D { .flags =3D 0, diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index 5161a1659b..766f2015a4 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" =20 -#define CMMA_BLOCK_SIZE (1 * KiB) +/* 512KiB cover 2GB of guest memory */ +#define CMMA_BLOCK_SIZE (512 * KiB) =20 #define STATTR_FLAG_EOS 0x01ULL #define STATTR_FLAG_MORE 0x02ULL @@ -203,7 +204,7 @@ static int cmma_save(QEMUFile *f, void *opaque, int fin= al) S390StAttribClass *sac =3D S390_STATTRIB_GET_CLASS(sas); uint8_t *buf; int r, cx, reallen =3D 0, ret =3D 0; - uint32_t buflen =3D 1 << 19; /* 512kB cover 2GB of guest memory */ + uint32_t buflen =3D CMMA_BLOCK_SIZE; uint64_t start_gfn =3D sas->migration_cur_gfn; =20 buf =3D g_try_malloc(buflen); --=20 2.14.4