From: Dario Faggioli <dario.faggioli@citrix.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH v2 3/5] xl: allow for node-wise specification of vcpu pinning
Date: Tue, 10 Sep 2013 19:42:03 +0200 [thread overview]
Message-ID: <1378834923.2821.53.camel@Solace> (raw)
In-Reply-To: <21034.1200.533286.543728@mariner.uk.xensource.com>
[-- Attachment #1.1: Type: text/plain, Size: 3323 bytes --]
On ven, 2013-09-06 at 17:37 +0100, Ian Jackson wrote:
> Dario Faggioli writes ("[PATCH v2 3/5] xl: allow for node-wise specification of vcpu pinning"):
> > Making it possible to use something like the following:
> > * "nodes:0-3": all pCPUs of nodes 0,1,2,3;
> > * "nodes:0-3,^node:2": all pCPUS of nodes 0,1,3;
> > * "1,nodes:1-2,^6": pCPU 1 plus all pCPUs of nodes 1,2
> > but not pCPU 6;
> > * ...
> ...
> > * code rearranged in order to look more simple to follow
> > and understand, as requested during review;
>
> This is much better now. Thank you!
>
Glad to hear that. :-)
> > +static int parse_range(const char *str, unsigned long *a, unsigned long *b)
> > {
> ...
> > + if (endptr == str)
> > + return EINVAL;
> > + if (*a == ULONG_MAX)
> > + return ERANGE;
>
> So parse_range returns errno value or 0. This isn't mentioned
> anywhere and is a bit unusual.
>
> > +static int update_cpumap_range(const char *str, libxl_bitmap *cpumap)
> > +{
> ...
> > + rc = libxl_node_bitmap_alloc(ctx, &node_cpumap, 0);
> > + if (rc) {
> > + fprintf(stderr, "libxl_node_bitmap_alloc failed.\n");
> > + return rc;
>
> So update_cpumap_range returns a libxl error code.
>
> > + rc = parse_range(str, &ida, &idb);
> > + if (rc) {
>
> But here you assign the errno value to an `rc' variable which holds a
> libxl error code. I think it would be better to make parse_range
> return a libxl rc value.
>
You're right, I cleaned up the code, but messed up quite a bit with the
error codes!
Thanks for pointing this out, I will put thing in a more consistent
state.
> I think also that parse_range doesn't notice if the specified range
> contains junk between the second number and the comma ?
>
Mmm... I will double check, although I'm not sure I'm getting you 100%,
since parse_range does not deal with comas... That are handled by
"strtok_r(cpu, ",", &saveptr)", which now is in vcpupin_parse().
> > +static int vcpupin_parse(char *cpu, libxl_bitmap *cpumap)
> > +{
> ...
> > + if (STR_HAS_PREFIX(ptr, "all") ||
> > + STR_HAS_PREFIX(ptr, "nodes:all")) {
> > + libxl_bitmap_set_any(cpumap);
>
> Why not deal with all in parse_range ? You'd avoid the second
> special-case of "nodes:", and constructions like
> all,^3
> would work.
>
Having it here already makes that ("all,^3") work, but it is true that
it'd simplify the if, and that it belongs more within parse_range() than
here. I'll move it.
> > -vcpp_out:
> > - libxl_bitmap_dispose(&exclude_cpumap);
> > + rc = update_cpumap_range(ptr, cpumap);
> > + if (rc) {
> > + /* If failing, reset the cpumap and exit */
> > + libxl_bitmap_set_none(cpumap);
>
> Surely the caller who gets a error should expect the cpumap to contain
> arbitrary contents ?
>
Fair enough.
BTW, any chance you could have a look at 4/5 and 5/5 as well, so that I
can repost?
Thanks and Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2013-09-10 17:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-06 15:55 [PATCH v2 0/5] xl: allow for node-wise specification of vcpu pinning Dario Faggioli
2013-09-06 15:55 ` [PATCH v2 1/5] xl: update the manpage about "cpus=" and NUMA node-affinity Dario Faggioli
2013-09-06 16:00 ` Ian Jackson
2013-09-06 15:55 ` [PATCH v2 2/5] libxl: introduce libxl_node_to_cpumap Dario Faggioli
2013-09-06 15:59 ` Ian Jackson
2013-09-06 15:55 ` [PATCH v2 3/5] xl: allow for node-wise specification of vcpu pinning Dario Faggioli
2013-09-06 16:37 ` Ian Jackson
2013-09-10 17:42 ` Dario Faggioli [this message]
2013-09-06 16:38 ` Ian Jackson
2013-09-10 17:38 ` Dario Faggioli
2013-09-06 15:55 ` [PATCH v2 4/5] xl: implement and enable dryrun mode for `xl vcpu-pin' Dario Faggioli
2013-09-08 22:28 ` Matt Wilson
2013-09-10 17:39 ` Dario Faggioli
2013-09-10 17:49 ` Ian Jackson
2013-09-06 15:56 ` [PATCH v2 5/5] xl: test script for the cpumap parser (for vCPU pinning) Dario Faggioli
2013-09-10 17:52 ` Ian Jackson
2013-09-11 8:31 ` Dario Faggioli
2013-09-11 10:49 ` Ian Jackson
2013-09-16 18:48 ` Dario Faggioli
2013-09-11 9:49 ` Ian Campbell
2013-09-16 18:50 ` Dario Faggioli
2013-09-06 16:12 ` [PATCH v2 0/5] xl: allow for node-wise specification of vcpu pinning 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=1378834923.2821.53.camel@Solace \
--to=dario.faggioli@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=ian.campbell@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 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).