xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: "Juergen Gross" <jgross@suse.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Wei Liu" <wei.liu2@citrix.com>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
	"George Dunlap" <George.Dunlap@eu.citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Ian Jackson" <ian.jackson@eu.citrix.com>,
	"Tim Deegan" <tim@xen.org>, "Julien Grall" <julien.grall@arm.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH v2 3/3] xen: add CONFIG item for default dom0 memory size
Date: Thu,  6 Dec 2018 09:06:39 +0100	[thread overview]
Message-ID: <20181206080639.32603-4-jgross@suse.com> (raw)
In-Reply-To: <20181206080639.32603-1-jgross@suse.com>

With being able to specify a dom0_mem value depending on host memory
size on x86 make it easy for distros to specify a default dom0 size by
adding a CONFIG_DOM0_MEM item which presets the dom0_mem boot parameter
value.

It will be used only if no dom0_mem parameter was specified in the
boot parameters.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/arch/arm/domain_build.c |  7 +++++++
 xen/arch/x86/dom0_build.c   |  6 ++++++
 xen/common/Kconfig          | 13 +++++++++++++
 3 files changed, 26 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index b0ec3f0b72..d2c63a89ca 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -32,9 +32,12 @@ static unsigned int __initdata opt_dom0_max_vcpus;
 integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
 
 static u64 __initdata dom0_mem;
+static bool __initdata dom0_mem_set;
 
 static int __init parse_dom0_mem(const char *s)
 {
+    dom0_mem_set = true;
+
     dom0_mem = parse_size_and_unit(s, &s);
 
     return *s ? -EINVAL : 0;
@@ -2114,6 +2117,10 @@ int __init construct_dom0(struct domain *d)
     BUG_ON(d->domain_id != 0);
 
     printk("*** LOADING DOMAIN 0 ***\n");
+
+    if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] )
+        parse_dom0_mem(CONFIG_DOM0_MEM);
+
     if ( dom0_mem <= 0 )
     {
         warning_add("PLEASE SPECIFY dom0_mem PARAMETER - USING 512M FOR NOW\n");
diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
index 8de71346db..71b670275b 100644
--- a/xen/arch/x86/dom0_build.c
+++ b/xen/arch/x86/dom0_build.c
@@ -29,6 +29,7 @@ struct memsize {
 static struct memsize __initdata dom0_size;
 static struct memsize __initdata dom0_min_size;
 static struct memsize __initdata dom0_max_size = { .nr_pages = LONG_MAX };
+static bool __initdata dom0_mem_set;
 
 static bool __init memsize_gt_zero(const struct memsize *sz)
 {
@@ -111,6 +112,8 @@ static int __init parse_dom0_mem(const char *s)
 {
     int ret;
 
+    dom0_mem_set = true;
+
     /* xen-shim uses shim_mem parameter instead of dom0_mem */
     if ( pv_shim )
     {
@@ -333,6 +336,9 @@ unsigned long __init dom0_compute_nr_pages(
     unsigned long avail = 0, nr_pages, min_pages, max_pages;
     bool need_paging;
 
+    if ( !dom0_mem_set && CONFIG_DOM0_MEM[0] )
+        parse_dom0_mem(CONFIG_DOM0_MEM);
+
     for_each_node_mask ( node, dom0_nodes )
         avail += avail_domheap_pages_region(node, 0, 0) +
                  initial_images_nrpages(node);
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 68132a3a10..155a9a45e8 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -323,4 +323,17 @@ config CMDLINE_OVERRIDE
 
 	  This is used to work around broken bootloaders. This should
 	  be set to 'N' under normal conditions.
+
+config DOM0_MEM
+	string "Default value for dom0_mem boot parameter"
+	default ""
+	---help---
+	  Sets a default value for dom0_mem, e.g. "512M".
+	  The specified string will be used for the dom0_mem parameter in
+	  case it was not specified on the command line.
+
+	  See docs/misc/xen-command-line.markdown for the supported syntax.
+
+	  Leave empty if you are not sure what to specify.
+	
 endmenu
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2018-12-06  8:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06  8:06 [PATCH v2 0/3] xen/x86: support setting dom0_mem depending on host size Juergen Gross
2018-12-06  8:06 ` [PATCH v2 1/3] xen: introduce parse_size_and_unit_or_int Juergen Gross
2018-12-06  9:50   ` Jan Beulich
     [not found]   ` <5C08F0CE0200007800203751@suse.com>
2018-12-06 10:01     ` Juergen Gross
2018-12-06 10:15       ` Jan Beulich
2018-12-06  8:06 ` [PATCH v2 2/3] xen/x86: add dom0 memory sizing variants Juergen Gross
2018-12-06 11:08   ` Jan Beulich
     [not found]   ` <5C09031502000078002039F0@suse.com>
2018-12-06 11:20     ` Juergen Gross
2018-12-06 11:28       ` Jan Beulich
2018-12-06  8:06 ` Juergen Gross [this message]
2018-12-06 11:09   ` [PATCH v2 3/3] xen: add CONFIG item for default dom0 memory size Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181206080639.32603-4-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).