ia64/xen-unstable

changeset 7606:0b8f92adc679

Fix CPU hotplug -- cpu initialisation functions must be declared
__cpuinit or later hotplug references freed code and data.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Nov 01 16:28:20 2005 +0100 (2005-11-01)
parents 99f4ba74763e
children 3492adc0ad60
files linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c patches/linux-2.6.12/cpu-hotplug-init.patch
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c	Tue Nov 01 16:02:43 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c	Tue Nov 01 16:28:20 2005 +0100
     1.3 @@ -520,7 +520,7 @@ void __init print_cpu_info(struct cpuinf
     1.4  		printk("\n");
     1.5  }
     1.6  
     1.7 -cpumask_t cpu_initialized __initdata = CPU_MASK_NONE;
     1.8 +cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
     1.9  
    1.10  /* This is hacky. :)
    1.11   * We're emulating future behavior.
    1.12 @@ -562,7 +562,7 @@ void __init early_cpu_init(void)
    1.13  #endif
    1.14  }
    1.15  
    1.16 -void __init cpu_gdt_init(struct Xgt_desc_struct *gdt_descr)
    1.17 +void __cpuinit cpu_gdt_init(struct Xgt_desc_struct *gdt_descr)
    1.18  {
    1.19  	unsigned long frames[16];
    1.20  	unsigned long va;
    1.21 @@ -585,7 +585,7 @@ void __init cpu_gdt_init(struct Xgt_desc
    1.22   * and IDT. We reload them nevertheless, this function acts as a
    1.23   * 'CPU state barrier', nothing should get across.
    1.24   */
    1.25 -void __init cpu_init (void)
    1.26 +void __cpuinit cpu_init (void)
    1.27  {
    1.28  	int cpu = smp_processor_id();
    1.29  	struct tss_struct * t = &per_cpu(init_tss, cpu);
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c	Tue Nov 01 16:02:43 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c	Tue Nov 01 16:28:20 2005 +0100
     2.3 @@ -35,7 +35,7 @@
     2.4  #endif
     2.5  char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
     2.6  
     2.7 -cpumask_t cpu_initialized __initdata = CPU_MASK_NONE;
     2.8 +cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
     2.9  
    2.10  struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; 
    2.11  
    2.12 @@ -130,7 +130,7 @@ static void switch_pt(void)
    2.13          xen_new_user_pt(__pa(init_level4_user_pgt));
    2.14  }
    2.15  
    2.16 -void __init cpu_gdt_init(struct desc_ptr *gdt_descr)
    2.17 +void __cpuinit cpu_gdt_init(struct desc_ptr *gdt_descr)
    2.18  {
    2.19  	unsigned long frames[16];
    2.20  	unsigned long va;
    2.21 @@ -227,7 +227,7 @@ void syscall_init(void)
    2.22  #endif
    2.23  }
    2.24  
    2.25 -void __init check_efer(void)
    2.26 +void __cpuinit check_efer(void)
    2.27  {
    2.28  	unsigned long efer;
    2.29  
    2.30 @@ -244,7 +244,7 @@ void __init check_efer(void)
    2.31   * 'CPU state barrier', nothing should get across.
    2.32   * A lot of state is already set up in PDA init.
    2.33   */
    2.34 -void __init cpu_init (void)
    2.35 +void __cpuinit cpu_init (void)
    2.36  {
    2.37  #ifdef CONFIG_SMP
    2.38  	int cpu = stack_smp_processor_id();
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/patches/linux-2.6.12/cpu-hotplug-init.patch	Tue Nov 01 16:28:20 2005 +0100
     3.3 @@ -0,0 +1,34 @@
     3.4 +diff -ur linux-2.6.12.orig/include/linux/init.h linux-2.6.12/include/linux/init.h
     3.5 +--- linux-2.6.12.orig/include/linux/init.h	2005-11-01 14:52:28.656025573 +0000
     3.6 ++++ linux-2.6.12/include/linux/init.h	2005-11-01 14:53:28.015791549 +0000
     3.7 +@@ -229,6 +229,18 @@
     3.8 + #define __devexitdata __exitdata
     3.9 + #endif
    3.10 + 
    3.11 ++#ifdef CONFIG_HOTPLUG_CPU
    3.12 ++#define __cpuinit
    3.13 ++#define __cpuinitdata
    3.14 ++#define __cpuexit
    3.15 ++#define __cpuexitdata
    3.16 ++#else
    3.17 ++#define __cpuinit	__init
    3.18 ++#define __cpuinitdata __initdata
    3.19 ++#define __cpuexit __exit
    3.20 ++#define __cpuexitdata	__exitdata
    3.21 ++#endif
    3.22 ++
    3.23 + /* Functions marked as __devexit may be discarded at kernel link time, depending
    3.24 +    on config options.  Newer versions of binutils detect references from
    3.25 +    retained sections to discarded sections and flag an error.  Pointers to
    3.26 +diff -ur linux-2.6.12.orig/arch/x86_64/kernel/i387.c linux-2.6.12/arch/x86_64/kernel/i387.c
    3.27 +--- linux-2.6.12.orig/arch/x86_64/kernel/i387.c	2005-11-01 15:01:58.932991232 +0000
    3.28 ++++ linux-2.6.12/arch/x86_64/kernel/i387.c	2005-11-01 15:02:09.729312416 +0000
    3.29 +@@ -42,7 +42,7 @@
    3.30 +  * Called at bootup to set up the initial FPU state that is later cloned
    3.31 +  * into all processes.
    3.32 +  */
    3.33 +-void __init fpu_init(void)
    3.34 ++void __cpuinit fpu_init(void)
    3.35 + {
    3.36 + 	unsigned long oldcr0 = read_cr0();
    3.37 + 	extern void __bad_fxsave_alignment(void);