WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] A strange behavior by the xm vcpu-pin command

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] A strange behavior by the xm vcpu-pin command
From: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Date: Mon, 19 Feb 2007 23:04:37 +0900
Delivery-date: Mon, 19 Feb 2007 06:04:30 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi all,

I found a strange behavior by the xm vcpu-pin command. 
My machine has two physical CPUs. 
When I specified "64" to physical CPU number, the CPU affinity was "0".
When I specified "65" to physical CPU number, the CPU affinity was "1".
When I specified "66" to physical CPU number, the xm vcpu-pin command 
was error. 

# xm vcpu-list vm1
Name                              ID  VCPU   CPU State   Time(s) CPU Affinity
vm1                                2     0     1   ---      19.0 any cpu
# xm vcpu-pin vm1 0 64
# xm vcpu-list vm1
Name                              ID  VCPU   CPU State   Time(s) CPU Affinity
vm1                                2     0     0   -b-      21.0 0
# xm vcpu-pin vm1 0 65
# xm vcpu-list vm1
Name                              ID  VCPU   CPU State   Time(s) CPU Affinity
vm1                                2     0     1   -b-      22.6 1
# xm vcpu-pin vm1 0 66
Error: (22, 'Invalid argument')
Usage: xm vcpu-pin <Domain> <VCPU> <CPUs>

Set which CPUs a VCPU can use.
# xm vcpu-list vm1
Name                              ID  VCPU   CPU State   Time(s) CPU Affinity
vm1                                2     0     1   -b-      24.6 1


I thought that the cause is in line 201 of pyxc_vcpu_setaffinity(). 
But I think that the value of cpumap is 0 when shifting by the value of 
64 or more. If the valus of cpumap is 0, I think that the strange 
behavior does not occur. 
Where is a true cause?

182 static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
183                                        PyObject *args,
184                                        PyObject *kwds)
185 {
186     uint32_t dom;
187     int vcpu = 0, i;
188     uint64_t  cpumap = ~0ULL;
189     PyObject *cpulist = NULL;
190 
191     static char *kwd_list[] = { "domid", "vcpu", "cpumap", NULL };
192 
193     if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|iO", kwd_list, 
194                                       &dom, &vcpu, &cpulist) )
195         return NULL;
196 
197     if ( (cpulist != NULL) && PyList_Check(cpulist) )
198     {
199         cpumap = 0ULL;
200         for ( i = 0; i < PyList_Size(cpulist); i++ ) 
201             cpumap |= (uint64_t)1 << PyInt_AsLong(PyList_GetItem(cpulist, 
i));
202     }
203   
204     if ( xc_vcpu_setaffinity(self->xc_handle, dom, vcpu, cpumap) != 0 )
205         return pyxc_error_to_exception();
206     
207     Py_INCREF(zero);
208     return zero;
209 }


Best regards,
 Kan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] A strange behavior by the xm vcpu-pin command, Masaki Kanno <=