All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dan Magenheimer" <dan.magenheimer@oracle.com>
To: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>,
	Ian Pratt <Ian.Pratt@eu.citrix.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: RE: "cpus" config parameter broken?
Date: Thu, 10 Jan 2008 15:40:11 -0700	[thread overview]
Message-ID: <20080110154011921.00000003216@djm-pc> (raw)
In-Reply-To: <C3AC4555.11FB6%Keir.Fraser@cl.cam.ac.uk>

> >>> - the v->cpu_affinity mask should never have bits set for
> >>
> >> This is already the case.
> >
> > No, with the cpus parameter, it is currently possible to
> > set bits in v->cpu_affinity mask for processors that don't
> > exist.
> 
> Ah yes. But then the offline CPUs get masked out in 
> vcpu_set_affinity(), and
> the affinity mask is then rejected if the remaining CPU set is empty.

I see you are correct that the v->cpu_affinity bits never do get set.
But the mask is not rejected -- but instead some bits are silently
ignored -- if there are both online and offline cpus in the list.
So:

   cpus="0,3"

on a 2p machine will currently set only one bit (bit 0) on a 2p but

   xm vcpu-pin domid all "0,3"

will set two bits.  Whereas

   cpus="2-3"

will cause an error on a 2p but

   xm vcpu-pin domid all "2-3"

will not.  This would become relevant if the "cpus" parameter
were preserved across a migration (rather than v->cpu_affinity),
which is what led to my original confusion.

So modulo-izing the cpus parameter code will eliminate this
case, but I still wonder if vcpu_set_affinity should reject any
mask that has bits set beyond max_pcpu instead of silently
ignoring those bits.  Seems like an accident waiting to happen
and indeed I got bitten by it.

Which is why I proposed tightening the definition of all affinity
masks (and strings representing masks) to "if you try to enable
a bit in the cpumask that refers to a non-existent processor, you
will get an error"

Thanks,
Dan

  reply	other threads:[~2008-01-10 22:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-08  1:09 "cpus" config parameter broken? Dan Magenheimer
2008-01-08  1:57 ` Ian Pratt
2008-01-09 18:40   ` Dan Magenheimer
2008-01-09 19:17     ` Keir Fraser
2008-01-10 18:38       ` Dan Magenheimer
2008-01-10 20:50         ` Keir Fraser
2008-01-10 21:10           ` Dan Magenheimer
2008-01-10 21:57             ` Keir Fraser
2008-01-10 22:40               ` Dan Magenheimer [this message]
2008-01-10 22:46                 ` Keir Fraser
2008-01-10 22:53                   ` Dan Magenheimer
2008-01-10 22:55                     ` Keir Fraser
2008-01-10 23:46                       ` Dan Magenheimer
2008-01-10 23:53                         ` Keir Fraser
2008-01-11  0:43                           ` Dan Magenheimer
2008-01-11  0:53                             ` Keir Fraser

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=20080110154011921.00000003216@djm-pc \
    --to=dan.magenheimer@oracle.com \
    --cc=Ian.Pratt@eu.citrix.com \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --cc=xen-devel@lists.xensource.com \
    /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.