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

[Xen-changelog] [xen-unstable] x86: Initialise percpu areas as early as possible during bootstrap.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1262099507 0
# Node ID 3f654b88e201a1341786a0e8725c25f40c1162b7
# Parent  a4a24cf98691670cafda86ecbc93992fd8f45b12
x86: Initialise percpu areas as early as possible during bootstrap.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/setup.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff -r a4a24cf98691 -r 3f654b88e201 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Tue Dec 29 15:04:17 2009 +0000
+++ b/xen/arch/x86/setup.c      Tue Dec 29 15:11:47 2009 +0000
@@ -202,21 +202,32 @@ static void __init percpu_init_areas(voi
 static void __init percpu_init_areas(void)
 {
     unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start;
-    unsigned int first_unused;
 
     BUG_ON(data_size > PERCPU_SIZE);
 
     /* Initialise per-cpu data area for all possible secondary CPUs. */
-    for ( i = 1; (i < NR_CPUS) && cpu_possible(i); i++ )
+    for ( i = 1; i < NR_CPUS; i++ )
         memcpy(__per_cpu_start + (i << PERCPU_SHIFT),
                __per_cpu_start,
                data_size);
+}
+
+static void __init percpu_free_unused_areas(void)
+{
+    unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start;
+    unsigned int first_unused;
+
+    /* Find first 'impossible' secondary CPU. */
+    for ( i = 1; i < NR_CPUS; i++ )
+        if ( !cpu_possible(i) )
+            break;
     first_unused = i;
 
     /* Check that there are no holes in cpu_possible_map. */
     for ( ; i < NR_CPUS; i++ )
         BUG_ON(cpu_possible(i));
 
+    /* Free all unused per-cpu data areas. */
     free_xen_data(&__per_cpu_start[first_unused << PERCPU_SHIFT], __bss_start);
 
     data_size = (data_size + PAGE_SIZE + 1) & PAGE_MASK;
@@ -447,6 +458,8 @@ void __init __start_xen(unsigned long mb
         .parity    = 'n',
         .stop_bits = 1
     };
+
+    percpu_init_areas();
 
     set_intr_gate(TRAP_page_fault, &early_page_fault);
 
@@ -995,7 +1008,7 @@ void __init __start_xen(unsigned long mb
 
     init_apic_mappings();
 
-    percpu_init_areas();
+    percpu_free_unused_areas();
 
     init_IRQ();
 

_______________________________________________
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®.