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] Don't assume the vcpu_id is continous in alloc_vcpu

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Don't assume the vcpu_id is continous in alloc_vcpu
From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Date: Thu, 12 Nov 2009 19:08:03 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc:
Delivery-date: Thu, 12 Nov 2009 03:08:26 -0800
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: AcpjiGc6hZlnMOBYRPSWYjjerzo1vQ==
Thread-topic: [PATCH] Don't assume the vcpu_id is continous in alloc_vcpu
Currently in alloc_vcpu, it assumes the vcpu is allocated with vcpu_id is 
continous.
When cpu hot-added, this assumption is broken because the hot-added CPU may be 
brougt online by dom0 in arbitrary order. This patch try to link the new vcpu 
to the end of the link. 

Signed-off-by: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>


diff -r 68b6bf9b5c8b xen/common/domain.c
--- a/xen/common/domain.c       Thu Nov 12 04:08:25 2009 +0800
+++ b/xen/common/domain.c       Thu Nov 12 04:08:43 2009 +0800
@@ -176,7 +176,13 @@ struct vcpu *alloc_vcpu(
 
     d->vcpu[vcpu_id] = v;
     if ( vcpu_id != 0 )
-        d->vcpu[v->vcpu_id-1]->next_in_list = v;
+    {
+        struct vcpu *tmp = d->vcpu[0];
+
+        while (tmp->next_in_list)
+            tmp = tmp->next_in_list;
+        tmp->next_in_list = v;
+    }
 
     /* Must be called after making new vcpu visible to for_each_vcpu(). */
     vcpu_check_shutdown(v);

Attachment: vcpu_id.patch
Description: vcpu_id.patch

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