From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4VMz-0001aY-T4 for qemu-devel@nongnu.org; Tue, 08 Jul 2014 09:23:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4VMu-0006sf-VA for qemu-devel@nongnu.org; Tue, 08 Jul 2014 09:23:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4VMu-0006sL-NX for qemu-devel@nongnu.org; Tue, 08 Jul 2014 09:23:36 -0400 Date: Tue, 8 Jul 2014 15:23:25 +0200 From: Igor Mammedov Message-ID: <20140708152325.789de1e8@igors-macbook-pro.local> In-Reply-To: <1404774322-5709-1-git-send-email-brogers@suse.com> References: <1404774322-5709-1-git-send-email-brogers@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] vl.c: Keep maxram_size and ram_size consistent unless specified otherwise List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bruce Rogers Cc: qemu-devel@nongnu.org, aliguori@amazon.com, mst@redhat.com On Mon, 7 Jul 2014 17:05:22 -0600 Bruce Rogers wrote: > When using a memory size less than the default amount with older pc > machine types, a failure occurs because of the way maxram_size and > ram_size get initialized. Keep maxram_size and ram_size the same, > except when maxmem is specified on the command line. > > Signed-off-by: Bruce Rogers > --- > vl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/vl.c b/vl.c > index 6e084c2..0cb8c10 100644 > --- a/vl.c > +++ b/vl.c > @@ -3345,7 +3345,6 @@ int main(int argc, char **argv, char **envp) > RAM_ADDR_FMT ")\n", slots, sz, > ram_size); exit(EXIT_FAILURE); > } > - maxram_size = sz; > ram_slots = slots; > } else if ((!maxmem_str && slots_str) || > (maxmem_str && !slots_str)) { > @@ -3353,6 +3352,7 @@ int main(int argc, char **argv, char **envp) > "'%s' option\n", slots_str ? "maxmem" : > "slots"); exit(EXIT_FAILURE); > } > + maxram_size = sz; Relying here on sz being either ram_size or maxmem is a bit fragile. It'd be better to set maxram_size to ram_size before parsing maxmem. I'll post alternative patch. > break; > } > #ifdef CONFIG_TPM