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] [xen-unstable] merge.

# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Node ID cd4e7ace4e58d9e35c08ccaa4677c6b6d0cf137b
# Parent  a58ffedb59ce658ee9e066f0dd73551831f8e243
# Parent  56b05c6720337c6da4604a85337eba263a9bd733
merge.
---
 xen/arch/x86/domain.c      |   11 ++++++-
 xen/arch/x86/setup.c       |   66 ++++++++++++++++++++++++++++++---------------
 xen/arch/x86/smpboot.c     |    2 -
 xen/arch/x86/x86_32/mm.c   |   10 ++++--
 xen/arch/x86/x86_64/mm.c   |    7 ++--
 xen/common/sched_sedf.c    |   13 ++------
 xen/common/schedule.c      |    2 -
 xen/common/timer.c         |    2 -
 xen/include/asm-x86/page.h |    3 +-
 9 files changed, 70 insertions(+), 46 deletions(-)

diff -r a58ffedb59ce -r cd4e7ace4e58 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Tue Aug 22 11:30:13 2006 +0100
+++ b/xen/arch/x86/domain.c     Tue Aug 22 11:34:46 2006 +0100
@@ -125,8 +125,15 @@ struct vcpu *alloc_vcpu_struct(struct do
 
     v->arch.flags = TF_kernel_mode;
 
-    v->arch.schedule_tail = is_idle_domain(d) ?
-        continue_idle_domain : continue_nonidle_domain;
+    if ( is_idle_domain(d) )
+    {
+        v->arch.schedule_tail = continue_idle_domain;
+        v->arch.cr3           = __pa(idle_pg_table);
+    }
+    else
+    {
+        v->arch.schedule_tail = continue_nonidle_domain;
+    }
 
     v->arch.ctxt_switch_from = paravirt_ctxt_switch_from;
     v->arch.ctxt_switch_to   = paravirt_ctxt_switch_to;
diff -r a58ffedb59ce -r cd4e7ace4e58 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Tue Aug 22 11:30:13 2006 +0100
+++ b/xen/arch/x86/setup.c      Tue Aug 22 11:34:46 2006 +0100
@@ -160,19 +160,29 @@ void discard_initial_images(void)
 
 extern char __per_cpu_start[], __per_cpu_data_end[], __per_cpu_end[];
 
-static void percpu_init_areas(void)
+static void __init percpu_init_areas(void)
 {
     unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start;
 
     BUG_ON(data_size > PERCPU_SIZE);
 
-    for ( i = 1; i < NR_CPUS; i++ )
-        memcpy(__per_cpu_start + (i << PERCPU_SHIFT),
-               __per_cpu_start,
-               data_size);
-}
-
-static void percpu_free_unused_areas(void)
+    for_each_cpu ( i )
+    {
+        memguard_unguard_range(__per_cpu_start + (i << PERCPU_SHIFT),
+                               1 << PERCPU_SHIFT);
+        if ( i != 0 )
+            memcpy(__per_cpu_start + (i << PERCPU_SHIFT),
+                   __per_cpu_start,
+                   data_size);
+    }
+}
+
+static void __init percpu_guard_areas(void)
+{
+    memguard_guard_range(__per_cpu_start, __per_cpu_end - __per_cpu_start);
+}
+
+static void __init percpu_free_unused_areas(void)
 {
     unsigned int i, first_unused;
 
@@ -186,14 +196,32 @@ static void percpu_free_unused_areas(voi
     for ( ; i < NR_CPUS; i++ )
         BUG_ON(cpu_online(i));
 
+#ifndef MEMORY_GUARD
     init_xenheap_pages(__pa(__per_cpu_start) + (first_unused << PERCPU_SHIFT),
                        __pa(__per_cpu_end));
+#endif
+}
+
+static void __init init_idle_domain(void)
+{
+    struct domain *idle_domain;
+
+    /* Domain creation requires that scheduler structures are initialised. */
+    scheduler_init();
+
+    idle_domain = domain_create(IDLE_DOMAIN_ID);
+    if ( (idle_domain == NULL) || (alloc_vcpu(idle_domain, 0, 0) == NULL) )
+        BUG();
+
+    set_current(idle_domain->vcpu[0]);
+    idle_vcpu[0] = this_cpu(curr_vcpu) = current;
+
+    setup_idle_pagetable();
 }
 
 void __init __start_xen(multiboot_info_t *mbi)
 {
     char __cmdline[] = "", *cmdline = __cmdline;
-    struct domain *idle_domain;
     unsigned long _initrd_start = 0, _initrd_len = 0;
     unsigned int initrdidx = 1;
     module_t *mod = (module_t *)__va(mbi->mods_addr);
@@ -212,6 +240,7 @@ void __init __start_xen(multiboot_info_t
     cmdline_parse(cmdline);
 
     set_current((struct vcpu *)0xfffff000); /* debug sanity */
+    idle_vcpu[0] = current;
     set_processor_id(0); /* needed early, for smp_processor_id() */
 
     smp_prepare_boot_cpu();
@@ -242,8 +271,6 @@ void __init __start_xen(multiboot_info_t
         printk("FATAL ERROR: Misaligned CPU0 stack.\n");
         EARLY_FAIL();
     }
-
-    percpu_init_areas();
 
     xenheap_phys_end = opt_xenheap_megabytes << 20;
 
@@ -382,6 +409,7 @@ void __init __start_xen(multiboot_info_t
     }
 
     memguard_init();
+    percpu_guard_areas();
 
     printk("System RAM: %luMB (%lukB)\n", 
            nr_pages >> (20 - PAGE_SHIFT),
@@ -437,16 +465,6 @@ void __init __start_xen(multiboot_info_t
 
     early_cpu_init();
 
-    scheduler_init();
-
-    idle_domain = domain_create(IDLE_DOMAIN_ID);
-    if ( (idle_domain == NULL) || (alloc_vcpu(idle_domain, 0, 0) == NULL) )
-        BUG();
-
-    set_current(idle_domain->vcpu[0]);
-    this_cpu(curr_vcpu) = idle_domain->vcpu[0];
-    idle_vcpu[0] = current;
-
     paging_init();
 
     /* Unmap the first page of CPU0's stack. */
@@ -470,12 +488,16 @@ void __init __start_xen(multiboot_info_t
     acpi_boot_table_init();
     acpi_boot_init();
 
-    if ( smp_found_config ) 
+    if ( smp_found_config )
         get_smp_config();
 
     init_apic_mappings();
 
     init_IRQ();
+
+    percpu_init_areas();
+
+    init_idle_domain();
 
     trap_init();
 
diff -r a58ffedb59ce -r cd4e7ace4e58 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Tue Aug 22 11:30:13 2006 +0100
+++ b/xen/arch/x86/smpboot.c    Tue Aug 22 11:34:46 2006 +0100
@@ -896,8 +896,6 @@ static int __devinit do_boot_cpu(int api
        v = alloc_idle_vcpu(cpu);
        BUG_ON(v == NULL);
 
-       v->arch.cr3 = __pa(idle_pg_table);
-
        /* start_eip had better be page-aligned! */
        start_eip = setup_trampoline();
 
diff -r a58ffedb59ce -r cd4e7ace4e58 xen/arch/x86/x86_32/mm.c
--- a/xen/arch/x86/x86_32/mm.c  Tue Aug 22 11:30:13 2006 +0100
+++ b/xen/arch/x86/x86_32/mm.c  Tue Aug 22 11:34:46 2006 +0100
@@ -75,8 +75,6 @@ void __init paging_init(void)
     printk("PAE disabled.\n");
 #endif
 
-    idle_vcpu[0]->arch.cr3 = __pa(idle_pg_table);
-
     if ( cpu_has_pge )
     {
         /* Suitable Xen mapping can be GLOBAL. */
@@ -120,8 +118,12 @@ void __init paging_init(void)
         idle_pg_table_l2[l2_linear_offset(IOREMAP_VIRT_START) + i] =
             l2e_from_page(virt_to_page(ioremap_pt), __PAGE_HYPERVISOR);
     }
-
-    /* Install per-domain mappings for idle domain. */
+}
+
+void __init setup_idle_pagetable(void)
+{
+    int i;
+
     for ( i = 0; i < PDPT_L2_ENTRIES; i++ )
         idle_pg_table_l2[l2_linear_offset(PERDOMAIN_VIRT_START) + i] =
             l2e_from_page(virt_to_page(idle_vcpu[0]->domain->
diff -r a58ffedb59ce -r cd4e7ace4e58 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  Tue Aug 22 11:30:13 2006 +0100
+++ b/xen/arch/x86/x86_64/mm.c  Tue Aug 22 11:34:46 2006 +0100
@@ -81,8 +81,6 @@ void __init paging_init(void)
     l2_pgentry_t *l2_ro_mpt;
     struct page_info *pg;
 
-    idle_vcpu[0]->arch.cr3 = __pa(idle_pg_table);
-
     /* Create user-accessible L2 directory to map the MPT for guests. */
     l3_ro_mpt = alloc_xenheap_page();
     clear_page(l3_ro_mpt);
@@ -121,7 +119,10 @@ void __init paging_init(void)
     /* Set up linear page table mapping. */
     idle_pg_table[l4_table_offset(LINEAR_PT_VIRT_START)] =
         l4e_from_paddr(__pa(idle_pg_table), __PAGE_HYPERVISOR);
-
+}
+
+void __init setup_idle_pagetable(void)
+{
     /* Install per-domain mappings for idle domain. */
     idle_pg_table[l4_table_offset(PERDOMAIN_VIRT_START)] =
         l4e_from_page(
diff -r a58ffedb59ce -r cd4e7ace4e58 xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c   Tue Aug 22 11:30:13 2006 +0100
+++ b/xen/common/sched_sedf.c   Tue Aug 22 11:34:46 2006 +0100
@@ -1301,16 +1301,9 @@ static int sedf_adjust_weights(struct sc
 {
     struct vcpu *p;
     struct domain      *d;
-    int                 sumw[NR_CPUS];
-    s_time_t            sumt[NR_CPUS];
-    int                 cpu;
- 
-    for ( cpu = 0; cpu < NR_CPUS; cpu++ )
-    {
-        sumw[cpu] = 0;
-        sumt[cpu] = 0;
-    }
-
+    int                 sumw[NR_CPUS] = { 0 };
+    s_time_t            sumt[NR_CPUS] = { 0 };
+ 
     /* Sum across all weights. */
     for_each_domain( d )
     {
diff -r a58ffedb59ce -r cd4e7ace4e58 xen/common/schedule.c
--- a/xen/common/schedule.c     Tue Aug 22 11:30:13 2006 +0100
+++ b/xen/common/schedule.c     Tue Aug 22 11:34:46 2006 +0100
@@ -633,7 +633,7 @@ void __init scheduler_init(void)
 
     open_softirq(SCHEDULE_SOFTIRQ, __enter_scheduler);
 
-    for ( i = 0; i < NR_CPUS; i++ )
+    for_each_cpu ( i )
     {
         spin_lock_init(&per_cpu(schedule_data, i).schedule_lock);
         init_timer(&per_cpu(schedule_data, i).s_timer, s_timer_fn, NULL, i);
diff -r a58ffedb59ce -r cd4e7ace4e58 xen/common/timer.c
--- a/xen/common/timer.c        Tue Aug 22 11:30:13 2006 +0100
+++ b/xen/common/timer.c        Tue Aug 22 11:34:46 2006 +0100
@@ -382,7 +382,7 @@ void __init timer_init(void)
     SET_HEAP_SIZE(&dummy_heap, 0);
     SET_HEAP_LIMIT(&dummy_heap, 0);
 
-    for ( i = 0; i < NR_CPUS; i++ )
+    for_each_cpu ( i )
     {
         spin_lock_init(&per_cpu(timers, i).lock);
         per_cpu(timers, i).heap = &dummy_heap;
diff -r a58ffedb59ce -r cd4e7ace4e58 xen/include/asm-x86/page.h
--- a/xen/include/asm-x86/page.h        Tue Aug 22 11:30:13 2006 +0100
+++ b/xen/include/asm-x86/page.h        Tue Aug 22 11:34:46 2006 +0100
@@ -255,7 +255,8 @@ extern root_pgentry_t idle_pg_table[ROOT
 extern root_pgentry_t idle_pg_table[ROOT_PAGETABLE_ENTRIES];
 extern l2_pgentry_t   idle_pg_table_l2[ROOT_PAGETABLE_ENTRIES];
 #endif
-extern void paging_init(void);
+void paging_init(void);
+void setup_idle_pagetable(void);
 #endif
 
 #define __pge_off()                                                     \

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

<Prev in Thread] Current Thread [Next in Thread>