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-changelog

[Xen-changelog] Ensure curr_vcpu in domain.c is set correctly, even when

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Ensure curr_vcpu in domain.c is set correctly, even when
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 29 Mar 2006 16:38:08 +0000
Delivery-date: Wed, 29 Mar 2006 16:39:55 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 5715cf1171787e91f11783d29923a953df494adb
# Parent  d7cbcf5d7cd636acd5bdce97b96ab7e534c1ec88
Ensure curr_vcpu in domain.c is set correctly, even when
nr physical cpus is greater than max virtual cpus per domain.

Also do not initialise secondary CPU smp_processor_id() from
smpboot.c cpucount. It will be wrong if some CPUs fail to boot.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r d7cbcf5d7cd6 -r 5715cf117178 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Wed Mar 29 13:54:43 2006
+++ b/xen/arch/x86/domain.c     Wed Mar 29 14:39:22 2006
@@ -208,6 +208,11 @@
     }
 }
 
+void set_current_execstate(struct vcpu *v)
+{
+    percpu_ctxt[smp_processor_id()].curr_vcpu = v;
+}
+
 struct vcpu *alloc_vcpu_struct(struct domain *d, unsigned int vcpu_id)
 {
     struct vcpu *v;
@@ -219,15 +224,8 @@
 
     v->arch.flags = TF_kernel_mode;
 
-    if ( is_idle_domain(d) )
-    {
-        percpu_ctxt[vcpu_id].curr_vcpu = v;
-        v->arch.schedule_tail = continue_idle_domain;
-    }
-    else
-    {
-        v->arch.schedule_tail = continue_nonidle_domain;
-    }
+    v->arch.schedule_tail = is_idle_domain(d) ?
+        continue_idle_domain : continue_nonidle_domain;
 
     v->arch.ctxt_switch_from = paravirt_ctxt_switch_from;
     v->arch.ctxt_switch_to   = paravirt_ctxt_switch_to;
diff -r d7cbcf5d7cd6 -r 5715cf117178 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Wed Mar 29 13:54:43 2006
+++ b/xen/arch/x86/setup.c      Wed Mar 29 14:39:22 2006
@@ -404,6 +404,7 @@
     BUG_ON(idle_domain == NULL);
 
     set_current(idle_domain->vcpu[0]);
+    set_current_execstate(idle_domain->vcpu[0]);
     idle_vcpu[0] = current;
 
     paging_init();
diff -r d7cbcf5d7cd6 -r 5715cf117178 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Wed Mar 29 13:54:43 2006
+++ b/xen/arch/x86/smpboot.c    Wed Mar 29 14:39:22 2006
@@ -441,7 +441,7 @@
        calibrate_tsc_ap();
 }
 
-static int cpucount;
+static int cpucount, booting_cpu;
 
 /* representing cpus for which sibling maps can be computed */
 static cpumask_t cpu_sibling_setup_map;
@@ -524,12 +524,13 @@
         * booting is too fragile that we want to limit the
         * things done here to the most necessary things.
         */
-       unsigned int cpu = cpucount;
+       unsigned int cpu = booting_cpu;
 
        extern void percpu_traps_init(void);
 
+       set_processor_id(cpu);
        set_current(idle_vcpu[cpu]);
-       set_processor_id(cpu);
+       set_current_execstate(idle_vcpu[cpu]);
 
        percpu_traps_init();
 
@@ -889,6 +890,8 @@
        int vcpu_id;
 
        ++cpucount;
+
+       booting_cpu = cpu;
 
        if ((vcpu_id = cpu % MAX_VIRT_CPUS) == 0) {
                d = domain_create(IDLE_DOMAIN_ID, cpu);
diff -r d7cbcf5d7cd6 -r 5715cf117178 xen/include/asm-x86/current.h
--- a/xen/include/asm-x86/current.h     Wed Mar 29 13:54:43 2006
+++ b/xen/include/asm-x86/current.h     Wed Mar 29 14:39:22 2006
@@ -53,4 +53,6 @@
 
 #define schedule_tail(_ed) (((_ed)->arch.schedule_tail)(_ed))
 
+extern void set_current_execstate(struct vcpu *v);
+
 #endif /* __X86_CURRENT_H__ */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Ensure curr_vcpu in domain.c is set correctly, even when, Xen patchbot -unstable <=