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

[Xen-changelog] [xen-unstable] Don't assume vcpu_id's are contiguous in alloc_vcpu



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1258031740 0
# Node ID accded2f185f4178f875b170a5c01544648a68d2
# Parent  b1b4d54629a430b9d9a44ef5d29d0e2e3a123a46
Don't assume vcpu_id's are contiguous in alloc_vcpu

When cpu hot-added, this assumption is broken because the hot-added
CPU may be brougt online by dom0 in arbitrary order. This patch avoids
making this assumption while still linking vcpus in ascending order of
identifier.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/domain.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletion(-)

diff -r b1b4d54629a4 -r accded2f185f xen/common/domain.c
--- a/xen/common/domain.c       Thu Nov 12 13:02:27 2009 +0000
+++ b/xen/common/domain.c       Thu Nov 12 13:15:40 2009 +0000
@@ -176,7 +176,14 @@ struct vcpu *alloc_vcpu(
 
     d->vcpu[vcpu_id] = v;
     if ( vcpu_id != 0 )
-        d->vcpu[v->vcpu_id-1]->next_in_list = v;
+    {
+        int prev_id = v->vcpu_id - 1;
+        while ( (prev_id >= 0) && (d->vcpu[prev_id] == NULL) )
+            prev_id--;
+        BUG_ON(prev_id < 0);
+        v->next_in_list = d->vcpu[prev_id]->next_in_list;
+        d->vcpu[prev_id]->next_in_list = v;
+    }
 
     /* Must be called after making new vcpu visible to for_each_vcpu(). */
     vcpu_check_shutdown(v);

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


 


Rackspace

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