From: Dario Faggioli <dario.faggioli@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Juergen Gross <JGross@suse.com>, Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 7/9] xl: enable using ranges of pCPUs when creating cpupools
Date: Fri, 06 Mar 2015 18:21:51 +0100 [thread overview]
Message-ID: <20150306172150.7269.86101.stgit@Solace.station> (raw)
In-Reply-To: <20150306170758.7269.53821.stgit@Solace.station>
instead of just list of single pCPUs or NUMA node IDs, as
it happens right now.
On the other hand, after this change, strings containing
pCPUs and NUMA node ranges is supported. The syntax is the
same one supported by the "cpus" and "cpus_soft" config
switch, i.e., "4-8" or "node:1,12-18,^14".
This make things more flexible, more consistent, and also
improves error handling, as the pCPU range parsing routine
already present in xl is more reliable than just a call
to atoi().
While there, remove a redundant error check in the legacy syntax
handling (libxl_bitmap_test() already checks the index being
within the size of the bitmap).
Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Juergen Gross <JGross@suse.com>
---
docs/man/xlcpupool.cfg.pod.5 | 22 +++++++++++++++++++---
tools/libxl/xl_cmdimpl.c | 17 ++++++++++++++---
2 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/docs/man/xlcpupool.cfg.pod.5 b/docs/man/xlcpupool.cfg.pod.5
index bb15cbe..2ff8ee8 100644
--- a/docs/man/xlcpupool.cfg.pod.5
+++ b/docs/man/xlcpupool.cfg.pod.5
@@ -93,10 +93,26 @@ Specifies the cpus of the NUMA-nodes given in C<NODES> (an integer or
a list of integers) to be member of the cpupool. The free cpus in the
specified nodes are allocated in the new cpupool.
-=item B<cpus="CPUS">
+=item B<cpus="CPU-LIST">
-The specified C<CPUS> are allocated in the new cpupool. All cpus must
-be free. Must not be specified together with B<nodes>.
+Specifies the cpus that will be member of the cpupool. All the specified
+cpus must be free, or creation will fail. C<CPU-LIST> may be specified
+as follows:
+
+=over 4
+
+=item ["2", "3", "5"]
+
+means that cpus 2,3,5 will be member of the cpupool.
+
+=item "0-3,5,^1"
+
+means that cpus 0,2,3 and 5 will be member of the cpupool. A "node:" or
+"nodes:" modifier can be used. E.g., "0,node:1,nodes:2-3,^10-13" means
+that pcpus 0, plus all the cpus of NUMA nodes 1,2,3 with the exception
+of cpus 10,11,12,13 will be memeber of the cpupool.
+
+=back
If neither B<nodes> nor B<cpus> are specified only the first free cpu
found will be allocated in the new cpupool.
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index c748ba0..e6d1234 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -7163,18 +7163,29 @@ int main_cpupoolcreate(int argc, char **argv)
fprintf(stderr, "no free cpu found\n");
goto out_cfg;
}
- } else if (!xlu_cfg_get_list(config, "cpus", &cpus, 0, 0)) {
+ } else if (!xlu_cfg_get_list(config, "cpus", &cpus, 0, 1)) {
n_cpus = 0;
while ((buf = xlu_cfg_get_listitem(cpus, n_cpus)) != NULL) {
i = atoi(buf);
- if ((i < 0) || (i >= freemap.size * 8) ||
- !libxl_bitmap_test(&freemap, i)) {
+ if ((i < 0) || !libxl_bitmap_test(&freemap, i)) {
fprintf(stderr, "cpu %d illegal or not free\n", i);
goto out_cfg;
}
libxl_bitmap_set(&cpumap, i);
n_cpus++;
}
+ } else if (!xlu_cfg_get_string(config, "cpus", &buf, 0)) {
+ if (cpurange_parse(buf, &cpumap))
+ goto out_cfg;
+
+ n_cpus = 0;
+ libxl_for_each_set_bit(i, cpumap) {
+ if (!libxl_bitmap_test(&freemap, i)) {
+ fprintf(stderr, "cpu %d illegal or not free\n", i);
+ goto out_cfg;
+ }
+ n_cpus++;
+ }
} else
n_cpus = 0;
next prev parent reply other threads:[~2015-03-06 17:21 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-06 17:20 [PATCH 0/9] Some (not only) cpupool related fixes and improvements Dario Faggioli
2015-03-06 17:20 ` [PATCH 1/9] docs: RTDS is a valid alternative as a scheduler for a cpupool Dario Faggioli
2015-03-06 19:16 ` Meng Xu
2015-03-09 10:20 ` Wei Liu
2015-03-06 17:21 ` [PATCH 2/9] docs: fix `xl list' manpage entry Dario Faggioli
2015-03-09 10:21 ` Wei Liu
2015-03-06 17:21 ` [PATCH 3/9] xl: turn some int local variable into bool Dario Faggioli
2015-03-09 10:24 ` Wei Liu
2015-03-06 17:21 ` [PATCH 4/9] xl: add -c/--cpupool option to `xl list' Dario Faggioli
2015-03-09 10:27 ` Wei Liu
2015-03-06 17:21 ` [PATCH 5/9] libxl: introduce libxl_cpupool_cpu{add, remove}_cpumap() Dario Faggioli
2015-03-09 10:39 ` Wei Liu
2015-03-09 11:31 ` Dario Faggioli
2015-03-09 11:47 ` Wei Liu
2015-03-11 16:42 ` Ian Campbell
2015-03-11 16:50 ` Dario Faggioli
2015-03-11 16:57 ` Ian Campbell
2015-03-06 17:21 ` [PATCH 6/9] xl: enable using ranges of pCPUs when manipulating cpupools Dario Faggioli
2015-03-09 10:51 ` Wei Liu
2015-03-09 11:37 ` Dario Faggioli
2015-03-06 17:21 ` Dario Faggioli [this message]
2015-03-09 10:58 ` [PATCH 7/9] xl: enable using ranges of pCPUs when creating cpupools Wei Liu
2015-03-09 11:18 ` Dario Faggioli
2015-03-09 11:20 ` Wei Liu
2015-03-06 17:21 ` [PATCH 8/9] xl: make error reporting of cpupool subcommands consistent Dario Faggioli
2015-03-09 11:01 ` Wei Liu
2015-03-09 11:23 ` Dario Faggioli
2015-03-11 14:52 ` Ian Campbell
2015-03-11 15:04 ` Wei Liu
2015-03-11 15:13 ` Dario Faggioli
2015-03-11 15:23 ` Wei Liu
2015-03-11 16:22 ` Dario Faggioli
2015-03-11 16:24 ` Wei Liu
2015-03-11 16:28 ` Dario Faggioli
2015-03-11 15:14 ` Ian Campbell
2015-03-06 17:22 ` [PATCH 9/9] xl: use libxl_cpupoolinfo_list_free() in main_cpupoolnumasplit Dario Faggioli
2015-03-09 11:02 ` Wei Liu
2015-03-11 14:54 ` Ian Campbell
2015-03-11 14:56 ` [PATCH 0/9] Some (not only) cpupool related fixes and improvements Ian Campbell
2015-03-11 15:09 ` Dario Faggioli
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=20150306172150.7269.86101.stgit@Solace.station \
--to=dario.faggioli@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JGross@suse.com \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.