From patchwork Thu Jun 23 14:57:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 9195411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 962456075F for ; Thu, 23 Jun 2016 15:00:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85A6527B13 for ; Thu, 23 Jun 2016 15:00:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 799AA2845C; Thu, 23 Jun 2016 15:00:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DA00127B13 for ; Thu, 23 Jun 2016 15:00:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG64y-0006KX-5X; Thu, 23 Jun 2016 14:58:04 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bG64w-0006KH-NN for xen-devel@lists.xen.org; Thu, 23 Jun 2016 14:58:02 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 0F/28-22092-9F8FB675; Thu, 23 Jun 2016 14:58:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGIsWRWlGSWpSXmKPExsVysWW7jO6PH9n hBkd75CyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oxnp/6wFZxVrTj8sJmxgXGbShcjF4eQwG4m ia2nNzFBOBcYJTo7Whm7GDmBnDKJVa9vM4HYvAJGErNvv2UBsYUFHCQmrtjABmKzCahLnJl9m BXEFhHQk2hZNZEVZBCzwDSgQdv+gjWzCKhKrJ46GWwop4CNxPQl/cwQC6wl+h99ARvKDDT0yI fvQEM5gJYJSvzdIQwSlhDQlvj4/RgjyEwJgT5GiXd/l7FOYOSfhaRlFkILRFhTonX7b3YIW1t i2cLXzBB2kMTHq5PZIOxoida9/awQtqLElO6H7AsY2VcxqhenFpWlFuka6iUVZaZnlOQmZubo GhqY6eWmFhcnpqfmJCYV6yXn525iBIY5AxDsYNz53OkQoyQHk5IoL+Pm7HAhvqT8lMqMxOKM+ KLSnNTiQ4wyHBxKErz7vgPlBItS01Mr0jJzgBEHk5bg4FES4W0ASfMWFyTmFmemQ6ROMepyHH t5ey2TEEtefl6qlDhvLUiRAEhRRmke3AhY9F9ilJUS5mUEOkqIpyC1KDezBFX+FaM4B6OSMG8 qyBSezLwSuE2vgI5gAjribj/YESWJCCmpBsaC2dI3yzV+c9zsWLyMp8hivemL41PlEu76vT8V p+g329Lv2RKeb0JB77Uc9S7+tDUXzspl0C57ftJCuvzV1MhzUeeS5xR9Y3CeNUP37bnjxvnS9 5i2Htnyi/f+vmmb9D4u9vnGPVuTZYHKEoXUy4vc5GZaPNvWEaD9I8NG5HzPG4mPu/1Oee1UYi nOSDTUYi4qTgQAS52Dl/kCAAA= X-Env-Sender: kraxel@redhat.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1466693879!19969137!1 X-Originating-IP: [209.132.183.28] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjA5LjEzMi4xODMuMjggPT4gNTQwNjQ=\n X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40048 invoked from network); 23 Jun 2016 14:58:00 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by server-3.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 23 Jun 2016 14:58:00 -0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9EC9D7F6A8; Thu, 23 Jun 2016 14:57:58 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5NEvvDu016489; Thu, 23 Jun 2016 10:57:57 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 633ED8024E; Thu, 23 Jun 2016 16:57:54 +0200 (CEST) Message-ID: <1466693874.26189.50.camel@redhat.com> From: Gerd Hoffmann To: Anthony PERARD Date: Thu, 23 Jun 2016 16:57:54 +0200 In-Reply-To: <20160622150937.GS5666@perard.uk.xensource.com> References: <20160622150937.GS5666@perard.uk.xensource.com> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 23 Jun 2016 14:57:58 +0000 (UTC) Cc: Paolo Bonzini , Stefano Stabellini , qemu-devel@nongnu.org, xen-devel@lists.xen.org Subject: Re: [Xen-devel] Change of max-ram-below-4g initial value breaks Xen X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi, > How could xen_ram_init() find out if the value of max-ram-below-4g is > the default or if a user have set it? Is there another way we could fix > this? Attached patch should fix it. Patch survived a quick smoke test on kvm so far, need to do some more testing tomorrow. Can you give it a spin on xen? thanks, Gerd From d45a95861def18a02e1c26d3717693432517107a Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 23 Jun 2016 16:49:03 +0200 Subject: [PATCH] xen: fix ram init regression Commit "8156d48 pc: allow raising low memory via max-ram-below-4g option" causes a regression on xen, because it uses a different memory split. This patch initializes max-ram-below-4g to zero and leaves the initialization to the memory initialization functions. That way they can pick different default values (max-ram-below-4g is zero still) or use the user supplied value (max-ram-below-4g is non-zero). Signed-off-by: Gerd Hoffmann --- hw/i386/pc.c | 2 +- hw/i386/pc_piix.c | 3 +++ hw/i386/pc_q35.c | 3 +++ xen-hvm.c | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 7198ed5..66e1dae 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1886,7 +1886,7 @@ static void pc_machine_initfn(Object *obj) pc_machine_get_hotplug_memory_region_size, NULL, NULL, NULL, &error_abort); - pcms->max_ram_below_4g = 0xe0000000; /* 3.5G */ + pcms->max_ram_below_4g = 0; /* use default */ object_property_add(obj, PC_MACHINE_MAX_RAM_BELOW_4G, "size", pc_machine_get_max_ram_below_4g, pc_machine_set_max_ram_below_4g, diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 53bc968..78e3d44 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -114,6 +114,9 @@ static void pc_init1(MachineState *machine, * qemu -M pc,max-ram-below-4g=2G -m 4G -> 2048M low, 2048M high * qemu -M pc,max-ram-below-4g=4G -m 3968M -> 3968M low (=4G-128M) */ + if (!pcms->max_ram_below_4g) { + pcms->max_ram_below_4g = 0xe0000000; /* default: 3.5G */ + } lowmem = pcms->max_ram_below_4g; if (machine->ram_size >= pcms->max_ram_below_4g) { if (pcmc->gigabyte_align) { diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index e4b541f..1b653e2 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -93,6 +93,9 @@ static void pc_q35_init(MachineState *machine) /* Handle the machine opt max-ram-below-4g. It is basically doing * min(qemu limit, user limit). */ + if (!pcms->max_ram_below_4g) { + pcms->max_ram_below_4g = 1ULL << 32; /* default: 4G */; + } if (lowmem > pcms->max_ram_below_4g) { lowmem = pcms->max_ram_below_4g; if (machine->ram_size - lowmem > lowmem && diff --git a/xen-hvm.c b/xen-hvm.c index 98ea44f..eb57792 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -190,6 +190,9 @@ static void xen_ram_init(PCMachineState *pcms, /* Handle the machine opt max-ram-below-4g. It is basically doing * min(xen limit, user limit). */ + if (!user_lowmem) { + user_lowmem = HVM_BELOW_4G_RAM_END; /* default */ + } if (HVM_BELOW_4G_RAM_END <= user_lowmem) { user_lowmem = HVM_BELOW_4G_RAM_END; } -- 1.8.3.1