From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vsx32-0004RK-Js for qemu-devel@nongnu.org; Tue, 17 Dec 2013 10:59:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vsx2t-0003pI-MS for qemu-devel@nongnu.org; Tue, 17 Dec 2013 10:59:04 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:55912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vsx2t-0003pB-FM for qemu-devel@nongnu.org; Tue, 17 Dec 2013 10:58:55 -0500 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Dec 2013 08:58:54 -0700 Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id EEC481FF0027 for ; Tue, 17 Dec 2013 08:58:27 -0700 (MST) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by b03cxnp08027.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rBHFwo3I2294114 for ; Tue, 17 Dec 2013 16:58:50 +0100 Received: from d03av03.boulder.ibm.com (localhost [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rBHFwpSW010824 for ; Tue, 17 Dec 2013 08:58:51 -0700 Message-ID: <52B074BA.2030207@linux.vnet.ibm.com> Date: Tue, 17 Dec 2013 10:58:50 -0500 From: Matthew Rosato MIME-Version: 1.0 References: <1387227072-21965-1-git-send-email-mjrosato@linux.vnet.ibm.com> <1387227072-21965-4-git-send-email-mjrosato@linux.vnet.ibm.com> <7634A04F-3B79-4279-BAB9-6F8E773197E8@suse.de> In-Reply-To: <7634A04F-3B79-4279-BAB9-6F8E773197E8@suse.de> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/5] target-s390: Check for standby memory specification List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Gleb Natapov , QEMU Developers , Christian Borntraeger , aliguori@amazon.com, Cornelia Huck , Paolo Bonzini , Richard Henderson On 12/16/2013 04:25 PM, Alexander Graf wrote: > > On 16.12.2013, at 21:51, Matthew Rosato wrote: > >> When machine=...,standby-mem={size} has been specified, convert the value >> to bytes and store it for use. >> >> Signed-off-by: Matthew Rosato >> --- >> target-s390x/kvm.c | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c >> index 02ac4ba..d4081f4 100644 >> --- a/target-s390x/kvm.c >> +++ b/target-s390x/kvm.c >> @@ -97,11 +97,27 @@ static void *legacy_s390_alloc(size_t size); >> >> int kvm_arch_init(KVMState *s) >> { >> + int64_t value; >> + >> cap_sync_regs = kvm_check_extension(s, KVM_CAP_SYNC_REGS); >> if (!kvm_check_extension(s, KVM_CAP_S390_GMAP) >> || !kvm_check_extension(s, KVM_CAP_S390_COW)) { >> phys_mem_set_alloc(legacy_s390_alloc); >> } >> + >> + value = qemu_opt_get_size(qemu_get_machine_opts(), "standby-mem", -1); >> + >> + if (value < 0) { >> + fprintf(stderr, "qemu: invalid standby-mem size:%"PRId64"\n", value); >> + exit(1); >> + } >> + >> + if (value != (int64_t)(ram_addr_t)value) { >> + fprintf(stderr, "qemu: standby size too large\n"); >> + exit(1); >> + } >> + standby_mem_size = value * 1024 * 1024; > > I would hope qemu_opt_get_size() returns a value in bytes. Why multiply it here? > It's actually in megabytes, and this is converting to bytes -- Based on your comment, it sounds like qemu_opt_get_size should always be returning a byte value. FWIW, if I adopt Paolo's comments re: patch 1, this behavior goes away (and the parsing moves out of s390). Either way, I'll adjust for v2. > > Alex > > > >