Commit e6982c67 authored by Ashok Raj's avatar Ashok Raj Committed by Linus Torvalds

[PATCH] x86_64: Change init sections for CPU hotplug support

This patch adds __cpuinit and __cpuinitdata sections that need to exist past
boot to support cpu hotplug.

Caveat: This is done *only* for EM64T CPU Hotplug support, on request from
Andi Kleen.  Much of the generic hotplug code in kernel, and none of the other
archs that support CPU hotplug today, i386, ia64, ppc64, s390 and parisc dont
mark sections with __cpuinit, but only mark them as __devinit, and
__devinitdata.

If someone is motivated to change generic code, we need to make sure all
existing hotplug code does not break, on other arch's that dont use __cpuinit,
and __cpudevinit.
Signed-off-by: default avatarAshok Raj <ashok.raj@intel.com>
Acked-by: default avatarAndi Kleen <ak@muc.de>
Acked-by: default avatarZwane Mwaikambo <zwane@arm.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 52a119fe
...@@ -285,7 +285,7 @@ void __init init_bsp_APIC(void) ...@@ -285,7 +285,7 @@ void __init init_bsp_APIC(void)
apic_write_around(APIC_LVT1, value); apic_write_around(APIC_LVT1, value);
} }
void __init setup_local_APIC (void) void __cpuinit setup_local_APIC (void)
{ {
unsigned int value, ver, maxlvt; unsigned int value, ver, maxlvt;
...@@ -534,7 +534,7 @@ static struct sys_device device_lapic = { ...@@ -534,7 +534,7 @@ static struct sys_device device_lapic = {
.cls = &lapic_sysclass, .cls = &lapic_sysclass,
}; };
static void __init apic_pm_activate(void) static void __cpuinit apic_pm_activate(void)
{ {
apic_pm_state.active = 1; apic_pm_state.active = 1;
} }
...@@ -774,14 +774,14 @@ void __init setup_boot_APIC_clock (void) ...@@ -774,14 +774,14 @@ void __init setup_boot_APIC_clock (void)
local_irq_enable(); local_irq_enable();
} }
void __init setup_secondary_APIC_clock(void) void __cpuinit setup_secondary_APIC_clock(void)
{ {
local_irq_disable(); /* FIXME: Do we need this? --RR */ local_irq_disable(); /* FIXME: Do we need this? --RR */
setup_APIC_timer(calibration_result); setup_APIC_timer(calibration_result);
local_irq_enable(); local_irq_enable();
} }
void __init disable_APIC_timer(void) void __cpuinit disable_APIC_timer(void)
{ {
if (using_apic_timer) { if (using_apic_timer) {
unsigned long v; unsigned long v;
......
...@@ -42,7 +42,7 @@ void mxcsr_feature_mask_init(void) ...@@ -42,7 +42,7 @@ void mxcsr_feature_mask_init(void)
* Called at bootup to set up the initial FPU state that is later cloned * Called at bootup to set up the initial FPU state that is later cloned
* into all processes. * into all processes.
*/ */
void __init fpu_init(void) void __cpuinit fpu_init(void)
{ {
unsigned long oldcr0 = read_cr0(); unsigned long oldcr0 = read_cr0();
extern void __bad_fxsave_alignment(void); extern void __bad_fxsave_alignment(void);
......
...@@ -327,7 +327,7 @@ static void mce_init(void *dummy) ...@@ -327,7 +327,7 @@ static void mce_init(void *dummy)
} }
/* Add per CPU specific workarounds here */ /* Add per CPU specific workarounds here */
static void __init mce_cpu_quirks(struct cpuinfo_x86 *c) static void __cpuinit mce_cpu_quirks(struct cpuinfo_x86 *c)
{ {
/* This should be disabled by the BIOS, but isn't always */ /* This should be disabled by the BIOS, but isn't always */
if (c->x86_vendor == X86_VENDOR_AMD && c->x86 == 15) { if (c->x86_vendor == X86_VENDOR_AMD && c->x86 == 15) {
...@@ -337,7 +337,7 @@ static void __init mce_cpu_quirks(struct cpuinfo_x86 *c) ...@@ -337,7 +337,7 @@ static void __init mce_cpu_quirks(struct cpuinfo_x86 *c)
} }
} }
static void __init mce_cpu_features(struct cpuinfo_x86 *c) static void __cpuinit mce_cpu_features(struct cpuinfo_x86 *c)
{ {
switch (c->x86_vendor) { switch (c->x86_vendor) {
case X86_VENDOR_INTEL: case X86_VENDOR_INTEL:
...@@ -352,7 +352,7 @@ static void __init mce_cpu_features(struct cpuinfo_x86 *c) ...@@ -352,7 +352,7 @@ static void __init mce_cpu_features(struct cpuinfo_x86 *c)
* Called for each booted CPU to set up machine checks. * Called for each booted CPU to set up machine checks.
* Must be called with preempt off. * Must be called with preempt off.
*/ */
void __init mcheck_init(struct cpuinfo_x86 *c) void __cpuinit mcheck_init(struct cpuinfo_x86 *c)
{ {
static cpumask_t mce_cpus __initdata = CPU_MASK_NONE; static cpumask_t mce_cpus __initdata = CPU_MASK_NONE;
...@@ -542,7 +542,7 @@ ACCESSOR(bank4ctl,bank[4],mce_restart()) ...@@ -542,7 +542,7 @@ ACCESSOR(bank4ctl,bank[4],mce_restart())
ACCESSOR(tolerant,tolerant,) ACCESSOR(tolerant,tolerant,)
ACCESSOR(check_interval,check_interval,mce_restart()) ACCESSOR(check_interval,check_interval,mce_restart())
static __init int mce_init_device(void) static __cpuinit int mce_init_device(void)
{ {
int err; int err;
if (!mce_available(&boot_cpu_data)) if (!mce_available(&boot_cpu_data))
......
...@@ -42,7 +42,7 @@ asmlinkage void smp_thermal_interrupt(void) ...@@ -42,7 +42,7 @@ asmlinkage void smp_thermal_interrupt(void)
irq_exit(); irq_exit();
} }
static void __init intel_init_thermal(struct cpuinfo_x86 *c) static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
{ {
u32 l, h; u32 l, h;
int tm2 = 0; int tm2 = 0;
...@@ -93,7 +93,7 @@ static void __init intel_init_thermal(struct cpuinfo_x86 *c) ...@@ -93,7 +93,7 @@ static void __init intel_init_thermal(struct cpuinfo_x86 *c)
return; return;
} }
void __init mce_intel_feature_init(struct cpuinfo_x86 *c) void __cpuinit mce_intel_feature_init(struct cpuinfo_x86 *c)
{ {
intel_init_thermal(c); intel_init_thermal(c);
} }
...@@ -98,7 +98,7 @@ static unsigned int nmi_p4_cccr_val; ...@@ -98,7 +98,7 @@ static unsigned int nmi_p4_cccr_val;
(P4_CCCR_OVF_PMI0|P4_CCCR_THRESHOLD(15)|P4_CCCR_COMPLEMENT| \ (P4_CCCR_OVF_PMI0|P4_CCCR_THRESHOLD(15)|P4_CCCR_COMPLEMENT| \
P4_CCCR_COMPARE|P4_CCCR_REQUIRED|P4_CCCR_ESCR_SELECT(4)|P4_CCCR_ENABLE) P4_CCCR_COMPARE|P4_CCCR_REQUIRED|P4_CCCR_ESCR_SELECT(4)|P4_CCCR_ENABLE)
static __init inline int nmi_known_cpu(void) static __cpuinit inline int nmi_known_cpu(void)
{ {
switch (boot_cpu_data.x86_vendor) { switch (boot_cpu_data.x86_vendor) {
case X86_VENDOR_AMD: case X86_VENDOR_AMD:
...@@ -110,7 +110,7 @@ static __init inline int nmi_known_cpu(void) ...@@ -110,7 +110,7 @@ static __init inline int nmi_known_cpu(void)
} }
/* Run after command line and cpu_init init, but before all other checks */ /* Run after command line and cpu_init init, but before all other checks */
void __init nmi_watchdog_default(void) void __cpuinit nmi_watchdog_default(void)
{ {
if (nmi_watchdog != NMI_DEFAULT) if (nmi_watchdog != NMI_DEFAULT)
return; return;
......
...@@ -204,7 +204,7 @@ static void mwait_idle(void) ...@@ -204,7 +204,7 @@ static void mwait_idle(void)
} }
} }
void __init select_idle_routine(const struct cpuinfo_x86 *c) void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
{ {
static int printed; static int printed;
if (cpu_has(c, X86_FEATURE_MWAIT)) { if (cpu_has(c, X86_FEATURE_MWAIT)) {
......
...@@ -676,7 +676,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -676,7 +676,7 @@ void __init setup_arch(char **cmdline_p)
#endif #endif
} }
static int __init get_model_name(struct cpuinfo_x86 *c) static int __cpuinit get_model_name(struct cpuinfo_x86 *c)
{ {
unsigned int *v; unsigned int *v;
...@@ -692,7 +692,7 @@ static int __init get_model_name(struct cpuinfo_x86 *c) ...@@ -692,7 +692,7 @@ static int __init get_model_name(struct cpuinfo_x86 *c)
} }
static void __init display_cacheinfo(struct cpuinfo_x86 *c) static void __cpuinit display_cacheinfo(struct cpuinfo_x86 *c)
{ {
unsigned int n, dummy, eax, ebx, ecx, edx; unsigned int n, dummy, eax, ebx, ecx, edx;
...@@ -803,7 +803,7 @@ static int __init init_amd(struct cpuinfo_x86 *c) ...@@ -803,7 +803,7 @@ static int __init init_amd(struct cpuinfo_x86 *c)
return r; return r;
} }
static void __init detect_ht(struct cpuinfo_x86 *c) static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
u32 eax, ebx, ecx, edx; u32 eax, ebx, ecx, edx;
...@@ -864,7 +864,7 @@ static void __init detect_ht(struct cpuinfo_x86 *c) ...@@ -864,7 +864,7 @@ static void __init detect_ht(struct cpuinfo_x86 *c)
/* /*
* find out the number of processor cores on the die * find out the number of processor cores on the die
*/ */
static int __init intel_num_cpu_cores(struct cpuinfo_x86 *c) static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
{ {
unsigned int eax; unsigned int eax;
...@@ -882,7 +882,7 @@ static int __init intel_num_cpu_cores(struct cpuinfo_x86 *c) ...@@ -882,7 +882,7 @@ static int __init intel_num_cpu_cores(struct cpuinfo_x86 *c)
return 1; return 1;
} }
static void __init init_intel(struct cpuinfo_x86 *c) static void __cpuinit init_intel(struct cpuinfo_x86 *c)
{ {
/* Cache sizes */ /* Cache sizes */
unsigned n; unsigned n;
...@@ -902,7 +902,7 @@ static void __init init_intel(struct cpuinfo_x86 *c) ...@@ -902,7 +902,7 @@ static void __init init_intel(struct cpuinfo_x86 *c)
c->x86_num_cores = intel_num_cpu_cores(c); c->x86_num_cores = intel_num_cpu_cores(c);
} }
void __init get_cpu_vendor(struct cpuinfo_x86 *c) void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c)
{ {
char *v = c->x86_vendor_id; char *v = c->x86_vendor_id;
...@@ -923,7 +923,7 @@ struct cpu_model_info { ...@@ -923,7 +923,7 @@ struct cpu_model_info {
/* Do some early cpuid on the boot CPU to get some parameter that are /* Do some early cpuid on the boot CPU to get some parameter that are
needed before check_bugs. Everything advanced is in identify_cpu needed before check_bugs. Everything advanced is in identify_cpu
below. */ below. */
void __init early_identify_cpu(struct cpuinfo_x86 *c) void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
{ {
u32 tfms; u32 tfms;
...@@ -977,7 +977,7 @@ void __init early_identify_cpu(struct cpuinfo_x86 *c) ...@@ -977,7 +977,7 @@ void __init early_identify_cpu(struct cpuinfo_x86 *c)
/* /*
* This does the hard work of actually picking apart the CPU stuff... * This does the hard work of actually picking apart the CPU stuff...
*/ */
void __init identify_cpu(struct cpuinfo_x86 *c) void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
{ {
int i; int i;
u32 xlvl; u32 xlvl;
...@@ -1054,7 +1054,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c) ...@@ -1054,7 +1054,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c)
} }
void __init print_cpu_info(struct cpuinfo_x86 *c) void __cpuinit print_cpu_info(struct cpuinfo_x86 *c)
{ {
if (c->x86_model_id[0]) if (c->x86_model_id[0])
printk("%s", c->x86_model_id); printk("%s", c->x86_model_id);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
cpumask_t cpu_initialized __initdata = CPU_MASK_NONE; cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned;
...@@ -171,7 +171,7 @@ void syscall_init(void) ...@@ -171,7 +171,7 @@ void syscall_init(void)
wrmsrl(MSR_SYSCALL_MASK, EF_TF|EF_DF|EF_IE|0x3000); wrmsrl(MSR_SYSCALL_MASK, EF_TF|EF_DF|EF_IE|0x3000);
} }
void __init check_efer(void) void __cpuinit check_efer(void)
{ {
unsigned long efer; unsigned long efer;
...@@ -188,7 +188,7 @@ void __init check_efer(void) ...@@ -188,7 +188,7 @@ void __init check_efer(void)
* 'CPU state barrier', nothing should get across. * 'CPU state barrier', nothing should get across.
* A lot of state is already set up in PDA init. * A lot of state is already set up in PDA init.
*/ */
void __init cpu_init (void) void __cpuinit cpu_init (void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
int cpu = stack_smp_processor_id(); int cpu = stack_smp_processor_id();
......
...@@ -58,11 +58,6 @@ ...@@ -58,11 +58,6 @@
#include <asm/proto.h> #include <asm/proto.h>
#include <asm/nmi.h> #include <asm/nmi.h>
/* Change for real CPU hotplug. Note other files need to be fixed
first too. */
#define __cpuinit __init
#define __cpuinitdata __initdata
/* Number of siblings per CPU package */ /* Number of siblings per CPU package */
int smp_num_siblings = 1; int smp_num_siblings = 1;
/* Package ID of each logical CPU */ /* Package ID of each logical CPU */
...@@ -823,7 +818,7 @@ static __cpuinit void smp_cleanup_boot(void) ...@@ -823,7 +818,7 @@ static __cpuinit void smp_cleanup_boot(void)
* *
* RED-PEN audit/test this more. I bet there is more state messed up here. * RED-PEN audit/test this more. I bet there is more state messed up here.
*/ */
static __cpuinit void disable_smp(void) static __init void disable_smp(void)
{ {
cpu_present_map = cpumask_of_cpu(0); cpu_present_map = cpumask_of_cpu(0);
cpu_possible_map = cpumask_of_cpu(0); cpu_possible_map = cpumask_of_cpu(0);
...@@ -838,7 +833,7 @@ static __cpuinit void disable_smp(void) ...@@ -838,7 +833,7 @@ static __cpuinit void disable_smp(void)
/* /*
* Handle user cpus=... parameter. * Handle user cpus=... parameter.
*/ */
static __cpuinit void enforce_max_cpus(unsigned max_cpus) static __init void enforce_max_cpus(unsigned max_cpus)
{ {
int i, k; int i, k;
k = 0; k = 0;
...@@ -855,7 +850,7 @@ static __cpuinit void enforce_max_cpus(unsigned max_cpus) ...@@ -855,7 +850,7 @@ static __cpuinit void enforce_max_cpus(unsigned max_cpus)
/* /*
* Various sanity checks. * Various sanity checks.
*/ */
static int __cpuinit smp_sanity_check(unsigned max_cpus) static int __init smp_sanity_check(unsigned max_cpus)
{ {
if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) { if (!physid_isset(hard_smp_processor_id(), phys_cpu_present_map)) {
printk("weird, boot CPU (#%d) not listed by the BIOS.\n", printk("weird, boot CPU (#%d) not listed by the BIOS.\n",
...@@ -913,7 +908,7 @@ static int __cpuinit smp_sanity_check(unsigned max_cpus) ...@@ -913,7 +908,7 @@ static int __cpuinit smp_sanity_check(unsigned max_cpus)
* Prepare for SMP bootup. The MP table or ACPI has been read * Prepare for SMP bootup. The MP table or ACPI has been read
* earlier. Just do some sanity checking here and enable APIC mode. * earlier. Just do some sanity checking here and enable APIC mode.
*/ */
void __cpuinit smp_prepare_cpus(unsigned int max_cpus) void __init smp_prepare_cpus(unsigned int max_cpus)
{ {
int i; int i;
...@@ -1019,7 +1014,7 @@ int __cpuinit __cpu_up(unsigned int cpu) ...@@ -1019,7 +1014,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
/* /*
* Finish the SMP boot. * Finish the SMP boot.
*/ */
void __cpuinit smp_cpus_done(unsigned int max_cpus) void __init smp_cpus_done(unsigned int max_cpus)
{ {
zap_low_mappings(); zap_low_mappings();
smp_cleanup_boot(); smp_cleanup_boot();
......
...@@ -251,7 +251,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn) ...@@ -251,7 +251,7 @@ void __init numa_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
setup_node_bootmem(0, start_pfn << PAGE_SHIFT, end_pfn << PAGE_SHIFT); setup_node_bootmem(0, start_pfn << PAGE_SHIFT, end_pfn << PAGE_SHIFT);
} }
__init void numa_add_cpu(int cpu) __cpuinit void numa_add_cpu(int cpu)
{ {
/* BP is initialized elsewhere */ /* BP is initialized elsewhere */
if (cpu) if (cpu)
......
...@@ -229,6 +229,18 @@ void __init parse_early_param(void); ...@@ -229,6 +229,18 @@ void __init parse_early_param(void);
#define __devexitdata __exitdata #define __devexitdata __exitdata
#endif #endif
#ifdef CONFIG_HOTPLUG_CPU
#define __cpuinit
#define __cpuinitdata
#define __cpuexit
#define __cpuexitdata
#else
#define __cpuinit __init
#define __cpuinitdata __initdata
#define __cpuexit __exit
#define __cpuexitdata __exitdata
#endif
/* Functions marked as __devexit may be discarded at kernel link time, depending /* Functions marked as __devexit may be discarded at kernel link time, depending
on config options. Newer versions of binutils detect references from on config options. Newer versions of binutils detect references from
retained sections to discarded sections and flag an error. Pointers to retained sections to discarded sections and flag an error. Pointers to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment