Received: from eggs.gnu.org ([2001:4830:134:3::10]:34638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJ3N3-0007TL-WE for qemu-devel@nongnu.org; Mon, 09 Sep 2013 11:27:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VJ3Mz-00056b-4c for qemu-devel@nongnu.org; Mon, 09 Sep 2013 11:27:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19739) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJ3My-00056T-S8 for qemu-devel@nongnu.org; Mon, 09 Sep 2013 11:27:17 -0400 Date: Mon, 9 Sep 2013 17:26:25 +0200 From: Igor Mammedov Message-ID: <20130909172625.33507a8a@nial.usersys.redhat.com> In-Reply-To: <522DDBA7.3010405@redhat.com> References: <1374596592-7027-1-git-send-email-imammedo@redhat.com> <1374596592-7027-3-git-send-email-imammedo@redhat.com> <51FC1794.7010406@suse.de> <20130909160654.7f76090f@nial.usersys.redhat.com> <522DDBA7.3010405@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 02/16] vl: set default ram_size during variable initialization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: vasilis.liaskovitis@profitbricks.com, hutao@cn.fujitsu.com, Andreas =?ISO-8859-1?B?RuRyYmVy?= , qemu-devel@nongnu.org On Mon, 09 Sep 2013 16:31:03 +0200 Paolo Bonzini wrote: > Il 09/09/2013 16:06, Igor Mammedov ha scritto: > > On Fri, 02 Aug 2013 22:33:24 +0200 > > Andreas F=E4rber wrote: > >=20 > >> Am 23.07.2013 18:22, schrieb Igor Mammedov: > >>> Signed-off-by: Igor Mammedov > >>> --- > >>> vl.c | 7 +------ > >>> 1 files changed, 1 insertions(+), 6 deletions(-) > >>> > >>> diff --git a/vl.c b/vl.c > >>> index 8190504..bf0c658 100644 > >>> --- a/vl.c > >>> +++ b/vl.c > >>> @@ -2947,7 +2947,7 @@ int main(int argc, char **argv, char **envp) > >>> module_call_init(MODULE_INIT_MACHINE); > >>> machine =3D find_default_machine(); > >>> cpu_model =3D NULL; > >>> - ram_size =3D 0; > >>> + ram_size =3D DEFAULT_RAM_SIZE * 1024 * 1024; > >>> snapshot =3D 0; > >>> cyls =3D heads =3D secs =3D 0; > >>> translation =3D BIOS_ATA_TRANSLATION_AUTO; > >>> @@ -4064,11 +4064,6 @@ int main(int argc, char **argv, char **envp) > >>> exit(1); > >>> } > >>> =20 > >>> - /* init the memory */ > >>> - if (ram_size =3D=3D 0) { > >>> - ram_size =3D DEFAULT_RAM_SIZE * 1024 * 1024; > >>> - } > >>> - > >>> if (qemu_opts_foreach(qemu_find_opts("device"), device_help_func= , NULL, 0) > >>> !=3D 0) { > >>> exit(0); > >> > >> Commit message doesn't give any explanation why? > > it was intended as cleanup > >=20 > >> > >> What happens with -m 0? My guess is the old code translates that to the > >> default size, where by intializing the default earlier it would stay. > > patch is broken in this aspect. It aborts on start up with -m 0 > >=20 > > The question is if -m 0 is correct value, perhaps QEMU should exit with > > error message in this case, instead of silent fallback to default? >=20 > I guess we have to keep it for backwards compatibility. I could swap this patch with 3/16 and add -m 0 compat logic there. Then it would be ok to move default to initialization time + cleanup. >=20 > Paolo >=20 >=20