xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] Fix cpumap setting before passing to XEN
Date: Mon, 11 Apr 2016 12:27:47 +0100	[thread overview]
Message-ID: <20160411112747.GE1346@citrix.com> (raw)
In-Reply-To: <570B0121.60306@oracle.com>

On Mon, Apr 11, 2016 at 09:42:57AM +0800, Zhenzhong Duan wrote:
> It's tool's duty to pass a correct cpumap to XEN. On a host with less than
> 64
> CPUS, it just shows below error.
> 
> [root@localhost /]# xm vcpu-pin 3 all all
> Error: Cannot pin vcpu: 0 to cpu: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
> 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
> 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
> 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63] - (22, 'Invalid
> argument')
> 

This error clearly shows that the upper layer is not passing down the
right cpumap. So this example along won't convince me to that this is a
bug in python binding. It's free to reject input that it deems wrong.

I guess the question is more or less what should it do in such
situation. So ...

> The fix make it same as in xl code.
> 

Is there reference to this? I guess the commit message  or mail thread
will shed more light on the expected behaviour.

BTW please CC relevant maintainers in the future, thanks.

Wei.

> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
> ---
>  tools/python/xen/lowlevel/xc/xc.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/tools/python/xen/lowlevel/xc/xc.c
> b/tools/python/xen/lowlevel/xc/xc.c
> index c40a4e9..2f4898d 100644
> --- a/tools/python/xen/lowlevel/xc/xc.c
> +++ b/tools/python/xen/lowlevel/xc/xc.c
> @@ -243,13 +243,15 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
>          for ( i = 0; i < PyList_Size(cpulist); i++ )
>          {
>              long cpu = PyInt_AsLong(PyList_GetItem(cpulist, i));
> -            if ( cpu < 0 || cpu >= nr_cpus )
> +            if ( cpu < 0 )
>              {
>                  free(cpumap);
>                  errno = EINVAL;
>                  PyErr_SetFromErrno(xc_error_obj);
>                  return NULL;
>              }
> +            if ( cpu >= nr_cpus )
> +                continue;
>              cpumap[cpu / 8] |= 1 << (cpu % 8);
>          }
>      }
> -- 
> 1.7.3
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-04-11 11:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-11  1:42 [PATCH] Fix cpumap setting before passing to XEN Zhenzhong Duan
2016-04-11 11:27 ` Wei Liu [this message]
2016-04-12  3:35   ` Zhenzhong Duan
2016-04-18  4:57     ` Zhenzhong Duan
2016-04-20 14:33     ` Wei Liu
2016-04-22 18:15       ` Konrad Rzeszutek Wilk
2016-04-25 13:26         ` Ian Jackson
2016-04-26  3:54           ` Zhenzhong Duan
2016-04-28 15:07             ` Wei Liu
2016-04-28 17:02               ` Ian Jackson
2016-05-04 20:04                 ` Konrad Rzeszutek Wilk

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=20160411112747.GE1346@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    --cc=zhenzhong.duan@oracle.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 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).