[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.