aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-03-18 07:44:21 +0000
committerKeir Fraser <keir.fraser@citrix.com>2010-03-18 07:44:21 +0000
commitcaf500204f0cd52a0e1fb838029e52bafbfd072b (patch)
tree27e6b9fa270fbd7223051ede28916f3dd704720e
parentae695978a69783a9aff38604daf3322e6709b379 (diff)
downloadxen-caf500204f0cd52a0e1fb838029e52bafbfd072b.tar.gz
xen-caf500204f0cd52a0e1fb838029e52bafbfd072b.tar.bz2
xen-caf500204f0cd52a0e1fb838029e52bafbfd072b.zip
Fixes for 21040:b64a8d2a80ad "support affinity for >64 CPUs"
Signed-off-by: James (Song Wei) <jsong@novell.com>
-rw-r--r--tools/libxc/xc_domain.c3
-rw-r--r--tools/python/xen/lowlevel/xc/xc.c14
2 files changed, 6 insertions, 11 deletions
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 0329fdbf68..682c9241c1 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -138,8 +138,7 @@ int xc_vcpu_setaffinity(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 --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index 9b1d4e253a..d41b69441c 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -220,10 +220,9 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
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(XcObject *self,
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(XcObject *self,
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(XcObject *self,
free(cpumap);
return pyxc_error_to_exception();
}
-
Py_INCREF(zero);
free(cpumap);
return zero;
@@ -385,7 +382,7 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self,
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(XcObject *self,
"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);