aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-03-30 18:32:48 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-03-30 18:32:48 +0100
commitb3fddf563a2507cc9aa8f4df232f445062024218 (patch)
tree1c21b175cad08d4c5c1ed1e627ebdb0b9d532ba0
parente53bd6060d1be3bfa093b9fc07894b2489a21946 (diff)
downloadxen-b3fddf563a2507cc9aa8f4df232f445062024218.tar.gz
xen-b3fddf563a2507cc9aa8f4df232f445062024218.tar.bz2
xen-b3fddf563a2507cc9aa8f4df232f445062024218.zip
xend: Fix bug of cpu affinity/ vcpu pin under ia32pae
c/s 21040 and 21044 used to break cpu number limit (<=64). However, they result in bug under ia32pae model: 1. things will go wrong for affinity, making all vcpus pin to a same cpu with same time; 2. when 'xm vcpu-pin' vpu to cpu, xend will exit abnormally. This patch is to fix the bugs described above. Signed-off-by: Xu, Jiajun <jiajun.xu@intel.com> Signed-off-by: Zhang, Jianwu <jianwu.zhang@inte.com> Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com> xen-unstable changeset: 21087:ebd84be3420a xen-unstable date: Tue Mar 30 18:31:39 2010 +0100
-rw-r--r--tools/python/xen/lowlevel/xc/xc.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index d41b69441c..9d7a7de749 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -218,8 +218,7 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
uint64_t *cpumap;
PyObject *cpulist = NULL;
int nr_cpus, size;
- xc_physinfo_t info;
- xc_cpu_to_node_t map[1];
+ xc_physinfo_t info = {0};
uint64_t cpumap_size = sizeof(*cpumap);
static char *kwd_list[] = { "domid", "vcpu", "cpumap", NULL };
@@ -228,8 +227,6 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
&dom, &vcpu, &cpulist) )
return NULL;
- set_xen_guest_handle(info.cpu_to_node, map);
- info.max_cpu_id = 1;
if ( xc_physinfo(self->xc_handle, &info) != 0 )
return pyxc_error_to_exception();
@@ -381,7 +378,6 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self,
uint64_t *cpumap;
int nr_cpus, size;
xc_physinfo_t pinfo = { 0 };
- xc_cpu_to_node_t map[1];
uint64_t cpumap_size = sizeof(*cpumap);
static char *kwd_list[] = { "domid", "vcpu", NULL };
@@ -390,18 +386,18 @@ static PyObject *pyxc_vcpu_getinfo(XcObject *self,
&dom, &vcpu) )
return NULL;
- set_xen_guest_handle(pinfo.cpu_to_node, map);
- pinfo.max_cpu_id = 1;
if ( xc_physinfo(self->xc_handle, &pinfo) != 0 )
return pyxc_error_to_exception();
nr_cpus = pinfo.nr_cpus;
+
rc = xc_vcpu_getinfo(self->xc_handle, dom, vcpu, &info);
if ( rc < 0 )
return pyxc_error_to_exception();
- size = (nr_cpus + cpumap_size * 8 - 1)/ (cpumap_size * 8);
+ size = (nr_cpus + cpumap_size * 8 - 1)/ (cpumap_size * 8);
if((cpumap = malloc(cpumap_size * size)) == NULL)
return pyxc_error_to_exception();
+ memset(cpumap, 0, cpumap_size * size);
rc = xc_vcpu_getaffinity(self->xc_handle, dom, vcpu, cpumap, cpumap_size * size);
if ( rc < 0 )