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] [PATCH] Fix bug of cpu affinity/ vcpu pin under ia32pae

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix bug of cpu affinity/ vcpu pin under ia32pae
From: "Liu, Jinsong" <jinsong.liu@xxxxxxxxx>
Date: Wed, 31 Mar 2010 01:12:49 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Tue, 30 Mar 2010 10:18:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcrQLDk9Gprbp81PTsW/qUNGByVwkw==
Thread-topic: [PATCH] Fix bug of cpu affinity/ vcpu pin under ia32pae
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@xxxxxxxxx>
               Zhang, Jianwu <jianwu.zhang@xxxxxxxx>
               Liu, Jinsong <jinsong.liu@xxxxxxxxx>

diff -r f3db0ae08304 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Sat Mar 27 16:01:35 2010 +0000
+++ b/tools/python/xen/lowlevel/xc/xc.c Wed Mar 31 00:28:46 2010 +0800
@@ -218,8 +218,7 @@ static PyObject *pyxc_vcpu_setaffinity(X
     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(X
                                       &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(XcObj
     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(XcObj
                                       &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); 
-
     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 )

Attachment: fix-cpu-pin-affinity-ia32pae.patch
Description: fix-cpu-pin-affinity-ia32pae.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix bug of cpu affinity/ vcpu pin under ia32pae, Liu, Jinsong <=