From: Dario Faggioli <dario.faggioli@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: KeirFraser <keir@xen.org>,
George Dunlap <george.dunlap@eu.citrix.com>,
AndrewCooper <Andrew.Cooper3@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v6 7/9] xl: enable getting and setting soft
Date: Wed, 28 May 2014 17:01:25 +0100 [thread overview]
Message-ID: <1401292885.7504.48.camel@Abyss> (raw)
In-Reply-To: <1401291227.10916.38.camel@kazak.uk.xensource.com>
[-- Attachment #1.1: Type: text/plain, Size: 3449 bytes --]
On Wed, 2014-05-28 at 16:33 +0100, Ian Campbell wrote:
> On Wed, 2014-05-28 at 01:42 +0100, Dario Faggioli wrote:
> > @@ -4653,17 +4656,32 @@ int main_vcpulist(int argc, char **argv)
> > return 0;
> > }
> >
> > -static int vcpupin(uint32_t domid, const char *vcpu, char *cpu)
> > +int main_vcpupin(int argc, char **argv)
> > {
> > libxl_vcpuinfo *vcpuinfo;
> > - libxl_bitmap cpumap;
> > -
> > - uint32_t vcpuid;
> > + libxl_bitmap cpumap, cpumap_soft;;
> > + uint32_t vcpuid, domid;
> > + const char *vcpu;
> > char *endptr;
> > - int i, nb_cpu, nb_vcpu, rc = -1;
> > + int opt, nb_cpu, nb_vcpu, rc = -1;
> > + libxl_bitmap *soft = &cpumap_soft, *hard = &cpumap;
> > + static struct option opts[] = {
> > + {"soft", 0, 0, 's'},
>
> I think this is a remnant of a previous iteration?
>
Gah! Sorry for this. I looked at the whole series looking for remnant a
few times, but I guess it's true that we're blind wrt our own code!
> > - if (vcpupin_parse(cpu, &cpumap))
> > + /*
> > + * Syntax is: xl vcpu-pin <domid> <vcpu> <hard> <soft>
> > + * We want to handle all the following cases ('-' means
> > + * "leave it alone"):
> > + * xl vcpu-pin 0 3 3,4
> > + * xl vcpu-pin 0 3 3,4 -
> > + * xl vcpu-pin 0 3 - 6-9
> > + * xl vcpu-pin 0 3 3,4 6-9
> > + */
> > + if (argc <= 4 || (argc == 5 && !strcmp(argv[optind+3], "-")))
>
> You are mixing raw argc values and offsets from optind here, which is a
> bit confusing.
>
> It would be valid to do
> argc -= optind;
> argv += optind;
> optind = 0;
> and then use argv[0] ...[1] etc.
>
I agree it's confusing, and I like this solution above, I'll go for it.
> > + soft = NULL;
> > + if (argc == 5 && !strcmp(argv[optind+2], "-"))
> > + hard = NULL;
> > +
> > + if (hard && vcpupin_parse(argv[optind+2], &cpumap))
> > + goto out;
> > + if (soft && vcpupin_parse(argv[optind+3], &cpumap_soft))
> > goto out;
>
> You've just parsed argv[option+2] and [...+3] into hard and soft
> respectively.
>
> Might some of this be simplified by making vcpupin_parse accept NULL
> and/or making it handle "-"? e.g.
> hard = argv[opting+2]
> soft = argc > XXX > argc[optind+3] : NULL
> vcpupin_parse(&hard, &cpumap);
> vcpupin_parse(&soft, &cpumap);
>
> (sets hard/soft == NULL on input of "-", returns silently on hard/soft
> == NULL.
>
I think this will make it simpler. I'll give it a try.
> > diff --git a/tools/libxl/xl_cmdtable.c b/tools/libxl/xl_cmdtable.c
> > index 4279b9f..d03c52a 100644
> > --- a/tools/libxl/xl_cmdtable.c
> > +++ b/tools/libxl/xl_cmdtable.c
> > @@ -218,7 +218,7 @@ struct cmd_spec cmd_table[] = {
> > { "vcpu-pin",
> > &main_vcpupin, 1, 1,
> > "Set which CPUs a VCPU can use",
> > - "<Domain> <VCPU|all> <CPUs|all>",
> > + "<Domain> <VCPU|all> <Hard affinity|all> <Soft affinity|all",
>
> Missing a closing >
>
Ok.
> Also, I think "-" is a valid alternative now, right?
>
Yes it is.
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:[~2014-05-28 16:01 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-28 0:42 [PATCH v6 0/9] Implement vcpu soft affinity for credit1 Dario Faggioli
2014-05-28 0:42 ` [PATCH v6 1/9] xen: sched: rename v->cpu_affinity into v->cpu_hard_affinity Dario Faggioli
2014-05-28 7:28 ` Jan Beulich
2014-05-28 0:42 ` [PATCH v6 2/9] xen: sched: introduce soft-affinity and use it instead d->node-affinity Dario Faggioli
2014-05-28 7:33 ` Jan Beulich
2014-05-28 15:50 ` Dario Faggioli
2014-06-02 14:40 ` George Dunlap
2014-05-28 0:42 ` [PATCH v6 3/9] xen: derive NUMA node affinity from hard and soft CPU affinity Dario Faggioli
2014-05-28 7:36 ` Jan Beulich
2014-05-28 0:42 ` [PATCH v6 4/9] xen/libxc: sched: DOMCTL_*vcpuaffinity works with hard and soft affinity Dario Faggioli
2014-05-28 7:40 ` Jan Beulich
2014-05-28 15:09 ` Ian Campbell
2014-05-28 0:42 ` [PATCH v6 5/9] libxc: get and set soft and hard affinity Dario Faggioli
2014-05-28 0:42 ` [PATCH v6 6/9] libxl: get and set soft affinity Dario Faggioli
2014-05-28 15:13 ` Ian Campbell
2014-05-28 15:15 ` Dario Faggioli
2014-05-28 15:23 ` Ian Campbell
2014-06-05 12:59 ` Dario Faggioli
2014-06-06 8:46 ` Ian Campbell
2014-06-06 22:11 ` Dario Faggioli
2014-05-28 0:42 ` [PATCH v6 7/9] xl: enable getting and setting soft Dario Faggioli
2014-05-28 15:33 ` Ian Campbell
2014-05-28 16:01 ` Dario Faggioli [this message]
2014-06-02 15:20 ` George Dunlap
2014-05-28 0:42 ` [PATCH v6 8/9] xl: enable for specifying node-affinity in the config file Dario Faggioli
2014-05-28 15:48 ` Ian Campbell
2014-05-28 16:55 ` Dario Faggioli
2014-05-28 0:42 ` [PATCH v6 9/9] libxl: automatic NUMA placement affects soft affinity 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=1401292885.7504.48.camel@Abyss \
--to=dario.faggioli@citrix.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=george.dunlap@eu.citrix.com \
--cc=keir@xen.org \
--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).