From: David Vrabel <david.vrabel@citrix.com>
To: xen-devel@lists.xensource.com
Cc: David Vrabel <david.vrabel@citrix.com>, Jan Beulich <jbeulich@suse.com>
Subject: [PATCH] x86: make the dom0_max_vcpus option more flexible
Date: Fri, 4 May 2012 17:01:41 +0100 [thread overview]
Message-ID: <1336147301-12681-1-git-send-email-david.vrabel@citrix.com> (raw)
From: David Vrabel <david.vrabel@citrix.com>
The dom0_max_vcpus command line option only allows the exact number of
VCPUs for dom0 to be set. It is not possible to say "up to N VCPUs
but no more than the number physically present."
Add min: and max: prefixes to the option to set a minimum number of
VCPUs, and a maximum which does not exceed the number of PCPUs.
For example, with "dom0_max_vcpus=min:4,max:8":
PCPUs Dom0 VCPUs
2 4
4 4
6 6
8 8
10 8
The existing behaviour of "dom0_max_vcpus=N" still works as before.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
docs/misc/xen-command-line.markdown | 29 +++++++++++++++++++++++++++--
xen/arch/x86/domain_build.c | 23 ++++++++++++++++++++++-
2 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
index a6195f2..5f0c2cd 100644
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -272,10 +272,35 @@ Specify the bit width of the DMA heap.
### dom0\_ioports\_disable
### dom0\_max\_vcpus
+
+Either:
+
> `= <integer>`
-Specify the maximum number of vcpus to give to dom0. This defaults
-to the number of pcpus on the host.
+The maximum number of VCPUs to give to dom0. This number of VCPUs can
+be more than the number of PCPUs on the host. The default is the
+number of PCPUs.
+
+Or:
+
+> `= List of ( min:<integer> | max:<integer> )`
+
+With the `min:` option dom0 will have at least this minimum number of
+VCPUs (default: 1). This may be more than the number of PCPUs on the
+host.
+
+With the `max:` option dom0 will have a VCPUs for each PCPUs but no
+more than this maximum number (default: unlimited).
+
+For example, with `dom0_max_vcpus=min:4,max:8`:
+
+ Number of
+ PCPUs | Dom0 VCPUs
+ 2 | 4
+ 4 | 4
+ 6 | 6
+ 8 | 8
+ 10 | 8
### dom0\_mem (ia64)
> `= <size>`
diff --git a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c
index b3c5d4c..5407f8d 100644
--- a/xen/arch/x86/domain_build.c
+++ b/xen/arch/x86/domain_build.c
@@ -83,7 +83,24 @@ static void __init parse_dom0_mem(const char *s)
custom_param("dom0_mem", parse_dom0_mem);
static unsigned int __initdata opt_dom0_max_vcpus;
-integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
+static unsigned int __initdata opt_dom0_max_vcpus_min = 1;
+static unsigned int __initdata opt_dom0_max_vcpus_max = UINT_MAX;
+
+static void __init parse_dom0_max_vcpus(const char *s)
+{
+ do {
+ if ( !strncmp(s, "min:", 4) )
+ opt_dom0_max_vcpus_min = simple_strtoul(s+4, &s, 0);
+ else if ( !strncmp(s, "max:", 4) )
+ opt_dom0_max_vcpus_max = simple_strtoul(s+4, &s, 0);
+ else
+ opt_dom0_max_vcpus = simple_strtoul(s, &s, 0);
+ if ( *s != ',' )
+ break;
+ } while ( *s++ == ',' );
+
+}
+custom_param("dom0_max_vcpus", parse_dom0_max_vcpus);
struct vcpu *__init alloc_dom0_vcpu0(void)
{
@@ -91,6 +108,10 @@ struct vcpu *__init alloc_dom0_vcpu0(void)
opt_dom0_max_vcpus = num_cpupool_cpus(cpupool0);
if ( opt_dom0_max_vcpus > MAX_VIRT_CPUS )
opt_dom0_max_vcpus = MAX_VIRT_CPUS;
+ if ( opt_dom0_max_vcpus_min > opt_dom0_max_vcpus )
+ opt_dom0_max_vcpus = opt_dom0_max_vcpus_min;
+ if ( opt_dom0_max_vcpus_max < opt_dom0_max_vcpus )
+ opt_dom0_max_vcpus = opt_dom0_max_vcpus_max;
dom0->vcpu = xzalloc_array(struct vcpu *, opt_dom0_max_vcpus);
if ( !dom0->vcpu )
--
1.7.2.5
next reply other threads:[~2012-05-04 16:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-04 16:01 David Vrabel [this message]
2012-05-04 16:12 ` [PATCH] x86: make the dom0_max_vcpus option more flexible Jan Beulich
2012-05-04 16:26 ` David Vrabel
2012-05-04 18:18 ` David Vrabel
2012-05-07 8:19 ` Jan Beulich
2012-05-08 13:58 ` David Vrabel
2012-05-07 6:42 ` Jan Beulich
-- strict thread matches above, loose matches on Subject: below --
2012-09-10 17:26 David Vrabel
2012-09-11 7:05 ` 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=1336147301-12681-1-git-send-email-david.vrabel@citrix.com \
--to=david.vrabel@citrix.com \
--cc=jbeulich@suse.com \
--cc=xen-devel@lists.xensource.com \
/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).