From: George Dunlap <george.dunlap@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>, Wei Liu <wei.liu2@citrix.com>,
Ronald Rojas <ronladred@gmail.com>,
Dario Faggioli <dario.faggioli@citrix.com>,
George Dunlap <george.dunlap@citrix.com>,
Ian Jackson <ian.jackson@citrix.com>
Subject: [PATCH 2/2] tools/libxl: Introduce LIBXL_CPUPOOL_POOLID_ANY
Date: Wed, 8 Feb 2017 14:51:46 +0000 [thread overview]
Message-ID: <1486565506-8541-2-git-send-email-george.dunlap@citrix.com> (raw)
In-Reply-To: <1486565506-8541-1-git-send-email-george.dunlap@citrix.com>
Callers to libxl_cpupool_create() can either request a specific pool
id, or request that Xen do it for them. But at the moment, the
"automatic" selection is indicated by using a magic value, 0. This is
undesirable both because it doesn't obviously have meaning, but also
because '0' is a valid cpupool (albeit one which at the moment can't
be changed).
Introduce a constant, LIBXL_CPUPOOL_POOLID_ANY, to indicate this
instead. Still accept '0' as meaning "ANY" for backwards
compatibility.
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
---
CC: Ian Jackson <ian.jackson@citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Juergen Gross <jgross@suse.com>
CC: Dario Faggioli <dario.faggioli@citrix.com>
CC: Ronald Rojas <ronladred@gmail.com>
---
tools/libxl/libxl.c | 8 ++++++--
tools/libxl/libxl.h | 6 ++++++
tools/libxl/xl_cmdimpl.c | 2 +-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 51325d9..32e537a 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -6287,8 +6287,12 @@ int libxl_cpupool_create(libxl_ctx *ctx, const char *name,
char *uuid_string;
uint32_t xcpoolid;
- /* Zero means "choose a poolid for me" */
- xcpoolid = (*poolid) ? (*poolid) : XC_CPUPOOL_POOLID_ANY;
+ /* Accept '0' as 'any poolid' for backwards compatibility */
+ if ( *poolid == LIBXL_CPUPOOL_POOLID_ANY
+ || *poolid == 0 )
+ xcpoolid = XC_CPUPOOL_POOLID_ANY;
+ else
+ xcpoolid = *poolid;
uuid_string = libxl__uuid2string(gc, *uuid);
if (!uuid_string) {
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 3924464..d5559c0 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -2086,6 +2086,12 @@ int libxl_tmem_shared_auth(libxl_ctx *ctx, uint32_t domid, char* uuid,
int libxl_tmem_freeable(libxl_ctx *ctx);
int libxl_get_freecpus(libxl_ctx *ctx, libxl_bitmap *cpumap);
+
+/*
+ * Set poolid to LIBXL_CPUOOL_POOLID_ANY to have Xen choose a
+ * free poolid for you.
+ */
+#define LIBXL_CPUPOOL_POOLID_ANY 0xFFFFFFFF
int libxl_cpupool_create(libxl_ctx *ctx, const char *name,
libxl_scheduler sched,
libxl_bitmap cpumap, libxl_uuid *uuid,
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 358757f..80ddeac 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -8366,7 +8366,7 @@ int main_cpupoolcreate(int argc, char **argv)
printf("number of cpus: %d\n", n_cpus);
if (!dryrun_only) {
- poolid = 0;
+ poolid = LIBXL_CPUPOOL_POOLID_ANY;
if (libxl_cpupool_create(ctx, name, sched, cpumap, &uuid, &poolid)) {
fprintf(stderr, "error on creating cpupool\n");
goto out_cfg;
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-02-08 14:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 14:51 [PATCH 1/2] tools/libxc: Introduce XC_CPUPOOL_POOLID_ANY George Dunlap
2017-02-08 14:51 ` George Dunlap [this message]
2017-02-08 16:11 ` [PATCH 2/2] tools/libxl: Introduce LIBXL_CPUPOOL_POOLID_ANY Dario Faggioli
2017-02-08 16:17 ` George Dunlap
2017-02-09 10:35 ` Wei Liu
2017-02-09 11:17 ` George Dunlap
2017-02-09 11:24 ` Wei Liu
2017-02-09 11:35 ` George Dunlap
2017-02-14 10:29 ` Wei Liu
2017-02-14 12:23 ` George Dunlap
2017-02-08 16:03 ` [PATCH 1/2] tools/libxc: Introduce XC_CPUPOOL_POOLID_ANY Dario Faggioli
2017-02-09 10:36 ` Wei Liu
2017-02-14 16:57 ` Wei Liu
-- strict thread matches above, loose matches on Subject: below --
2017-02-15 17:08 George Dunlap
2017-02-15 17:08 ` [PATCH 2/2] tools/libxl: Introduce LIBXL_CPUPOOL_POOLID_ANY George Dunlap
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=1486565506-8541-2-git-send-email-george.dunlap@citrix.com \
--to=george.dunlap@citrix.com \
--cc=dario.faggioli@citrix.com \
--cc=ian.jackson@citrix.com \
--cc=jgross@suse.com \
--cc=ronladred@gmail.com \
--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).