debuggers.hg
changeset 11258:56b05c672033
[XEN] Debug builds check for correct usage of percpu areas.
Signed-off-by: Keir Fraser <keir@xensource.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kfraser@localhost.localdomain |
---|---|
date | Tue Aug 22 11:33:59 2006 +0100 (2006-08-22) |
parents | 80c5350a68f1 |
children | cd4e7ace4e58 |
files | xen/arch/x86/setup.c |
line diff
1.1 --- a/xen/arch/x86/setup.c Tue Aug 22 11:19:48 2006 +0100 1.2 +++ b/xen/arch/x86/setup.c Tue Aug 22 11:33:59 2006 +0100 1.3 @@ -160,19 +160,29 @@ void discard_initial_images(void) 1.4 1.5 extern char __per_cpu_start[], __per_cpu_data_end[], __per_cpu_end[]; 1.6 1.7 -static void percpu_init_areas(void) 1.8 +static void __init percpu_init_areas(void) 1.9 { 1.10 unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start; 1.11 1.12 BUG_ON(data_size > PERCPU_SIZE); 1.13 1.14 - for ( i = 1; i < NR_CPUS; i++ ) 1.15 - memcpy(__per_cpu_start + (i << PERCPU_SHIFT), 1.16 - __per_cpu_start, 1.17 - data_size); 1.18 + for_each_cpu ( i ) 1.19 + { 1.20 + memguard_unguard_range(__per_cpu_start + (i << PERCPU_SHIFT), 1.21 + 1 << PERCPU_SHIFT); 1.22 + if ( i != 0 ) 1.23 + memcpy(__per_cpu_start + (i << PERCPU_SHIFT), 1.24 + __per_cpu_start, 1.25 + data_size); 1.26 + } 1.27 } 1.28 1.29 -static void percpu_free_unused_areas(void) 1.30 +static void __init percpu_guard_areas(void) 1.31 +{ 1.32 + memguard_guard_range(__per_cpu_start, __per_cpu_end - __per_cpu_start); 1.33 +} 1.34 + 1.35 +static void __init percpu_free_unused_areas(void) 1.36 { 1.37 unsigned int i, first_unused; 1.38 1.39 @@ -186,11 +196,13 @@ static void percpu_free_unused_areas(voi 1.40 for ( ; i < NR_CPUS; i++ ) 1.41 BUG_ON(cpu_online(i)); 1.42 1.43 +#ifndef MEMORY_GUARD 1.44 init_xenheap_pages(__pa(__per_cpu_start) + (first_unused << PERCPU_SHIFT), 1.45 __pa(__per_cpu_end)); 1.46 +#endif 1.47 } 1.48 1.49 -static void init_idle_domain(void) 1.50 +static void __init init_idle_domain(void) 1.51 { 1.52 struct domain *idle_domain; 1.53 1.54 @@ -260,8 +272,6 @@ void __init __start_xen(multiboot_info_t 1.55 EARLY_FAIL(); 1.56 } 1.57 1.58 - percpu_init_areas(); 1.59 - 1.60 xenheap_phys_end = opt_xenheap_megabytes << 20; 1.61 1.62 if ( mbi->flags & MBI_MEMMAP ) 1.63 @@ -399,6 +409,7 @@ void __init __start_xen(multiboot_info_t 1.64 } 1.65 1.66 memguard_init(); 1.67 + percpu_guard_areas(); 1.68 1.69 printk("System RAM: %luMB (%lukB)\n", 1.70 nr_pages >> (20 - PAGE_SHIFT), 1.71 @@ -477,13 +488,15 @@ void __init __start_xen(multiboot_info_t 1.72 acpi_boot_table_init(); 1.73 acpi_boot_init(); 1.74 1.75 - if ( smp_found_config ) 1.76 + if ( smp_found_config ) 1.77 get_smp_config(); 1.78 1.79 init_apic_mappings(); 1.80 1.81 init_IRQ(); 1.82 1.83 + percpu_init_areas(); 1.84 + 1.85 init_idle_domain(); 1.86 1.87 trap_init();