xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>,
	Dario Faggioli <dario.faggioli@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH for-4.6 v2 2/3] xl: error out if vNUMA specifies more vcpus than pcpus
Date: Sun, 16 Aug 2015 09:51:53 +0100	[thread overview]
Message-ID: <1439715113.3480.13.camel@citrix.com> (raw)
In-Reply-To: <20150813233802.GA4698@zion.uk.xensource.com>

On Fri, 2015-08-14 at 00:38 +0100, Wei Liu wrote:
> > 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?
> > 
> 
> That's fine because that function has no effect when you try to set a
> bit beyond its size.

This sort of subtlety is worthy of a comment in either the code of the
commit message.

> > 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.

FWIW that's what I was expecting to happen...

> > It'll most likely be a bit uglier than this patch, but probably still
> > less complex than v1. :-)

> That doesn't make any difference in terms of functionality. I would
> rather leave the parsing bit as it is and deal with fallout 
> separately.
> That would make code cleaner IMHO.

... It's a bit wasteful to keep parsing after things have already
failed, but I suppose that's not too bad and we can live with it.

Ian

  parent reply	other threads:[~2015-08-16  8:51 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
2015-08-13 23:38     ` Wei Liu
2015-08-14 10:19       ` Dario Faggioli
2015-08-16  8:51       ` Ian Campbell [this message]
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=1439715113.3480.13.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=dario.faggioli@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 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).