From: Dario Faggioli <dario.faggioli@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>
Subject: Re: [PATCH for-4.6 v2 2/3] xl: error out if vNUMA specifies more vcpus than pcpus
Date: Fri, 14 Aug 2015 01:25:45 +0200 [thread overview]
Message-ID: <1439508345.24583.91.camel@citrix.com> (raw)
In-Reply-To: <1439480480-20939-3-git-send-email-wei.liu2@citrix.com>
[-- Attachment #1.1: Type: text/plain, Size: 2840 bytes --]
On Thu, 2015-08-13 at 16:41 +0100, Wei Liu wrote:
> ... but allow user to override that check by specifying maxvcpus= in xl
> configuration file.
>
Ok, from the discussion on v1, and from the subject of this new
submission, I now see that what you're after the "more vcpus (in a
single guest) than pcpus" case.
This is so uncommon, IMO, that it did not even cross my mind while
looking at v1.. Sorry for this. :-)
That being said, I agree with IanC's view, as he expressed it during v1
review, and I find this new version of the patch much better!
However, although I like the idea, as I said...
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 078acd1..5fde8fa 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -1202,11 +1202,27 @@ static void parse_vnuma_config(const XLU_Config *config,
> }
>
> /* User has specified maxvcpus= */
> - if (b_info->max_vcpus != 0 && b_info->max_vcpus != max_vcpus) {
> - fprintf(stderr, "xl: vnuma vcpus and maxvcpus= mismatch\n");
> - exit(1);
> - } else
> + if (b_info->max_vcpus != 0) {
> + if (b_info->max_vcpus != max_vcpus) {
> + fprintf(stderr, "xl: vnuma vcpus and maxvcpus= mismatch\n");
> + exit(1);
> + }
> + } else {
> + int host_cpus = libxl_get_online_cpus(ctx);
> +
> + if (host_cpus < 0) {
> + fprintf(stderr, "Failed to get online cpus\n");
> + exit(1);
> + }
> +
> + if (host_cpus < max_vcpus) {
> + fprintf(stderr, "xl: vnuma specifies more vcpus than pcpus, "\
> + "use maxvcpus= to override this check.\n");
>
...isn't it too late, when we get to here?
In fact, if b_info->max_vcpus is 0, the elements of vcpu_parsed are
sized against the host pcpus, and we risk to call libxl_bitmap_set() for
vcpus beyond that limit, while parsing the "vcpus" subsection of the
vnode specification (which happens _before_ this check).
Or am I missing something?
Assuming I'm not, it seems to me that a solution could be to check for
this situation _inside_ the 'else if (!strcmp("vcpus", option))'. In
fact, if "maxvcpus" has not been specified, as soon as the end of one of
the ranges --as returned by parse_range()-- is beyond host_cpus, we know
we'd be going past the limit of the corresponding element of
vcpu_parsed, and we can error out.
It'll most likely be a bit uglier than this patch, but probably still
less complex than v1. :-)
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: 181 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:[~2015-08-13 23:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-13 15:41 [PATCH for-4.6 v2 0/3] More vNUMA fixes Wei Liu
2015-08-13 15:41 ` [PATCH for-4.6 v2 1/3] xl: fix vNUMA vdistance parsing Wei Liu
2015-08-16 8:46 ` Ian Campbell
2015-08-13 15:41 ` [PATCH for-4.6 v2 2/3] xl: error out if vNUMA specifies more vcpus than pcpus Wei Liu
2015-08-13 23:25 ` Dario Faggioli [this message]
2015-08-13 23:38 ` Wei Liu
2015-08-14 10:19 ` Dario Faggioli
2015-08-16 8:51 ` Ian Campbell
2015-08-17 18:42 ` Wei Liu
2015-08-13 15:41 ` [PATCH for-4.6 v2 3/3] libxc: fix vNUMA memory allocation Wei Liu
2015-08-16 8:47 ` Ian Campbell
2015-08-14 15:19 ` Empty memory nodes in VNUMA Boris Ostrovsky
2015-08-14 15:35 ` Wei Liu
2015-08-14 15:38 ` Boris Ostrovsky
2015-08-14 15:44 ` Wei Liu
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=1439508345.24583.91.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=ian.campbell@citrix.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 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.