Mailing List Archive

[xen-unstable] Fixes for 21040:b64a8d2a80ad "support affinity for >64 CPUs"
# HG changeset patch
# User Keir Fraser <keir.fraser@citrix.com>
# Date 1268898261 0
# Node ID 84c563da39c81ba0fe32aab37835c2ba54811319
# Parent 04cb0829d138a0794eb2646ae40790badf2bd3a7
Fixes for 21040:b64a8d2a80ad "support affinity for >64 CPUs"

Signed-off-by: James (Song Wei) <jsong@novell.com>
---
tools/libxc/xc_domain.c | 3 +--
tools/python/xen/lowlevel/xc/xc.c | 14 +++++---------
2 files changed, 6 insertions(+), 11 deletions(-)

diff -r 04cb0829d138 -r 84c563da39c8 tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c Wed Mar 17 14:10:43 2010 +0000
+++ b/tools/libxc/xc_domain.c Thu Mar 18 07:44:21 2010 +0000
@@ -138,8 +138,7 @@ int xc_vcpu_getaffinity(int xc_handle,
int xc_vcpu_getaffinity(int xc_handle,
uint32_t domid,
int vcpu,
- uint64_t *cpumap,
- int cpusize)
+ uint64_t *cpumap, int cpusize)
{
DECLARE_DOMCTL;
int ret = -1;
diff -r 04cb0829d138 -r 84c563da39c8 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Wed Mar 17 14:10:43 2010 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c Thu Mar 18 07:44:21 2010 +0000
@@ -220,10 +220,9 @@ static PyObject *pyxc_vcpu_setaffinity(X
int nr_cpus, size;
xc_physinfo_t info;
xc_cpu_to_node_t map[1];
- uint64_t cpumap_size = sizeof(cpumap);
+ uint64_t cpumap_size = sizeof(*cpumap);

static char *kwd_list[] = { "domid", "vcpu", "cpumap", NULL };
-

if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|iO", kwd_list,
&dom, &vcpu, &cpulist) )
@@ -240,7 +239,6 @@ static PyObject *pyxc_vcpu_setaffinity(X
cpumap = malloc(cpumap_size * size);
if(cpumap == NULL)
return pyxc_error_to_exception();
-

if ( (cpulist != NULL) && PyList_Check(cpulist) )
{
@@ -251,7 +249,7 @@ static PyObject *pyxc_vcpu_setaffinity(X
for ( i = 0; i < PyList_Size(cpulist); i++ )
{
long cpu = PyInt_AsLong(PyList_GetItem(cpulist, i));
- *(cpumap + cpu / (cpumap_size * 8)) |= (uint64_t)1 << (cpu % (cpumap_size * 8));
+ cpumap[cpu / (cpumap_size * 8)] |= (uint64_t)1 << (cpu % (cpumap_size * 8));
}
}

@@ -260,7 +258,6 @@ static PyObject *pyxc_vcpu_setaffinity(X
free(cpumap);
return pyxc_error_to_exception();
}
-
Py_INCREF(zero);
free(cpumap);
return zero;
@@ -385,7 +382,7 @@ static PyObject *pyxc_vcpu_getinfo(XcObj
int nr_cpus, size;
xc_physinfo_t pinfo = { 0 };
xc_cpu_to_node_t map[1];
- uint64_t cpumap_size = sizeof(cpumap);
+ uint64_t cpumap_size = sizeof(*cpumap);

static char *kwd_list[] = { "domid", "vcpu", NULL };

@@ -419,16 +416,15 @@ static PyObject *pyxc_vcpu_getinfo(XcObj
"running", info.running,
"cpu_time", info.cpu_time,
"cpu", info.cpu);
-
cpulist = PyList_New(0);
- for ( i = 0; i < size * cpumap_size * 8; i++ )
+ for ( i = 0; i < nr_cpus; i++ )
{
if (*(cpumap + i / (cpumap_size * 8)) & 1 ) {
PyObject *pyint = PyInt_FromLong(i);
PyList_Append(cpulist, pyint);
Py_DECREF(pyint);
}
- *(cpumap + i / (cpumap_size * 8)) >>= 1;
+ cpumap[i / (cpumap_size * 8)] >>= 1;
}
PyDict_SetItemString(info_dict, "cpumap", cpulist);
Py_DECREF(cpulist);

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