diff options
130 files changed, 315 insertions, 1597 deletions
diff --git a/arch/Kconfig b/arch/Kconfig index 684eb5af439d..597b132b3902 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -145,6 +145,13 @@ config HAVE_DMA_ATTRS | |||
145 | config USE_GENERIC_SMP_HELPERS | 145 | config USE_GENERIC_SMP_HELPERS |
146 | bool | 146 | bool |
147 | 147 | ||
148 | config GENERIC_SMP_IDLE_THREAD | ||
149 | bool | ||
150 | |||
151 | # Select if arch init_task initializer is different to init/init_task.c | ||
152 | config ARCH_INIT_TASK | ||
153 | bool | ||
154 | |||
148 | config HAVE_REGS_AND_STACK_ACCESS_API | 155 | config HAVE_REGS_AND_STACK_ACCESS_API |
149 | bool | 156 | bool |
150 | help | 157 | help |
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 56a4df952fb0..991b8bbff4ff 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -15,6 +15,7 @@ config ALPHA | |||
15 | select GENERIC_IRQ_SHOW | 15 | select GENERIC_IRQ_SHOW |
16 | select ARCH_WANT_OPTIONAL_GPIOLIB | 16 | select ARCH_WANT_OPTIONAL_GPIOLIB |
17 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 17 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
18 | select GENERIC_SMP_IDLE_THREAD | ||
18 | help | 19 | help |
19 | The Alpha is a 64-bit general-purpose processor designed and | 20 | The Alpha is a 64-bit general-purpose processor designed and |
20 | marketed by the Digital Equipment Corporation of blessed memory, | 21 | marketed by the Digital Equipment Corporation of blessed memory, |
diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile index 7a6d908bb865..84ec46b38f7d 100644 --- a/arch/alpha/kernel/Makefile +++ b/arch/alpha/kernel/Makefile | |||
@@ -6,7 +6,7 @@ extra-y := head.o vmlinux.lds | |||
6 | asflags-y := $(KBUILD_CFLAGS) | 6 | asflags-y := $(KBUILD_CFLAGS) |
7 | ccflags-y := -Wno-sign-compare | 7 | ccflags-y := -Wno-sign-compare |
8 | 8 | ||
9 | obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ | 9 | obj-y := entry.o traps.o process.o osf_sys.o irq.o \ |
10 | irq_alpha.o signal.o setup.o ptrace.o time.o \ | 10 | irq_alpha.o signal.o setup.o ptrace.o time.o \ |
11 | alpha_ksyms.o systbls.o err_common.o io.o | 11 | alpha_ksyms.o systbls.o err_common.o io.o |
12 | 12 | ||
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index 50d438db1f6b..35ddc02bfa4a 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c | |||
@@ -357,24 +357,10 @@ secondary_cpu_start(int cpuid, struct task_struct *idle) | |||
357 | * Bring one cpu online. | 357 | * Bring one cpu online. |
358 | */ | 358 | */ |
359 | static int __cpuinit | 359 | static int __cpuinit |
360 | smp_boot_one_cpu(int cpuid) | 360 | smp_boot_one_cpu(int cpuid, struct task_struct *idle) |
361 | { | 361 | { |
362 | struct task_struct *idle; | ||
363 | unsigned long timeout; | 362 | unsigned long timeout; |
364 | 363 | ||
365 | /* Cook up an idler for this guy. Note that the address we | ||
366 | give to kernel_thread is irrelevant -- it's going to start | ||
367 | where HWRPB.CPU_restart says to start. But this gets all | ||
368 | the other task-y sort of data structures set up like we | ||
369 | wish. We can't use kernel_thread since we must avoid | ||
370 | rescheduling the child. */ | ||
371 | idle = fork_idle(cpuid); | ||
372 | if (IS_ERR(idle)) | ||
373 | panic("failed fork for CPU %d", cpuid); | ||
374 | |||
375 | DBGS(("smp_boot_one_cpu: CPU %d state 0x%lx flags 0x%lx\n", | ||
376 | cpuid, idle->state, idle->flags)); | ||
377 | |||
378 | /* Signal the secondary to wait a moment. */ | 364 | /* Signal the secondary to wait a moment. */ |
379 | smp_secondary_alive = -1; | 365 | smp_secondary_alive = -1; |
380 | 366 | ||
@@ -487,9 +473,9 @@ smp_prepare_boot_cpu(void) | |||
487 | } | 473 | } |
488 | 474 | ||
489 | int __cpuinit | 475 | int __cpuinit |
490 | __cpu_up(unsigned int cpu) | 476 | __cpu_up(unsigned int cpu, struct task_struct *tidle) |
491 | { | 477 | { |
492 | smp_boot_one_cpu(cpu); | 478 | smp_boot_one_cpu(cpu, tidle); |
493 | 479 | ||
494 | return cpu_online(cpu) ? 0 : -ENOSYS; | 480 | return cpu_online(cpu) ? 0 : -ENOSYS; |
495 | } | 481 | } |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 36586dba6fa6..69145df47fef 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -34,6 +34,7 @@ config ARM | |||
34 | select CPU_PM if (SUSPEND || CPU_IDLE) | 34 | select CPU_PM if (SUSPEND || CPU_IDLE) |
35 | select GENERIC_PCI_IOMAP | 35 | select GENERIC_PCI_IOMAP |
36 | select HAVE_BPF_JIT if NET | 36 | select HAVE_BPF_JIT if NET |
37 | select GENERIC_SMP_IDLE_THREAD | ||
37 | help | 38 | help |
38 | The ARM series is a line of low-power-consumption RISC chip designs | 39 | The ARM series is a line of low-power-consumption RISC chip designs |
39 | licensed by ARM Ltd and targeted at embedded applications and | 40 | licensed by ARM Ltd and targeted at embedded applications and |
@@ -159,9 +160,6 @@ config ARCH_HAS_CPUFREQ | |||
159 | and that the relevant menu configurations are displayed for | 160 | and that the relevant menu configurations are displayed for |
160 | it. | 161 | it. |
161 | 162 | ||
162 | config ARCH_HAS_CPU_IDLE_WAIT | ||
163 | def_bool y | ||
164 | |||
165 | config GENERIC_HWEIGHT | 163 | config GENERIC_HWEIGHT |
166 | bool | 164 | bool |
167 | default y | 165 | default y |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 047a20780fc1..cf945094f8d0 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -119,7 +119,7 @@ KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/ | |||
119 | CHECKFLAGS += -D__arm__ | 119 | CHECKFLAGS += -D__arm__ |
120 | 120 | ||
121 | #Default value | 121 | #Default value |
122 | head-y := arch/arm/kernel/head$(MMUEXT).o arch/arm/kernel/init_task.o | 122 | head-y := arch/arm/kernel/head$(MMUEXT).o |
123 | textofs-y := 0x00008000 | 123 | textofs-y := 0x00008000 |
124 | textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000 | 124 | textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000 |
125 | # We don't want the htc bootloader to corrupt kernel during resume | 125 | # We don't want the htc bootloader to corrupt kernel during resume |
diff --git a/arch/arm/include/asm/cpu.h b/arch/arm/include/asm/cpu.h index 793968173bef..d797223b39d5 100644 --- a/arch/arm/include/asm/cpu.h +++ b/arch/arm/include/asm/cpu.h | |||
@@ -16,7 +16,6 @@ | |||
16 | struct cpuinfo_arm { | 16 | struct cpuinfo_arm { |
17 | struct cpu cpu; | 17 | struct cpu cpu; |
18 | #ifdef CONFIG_SMP | 18 | #ifdef CONFIG_SMP |
19 | struct task_struct *idle; | ||
20 | unsigned int loops_per_jiffy; | 19 | unsigned int loops_per_jiffy; |
21 | #endif | 20 | #endif |
22 | }; | 21 | }; |
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h index 5ac8d3d3e025..d7038fa22343 100644 --- a/arch/arm/include/asm/processor.h +++ b/arch/arm/include/asm/processor.h | |||
@@ -88,8 +88,6 @@ unsigned long get_wchan(struct task_struct *p); | |||
88 | #define cpu_relax() barrier() | 88 | #define cpu_relax() barrier() |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | void cpu_idle_wait(void); | ||
92 | |||
93 | /* | 91 | /* |
94 | * Create a new kernel thread | 92 | * Create a new kernel thread |
95 | */ | 93 | */ |
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 7b787d642af4..369985e4bed5 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -81,4 +81,4 @@ head-y := head$(MMUEXT).o | |||
81 | obj-$(CONFIG_DEBUG_LL) += debug.o | 81 | obj-$(CONFIG_DEBUG_LL) += debug.o |
82 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 82 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
83 | 83 | ||
84 | extra-y := $(head-y) init_task.o vmlinux.lds | 84 | extra-y := $(head-y) vmlinux.lds |
diff --git a/arch/arm/kernel/init_task.c b/arch/arm/kernel/init_task.c deleted file mode 100644 index e7cbb50dc356..000000000000 --- a/arch/arm/kernel/init_task.c +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/kernel/init_task.c | ||
3 | */ | ||
4 | #include <linux/mm.h> | ||
5 | #include <linux/module.h> | ||
6 | #include <linux/fs.h> | ||
7 | #include <linux/sched.h> | ||
8 | #include <linux/init.h> | ||
9 | #include <linux/init_task.h> | ||
10 | #include <linux/mqueue.h> | ||
11 | #include <linux/uaccess.h> | ||
12 | |||
13 | #include <asm/pgtable.h> | ||
14 | |||
15 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
16 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
17 | /* | ||
18 | * Initial thread structure. | ||
19 | * | ||
20 | * We need to make sure that this is 8192-byte aligned due to the | ||
21 | * way process stacks are handled. This is done by making sure | ||
22 | * the linker maps this in the .text segment right after head.S, | ||
23 | * and making head.S ensure the proper alignment. | ||
24 | * | ||
25 | * The things we do for performance.. | ||
26 | */ | ||
27 | union thread_union init_thread_union __init_task_data = | ||
28 | { INIT_THREAD_INFO(init_task) }; | ||
29 | |||
30 | /* | ||
31 | * Initial task structure. | ||
32 | * | ||
33 | * All other task structs will be allocated on slabs in fork.c | ||
34 | */ | ||
35 | struct task_struct init_task = INIT_TASK(init_task); | ||
36 | |||
37 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 2b7b017a20cd..19c95ea65b2f 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -157,26 +157,6 @@ EXPORT_SYMBOL(pm_power_off); | |||
157 | void (*arm_pm_restart)(char str, const char *cmd) = null_restart; | 157 | void (*arm_pm_restart)(char str, const char *cmd) = null_restart; |
158 | EXPORT_SYMBOL_GPL(arm_pm_restart); | 158 | EXPORT_SYMBOL_GPL(arm_pm_restart); |
159 | 159 | ||
160 | static void do_nothing(void *unused) | ||
161 | { | ||
162 | } | ||
163 | |||
164 | /* | ||
165 | * cpu_idle_wait - Used to ensure that all the CPUs discard old value of | ||
166 | * pm_idle and update to new pm_idle value. Required while changing pm_idle | ||
167 | * handler on SMP systems. | ||
168 | * | ||
169 | * Caller must have changed pm_idle to the new value before the call. Old | ||
170 | * pm_idle value will not be used by any CPU after the return of this function. | ||
171 | */ | ||
172 | void cpu_idle_wait(void) | ||
173 | { | ||
174 | smp_mb(); | ||
175 | /* kick all the CPUs so that they exit out of pm_idle */ | ||
176 | smp_call_function(do_nothing, NULL, 1); | ||
177 | } | ||
178 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | ||
179 | |||
180 | /* | 160 | /* |
181 | * This is our default idle handler. | 161 | * This is our default idle handler. |
182 | */ | 162 | */ |
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index f6a4d32b0421..e8d7b1afa033 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
@@ -60,32 +60,11 @@ enum ipi_msg_type { | |||
60 | 60 | ||
61 | static DECLARE_COMPLETION(cpu_running); | 61 | static DECLARE_COMPLETION(cpu_running); |
62 | 62 | ||
63 | int __cpuinit __cpu_up(unsigned int cpu) | 63 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) |
64 | { | 64 | { |
65 | struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu); | ||
66 | struct task_struct *idle = ci->idle; | ||
67 | int ret; | 65 | int ret; |
68 | 66 | ||
69 | /* | 67 | /* |
70 | * Spawn a new process manually, if not already done. | ||
71 | * Grab a pointer to its task struct so we can mess with it | ||
72 | */ | ||
73 | if (!idle) { | ||
74 | idle = fork_idle(cpu); | ||
75 | if (IS_ERR(idle)) { | ||
76 | printk(KERN_ERR "CPU%u: fork() failed\n", cpu); | ||
77 | return PTR_ERR(idle); | ||
78 | } | ||
79 | ci->idle = idle; | ||
80 | } else { | ||
81 | /* | ||
82 | * Since this idle thread is being re-used, call | ||
83 | * init_idle() to reinitialize the thread structure. | ||
84 | */ | ||
85 | init_idle(idle, cpu); | ||
86 | } | ||
87 | |||
88 | /* | ||
89 | * We need to tell the secondary core where to find | 68 | * We need to tell the secondary core where to find |
90 | * its stack and the page tables. | 69 | * its stack and the page tables. |
91 | */ | 70 | */ |
@@ -318,9 +297,6 @@ void __init smp_cpus_done(unsigned int max_cpus) | |||
318 | 297 | ||
319 | void __init smp_prepare_boot_cpu(void) | 298 | void __init smp_prepare_boot_cpu(void) |
320 | { | 299 | { |
321 | unsigned int cpu = smp_processor_id(); | ||
322 | |||
323 | per_cpu(cpu_data, cpu).idle = current; | ||
324 | } | 300 | } |
325 | 301 | ||
326 | void __init smp_prepare_cpus(unsigned int max_cpus) | 302 | void __init smp_prepare_cpus(unsigned int max_cpus) |
diff --git a/arch/avr32/kernel/Makefile b/arch/avr32/kernel/Makefile index 18229d0d1861..9e2c465ef3a6 100644 --- a/arch/avr32/kernel/Makefile +++ b/arch/avr32/kernel/Makefile | |||
@@ -8,7 +8,7 @@ obj-$(CONFIG_SUBARCH_AVR32B) += entry-avr32b.o | |||
8 | obj-y += syscall_table.o syscall-stubs.o irq.o | 8 | obj-y += syscall_table.o syscall-stubs.o irq.o |
9 | obj-y += setup.o traps.o ocd.o ptrace.o | 9 | obj-y += setup.o traps.o ocd.o ptrace.o |
10 | obj-y += signal.o sys_avr32.o process.o time.o | 10 | obj-y += signal.o sys_avr32.o process.o time.o |
11 | obj-y += init_task.o switch_to.o cpu.o | 11 | obj-y += switch_to.o cpu.o |
12 | obj-$(CONFIG_MODULES) += module.o avr32_ksyms.o | 12 | obj-$(CONFIG_MODULES) += module.o avr32_ksyms.o |
13 | obj-$(CONFIG_KPROBES) += kprobes.o | 13 | obj-$(CONFIG_KPROBES) += kprobes.o |
14 | obj-$(CONFIG_STACKTRACE) += stacktrace.o | 14 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
diff --git a/arch/avr32/kernel/init_task.c b/arch/avr32/kernel/init_task.c deleted file mode 100644 index 6b2343e6fe33..000000000000 --- a/arch/avr32/kernel/init_task.c +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #include <linux/module.h> | ||
9 | #include <linux/fs.h> | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/init_task.h> | ||
12 | #include <linux/mqueue.h> | ||
13 | |||
14 | #include <asm/pgtable.h> | ||
15 | |||
16 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
17 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
18 | /* | ||
19 | * Initial thread structure. Must be aligned on an 8192-byte boundary. | ||
20 | */ | ||
21 | union thread_union init_thread_union __init_task_data = | ||
22 | { INIT_THREAD_INFO(init_task) }; | ||
23 | |||
24 | /* | ||
25 | * Initial task structure. | ||
26 | * | ||
27 | * All other task structs will be allocated on slabs in fork.c | ||
28 | */ | ||
29 | struct task_struct init_task = INIT_TASK(init_task); | ||
30 | |||
31 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index 373a6902d8fa..779b9c846fd7 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -37,6 +37,7 @@ config BLACKFIN | |||
37 | select GENERIC_IRQ_PROBE | 37 | select GENERIC_IRQ_PROBE |
38 | select IRQ_PER_CPU if SMP | 38 | select IRQ_PER_CPU if SMP |
39 | select HAVE_NMI_WATCHDOG if NMI_WATCHDOG | 39 | select HAVE_NMI_WATCHDOG if NMI_WATCHDOG |
40 | select GENERIC_SMP_IDLE_THREAD | ||
40 | 41 | ||
41 | config GENERIC_CSUM | 42 | config GENERIC_CSUM |
42 | def_bool y | 43 | def_bool y |
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile index 46f42b2066e5..290949679cec 100644 --- a/arch/blackfin/Makefile +++ b/arch/blackfin/Makefile | |||
@@ -107,8 +107,6 @@ KBUILD_AFLAGS += -mcpu=$(CPU_REV) | |||
107 | CHECKFLAGS_SILICON = $(shell echo "" | $(CPP) $(KBUILD_CFLAGS) -dD - 2>/dev/null | awk '$$2 == "__SILICON_REVISION__" { print $$3 }') | 107 | CHECKFLAGS_SILICON = $(shell echo "" | $(CPP) $(KBUILD_CFLAGS) -dD - 2>/dev/null | awk '$$2 == "__SILICON_REVISION__" { print $$3 }') |
108 | CHECKFLAGS += -D__SILICON_REVISION__=$(CHECKFLAGS_SILICON) -D__bfin__ | 108 | CHECKFLAGS += -D__SILICON_REVISION__=$(CHECKFLAGS_SILICON) -D__bfin__ |
109 | 109 | ||
110 | head-y := arch/$(ARCH)/kernel/init_task.o | ||
111 | |||
112 | core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ arch/$(ARCH)/mach-common/ | 110 | core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ arch/$(ARCH)/mach-common/ |
113 | 111 | ||
114 | # If we have a machine-specific directory, then include it in the build. | 112 | # If we have a machine-specific directory, then include it in the build. |
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile index 9a0d6d706443..08e6625106be 100644 --- a/arch/blackfin/kernel/Makefile +++ b/arch/blackfin/kernel/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # arch/blackfin/kernel/Makefile | 2 | # arch/blackfin/kernel/Makefile |
3 | # | 3 | # |
4 | 4 | ||
5 | extra-y := init_task.o vmlinux.lds | 5 | extra-y := vmlinux.lds |
6 | 6 | ||
7 | obj-y := \ | 7 | obj-y := \ |
8 | entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \ | 8 | entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \ |
diff --git a/arch/blackfin/kernel/init_task.c b/arch/blackfin/kernel/init_task.c deleted file mode 100644 index d3970e8acd1a..000000000000 --- a/arch/blackfin/kernel/init_task.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2004-2009 Analog Devices Inc. | ||
3 | * | ||
4 | * Licensed under the GPL-2 or later | ||
5 | */ | ||
6 | |||
7 | #include <linux/mm.h> | ||
8 | #include <linux/module.h> | ||
9 | #include <linux/init_task.h> | ||
10 | #include <linux/mqueue.h> | ||
11 | #include <linux/fs.h> | ||
12 | |||
13 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
14 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
15 | /* | ||
16 | * Initial task structure. | ||
17 | * | ||
18 | * All other task structs will be allocated on slabs in fork.c | ||
19 | */ | ||
20 | struct task_struct init_task = INIT_TASK(init_task); | ||
21 | EXPORT_SYMBOL(init_task); | ||
22 | |||
23 | /* | ||
24 | * Initial thread structure. | ||
25 | * | ||
26 | * We need to make sure that this is 8192-byte aligned due to the | ||
27 | * way process stacks are handled. This is done by having a special | ||
28 | * "init_task" linker map entry. | ||
29 | */ | ||
30 | union thread_union init_thread_union | ||
31 | __init_task_data = { | ||
32 | INIT_THREAD_INFO(init_task)}; | ||
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c index ac8f8a43158c..00bbe672b3b3 100644 --- a/arch/blackfin/mach-common/smp.c +++ b/arch/blackfin/mach-common/smp.c | |||
@@ -340,27 +340,10 @@ void smp_send_stop(void) | |||
340 | return; | 340 | return; |
341 | } | 341 | } |
342 | 342 | ||
343 | int __cpuinit __cpu_up(unsigned int cpu) | 343 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) |
344 | { | 344 | { |
345 | int ret; | 345 | int ret; |
346 | struct blackfin_cpudata *ci = &per_cpu(cpu_data, cpu); | ||
347 | struct task_struct *idle = ci->idle; | ||
348 | 346 | ||
349 | if (idle) { | ||
350 | free_task(idle); | ||
351 | idle = NULL; | ||
352 | } | ||
353 | |||
354 | if (!idle) { | ||
355 | idle = fork_idle(cpu); | ||
356 | if (IS_ERR(idle)) { | ||
357 | printk(KERN_ERR "CPU%u: fork() failed\n", cpu); | ||
358 | return PTR_ERR(idle); | ||
359 | } | ||
360 | ci->idle = idle; | ||
361 | } else { | ||
362 | init_idle(idle, cpu); | ||
363 | } | ||
364 | secondary_stack = task_stack_page(idle) + THREAD_SIZE; | 347 | secondary_stack = task_stack_page(idle) + THREAD_SIZE; |
365 | 348 | ||
366 | ret = platform_boot_secondary(cpu, idle); | 349 | ret = platform_boot_secondary(cpu, idle); |
diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c index 7ca8c41b03cd..45e924a636a0 100644 --- a/arch/c6x/kernel/process.c +++ b/arch/c6x/kernel/process.c | |||
@@ -26,22 +26,6 @@ void (*c6x_halt)(void); | |||
26 | 26 | ||
27 | extern asmlinkage void ret_from_fork(void); | 27 | extern asmlinkage void ret_from_fork(void); |
28 | 28 | ||
29 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
30 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
31 | |||
32 | /* | ||
33 | * Initial thread structure. | ||
34 | */ | ||
35 | union thread_union init_thread_union __init_task_data = { | ||
36 | INIT_THREAD_INFO(init_task) | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * Initial task structure. | ||
41 | */ | ||
42 | struct task_struct init_task = INIT_TASK(init_task); | ||
43 | EXPORT_SYMBOL(init_task); | ||
44 | |||
45 | /* | 29 | /* |
46 | * power off function, if any | 30 | * power off function, if any |
47 | */ | 31 | */ |
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index b3abfb08aa5c..2995035812ec 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig | |||
@@ -49,6 +49,7 @@ config CRIS | |||
49 | select HAVE_GENERIC_HARDIRQS | 49 | select HAVE_GENERIC_HARDIRQS |
50 | select GENERIC_IRQ_SHOW | 50 | select GENERIC_IRQ_SHOW |
51 | select GENERIC_IOMAP | 51 | select GENERIC_IOMAP |
52 | select GENERIC_SMP_IDLE_THREAD if ETRAX_ARCH_V32 | ||
52 | 53 | ||
53 | config HZ | 54 | config HZ |
54 | int | 55 | int |
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c index 0b99df72d2a4..ebe2cb30bd11 100644 --- a/arch/cris/arch-v32/kernel/smp.c +++ b/arch/cris/arch-v32/kernel/smp.c | |||
@@ -108,17 +108,12 @@ void __init smp_cpus_done(unsigned int max_cpus) | |||
108 | 108 | ||
109 | /* Bring one cpu online.*/ | 109 | /* Bring one cpu online.*/ |
110 | static int __init | 110 | static int __init |
111 | smp_boot_one_cpu(int cpuid) | 111 | smp_boot_one_cpu(int cpuid, struct task_struct idle) |
112 | { | 112 | { |
113 | unsigned timeout; | 113 | unsigned timeout; |
114 | struct task_struct *idle; | ||
115 | cpumask_t cpu_mask; | 114 | cpumask_t cpu_mask; |
116 | 115 | ||
117 | cpumask_clear(&cpu_mask); | 116 | cpumask_clear(&cpu_mask); |
118 | idle = fork_idle(cpuid); | ||
119 | if (IS_ERR(idle)) | ||
120 | panic("SMP: fork failed for CPU:%d", cpuid); | ||
121 | |||
122 | task_thread_info(idle)->cpu = cpuid; | 117 | task_thread_info(idle)->cpu = cpuid; |
123 | 118 | ||
124 | /* Information to the CPU that is about to boot */ | 119 | /* Information to the CPU that is about to boot */ |
@@ -142,9 +137,6 @@ smp_boot_one_cpu(int cpuid) | |||
142 | barrier(); | 137 | barrier(); |
143 | } | 138 | } |
144 | 139 | ||
145 | put_task_struct(idle); | ||
146 | idle = NULL; | ||
147 | |||
148 | printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid); | 140 | printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid); |
149 | return -1; | 141 | return -1; |
150 | } | 142 | } |
@@ -207,9 +199,9 @@ int setup_profiling_timer(unsigned int multiplier) | |||
207 | */ | 199 | */ |
208 | unsigned long cache_decay_ticks = 1; | 200 | unsigned long cache_decay_ticks = 1; |
209 | 201 | ||
210 | int __cpuinit __cpu_up(unsigned int cpu) | 202 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) |
211 | { | 203 | { |
212 | smp_boot_one_cpu(cpu); | 204 | smp_boot_one_cpu(cpu, tidle); |
213 | return cpu_online(cpu) ? 0 : -ENOSYS; | 205 | return cpu_online(cpu) ? 0 : -ENOSYS; |
214 | } | 206 | } |
215 | 207 | ||
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c index 891dad85e8bd..66fd01728790 100644 --- a/arch/cris/kernel/process.c +++ b/arch/cris/kernel/process.c | |||
@@ -29,34 +29,6 @@ | |||
29 | //#define DEBUG | 29 | //#define DEBUG |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Initial task structure. Make this a per-architecture thing, | ||
33 | * because different architectures tend to have different | ||
34 | * alignment requirements and potentially different initial | ||
35 | * setup. | ||
36 | */ | ||
37 | |||
38 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
39 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
40 | /* | ||
41 | * Initial thread structure. | ||
42 | * | ||
43 | * We need to make sure that this is 8192-byte aligned due to the | ||
44 | * way process stacks are handled. This is done by having a special | ||
45 | * "init_task" linker map entry.. | ||
46 | */ | ||
47 | union thread_union init_thread_union __init_task_data = | ||
48 | { INIT_THREAD_INFO(init_task) }; | ||
49 | |||
50 | /* | ||
51 | * Initial task structure. | ||
52 | * | ||
53 | * All other task structs will be allocated on slabs in fork.c | ||
54 | */ | ||
55 | struct task_struct init_task = INIT_TASK(init_task); | ||
56 | |||
57 | EXPORT_SYMBOL(init_task); | ||
58 | |||
59 | /* | ||
60 | * The hlt_counter, disable_hlt and enable_hlt is just here as a hook if | 32 | * The hlt_counter, disable_hlt and enable_hlt is just here as a hook if |
61 | * there would ever be a halt sequence (for power save when idle) with | 33 | * there would ever be a halt sequence (for power save when idle) with |
62 | * some largish delay when halting or resuming *and* a driver that can't | 34 | * some largish delay when halting or resuming *and* a driver that can't |
diff --git a/arch/frv/Makefile b/arch/frv/Makefile index 7ff84575b186..4d1b1e9baef1 100644 --- a/arch/frv/Makefile +++ b/arch/frv/Makefile | |||
@@ -81,7 +81,7 @@ ifdef CONFIG_DEBUG_INFO | |||
81 | KBUILD_AFLAGS += -Wa,--gdwarf2 | 81 | KBUILD_AFLAGS += -Wa,--gdwarf2 |
82 | endif | 82 | endif |
83 | 83 | ||
84 | head-y := arch/frv/kernel/head.o arch/frv/kernel/init_task.o | 84 | head-y := arch/frv/kernel/head.o |
85 | 85 | ||
86 | core-y += arch/frv/kernel/ arch/frv/mm/ | 86 | core-y += arch/frv/kernel/ arch/frv/mm/ |
87 | libs-y += arch/frv/lib/ | 87 | libs-y += arch/frv/lib/ |
diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h index 92d83ea99ae5..aaea388a57d9 100644 --- a/arch/frv/include/asm/thread_info.h +++ b/arch/frv/include/asm/thread_info.h | |||
@@ -21,8 +21,6 @@ | |||
21 | 21 | ||
22 | #define THREAD_SIZE 8192 | 22 | #define THREAD_SIZE 8192 |
23 | 23 | ||
24 | #define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR | ||
25 | |||
26 | /* | 24 | /* |
27 | * low level task data that entry.S needs immediate access to | 25 | * low level task data that entry.S needs immediate access to |
28 | * - this struct should fit entirely inside of one cache line | 26 | * - this struct should fit entirely inside of one cache line |
diff --git a/arch/frv/kernel/Makefile b/arch/frv/kernel/Makefile index c36f70b6699a..ad4087b69968 100644 --- a/arch/frv/kernel/Makefile +++ b/arch/frv/kernel/Makefile | |||
@@ -5,7 +5,7 @@ | |||
5 | heads-y := head-uc-fr401.o head-uc-fr451.o head-uc-fr555.o | 5 | heads-y := head-uc-fr401.o head-uc-fr451.o head-uc-fr555.o |
6 | heads-$(CONFIG_MMU) := head-mmu-fr451.o | 6 | heads-$(CONFIG_MMU) := head-mmu-fr451.o |
7 | 7 | ||
8 | extra-y:= head.o init_task.o vmlinux.lds | 8 | extra-y:= head.o vmlinux.lds |
9 | 9 | ||
10 | obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \ | 10 | obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o kernel_thread.o \ |
11 | kernel_execve.o process.o traps.o ptrace.o signal.o dma.o \ | 11 | kernel_execve.o process.o traps.o ptrace.o signal.o dma.o \ |
diff --git a/arch/frv/kernel/init_task.c b/arch/frv/kernel/init_task.c deleted file mode 100644 index 3c3e0b336a9d..000000000000 --- a/arch/frv/kernel/init_task.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | #include <linux/mm.h> | ||
2 | #include <linux/module.h> | ||
3 | #include <linux/sched.h> | ||
4 | #include <linux/init.h> | ||
5 | #include <linux/init_task.h> | ||
6 | #include <linux/fs.h> | ||
7 | #include <linux/mqueue.h> | ||
8 | |||
9 | #include <asm/uaccess.h> | ||
10 | #include <asm/pgtable.h> | ||
11 | |||
12 | |||
13 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
14 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
15 | /* | ||
16 | * Initial thread structure. | ||
17 | * | ||
18 | * We need to make sure that this is THREAD_SIZE aligned due to the | ||
19 | * way process stacks are handled. This is done by having a special | ||
20 | * "init_task" linker map entry.. | ||
21 | */ | ||
22 | union thread_union init_thread_union __init_task_data = | ||
23 | { INIT_THREAD_INFO(init_task) }; | ||
24 | |||
25 | /* | ||
26 | * Initial task structure. | ||
27 | * | ||
28 | * All other task structs will be allocated on slabs in fork.c | ||
29 | */ | ||
30 | struct task_struct init_task = INIT_TASK(init_task); | ||
31 | |||
32 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index d4de48bd5efe..ed09e9e2c653 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c | |||
@@ -43,21 +43,6 @@ asmlinkage void ret_from_fork(void); | |||
43 | void (*pm_power_off)(void); | 43 | void (*pm_power_off)(void); |
44 | EXPORT_SYMBOL(pm_power_off); | 44 | EXPORT_SYMBOL(pm_power_off); |
45 | 45 | ||
46 | struct task_struct *alloc_task_struct_node(int node) | ||
47 | { | ||
48 | struct task_struct *p = kmalloc_node(THREAD_SIZE, GFP_KERNEL, node); | ||
49 | |||
50 | if (p) | ||
51 | atomic_set((atomic_t *)(p+1), 1); | ||
52 | return p; | ||
53 | } | ||
54 | |||
55 | void free_task_struct(struct task_struct *p) | ||
56 | { | ||
57 | if (atomic_dec_and_test((atomic_t *)(p+1))) | ||
58 | kfree(p); | ||
59 | } | ||
60 | |||
61 | static void core_sleep_idle(void) | 46 | static void core_sleep_idle(void) |
62 | { | 47 | { |
63 | #ifdef LED_DEBUG_SLEEP | 48 | #ifdef LED_DEBUG_SLEEP |
diff --git a/arch/h8300/kernel/Makefile b/arch/h8300/kernel/Makefile index 8d4d2a54be9e..1cc57f872d34 100644 --- a/arch/h8300/kernel/Makefile +++ b/arch/h8300/kernel/Makefile | |||
@@ -6,7 +6,7 @@ extra-y := vmlinux.lds | |||
6 | 6 | ||
7 | obj-y := process.o traps.o ptrace.o irq.o \ | 7 | obj-y := process.o traps.o ptrace.o irq.o \ |
8 | sys_h8300.o time.o signal.o \ | 8 | sys_h8300.o time.o signal.o \ |
9 | setup.o gpio.o init_task.o syscalls.o \ | 9 | setup.o gpio.o syscalls.o \ |
10 | entry.o timer/ | 10 | entry.o timer/ |
11 | 11 | ||
12 | obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o | 12 | obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o |
diff --git a/arch/h8300/kernel/init_task.c b/arch/h8300/kernel/init_task.c deleted file mode 100644 index 54c1062ee80e..000000000000 --- a/arch/h8300/kernel/init_task.c +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/h8300/kernel/init_task.c | ||
3 | */ | ||
4 | #include <linux/mm.h> | ||
5 | #include <linux/module.h> | ||
6 | #include <linux/sched.h> | ||
7 | #include <linux/init.h> | ||
8 | #include <linux/init_task.h> | ||
9 | #include <linux/fs.h> | ||
10 | #include <linux/mqueue.h> | ||
11 | |||
12 | #include <asm/uaccess.h> | ||
13 | #include <asm/pgtable.h> | ||
14 | |||
15 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
16 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
17 | /* | ||
18 | * Initial task structure. | ||
19 | * | ||
20 | * All other task structs will be allocated on slabs in fork.c | ||
21 | */ | ||
22 | __asm__(".align 4"); | ||
23 | struct task_struct init_task = INIT_TASK(init_task); | ||
24 | |||
25 | EXPORT_SYMBOL(init_task); | ||
26 | |||
27 | /* | ||
28 | * Initial thread structure. | ||
29 | * | ||
30 | * We need to make sure that this is 8192-byte aligned due to the | ||
31 | * way process stacks are handled. This is done by having a special | ||
32 | * "init_task" linker map entry.. | ||
33 | */ | ||
34 | union thread_union init_thread_union __init_task_data = | ||
35 | { INIT_THREAD_INFO(init_task) }; | ||
36 | |||
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig index 9059e3905887..d2e4a3330336 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig | |||
@@ -27,6 +27,7 @@ config HEXAGON | |||
27 | select HAVE_ARCH_TRACEHOOK | 27 | select HAVE_ARCH_TRACEHOOK |
28 | select NO_IOPORT | 28 | select NO_IOPORT |
29 | select GENERIC_IOMAP | 29 | select GENERIC_IOMAP |
30 | select GENERIC_SMP_IDLE_THREAD | ||
30 | # mostly generic routines, with some accelerated ones | 31 | # mostly generic routines, with some accelerated ones |
31 | ---help--- | 32 | ---help--- |
32 | Qualcomm Hexagon is a processor architecture designed for high | 33 | Qualcomm Hexagon is a processor architecture designed for high |
diff --git a/arch/hexagon/Makefile b/arch/hexagon/Makefile index 0c4de8790fd5..e27d030846ae 100644 --- a/arch/hexagon/Makefile +++ b/arch/hexagon/Makefile | |||
@@ -45,8 +45,7 @@ KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME) | |||
45 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) | 45 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
46 | libs-y += $(LIBGCC) | 46 | libs-y += $(LIBGCC) |
47 | 47 | ||
48 | head-y := arch/hexagon/kernel/head.o \ | 48 | head-y := arch/hexagon/kernel/head.o |
49 | arch/hexagon/kernel/init_task.o | ||
50 | 49 | ||
51 | core-y += arch/hexagon/kernel/ \ | 50 | core-y += arch/hexagon/kernel/ \ |
52 | arch/hexagon/mm/ \ | 51 | arch/hexagon/mm/ \ |
diff --git a/arch/hexagon/kernel/Makefile b/arch/hexagon/kernel/Makefile index 3689f3754d09..536aec093e62 100644 --- a/arch/hexagon/kernel/Makefile +++ b/arch/hexagon/kernel/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | extra-y := head.o vmlinux.lds init_task.o | 1 | extra-y := head.o vmlinux.lds |
2 | 2 | ||
3 | obj-$(CONFIG_SMP) += smp.o topology.o | 3 | obj-$(CONFIG_SMP) += smp.o topology.o |
4 | 4 | ||
diff --git a/arch/hexagon/kernel/init_task.c b/arch/hexagon/kernel/init_task.c deleted file mode 100644 index 73283d3edf09..000000000000 --- a/arch/hexagon/kernel/init_task.c +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* | ||
2 | * Init task definition | ||
3 | * | ||
4 | * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 and | ||
8 | * only version 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
18 | * 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | #include <linux/mm.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/sched.h> | ||
24 | #include <linux/init_task.h> | ||
25 | #include <linux/fs.h> | ||
26 | #include <linux/mqueue.h> | ||
27 | #include <asm/thread_info.h> | ||
28 | #include <asm/uaccess.h> | ||
29 | #include <asm/pgtable.h> | ||
30 | |||
31 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
32 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
33 | |||
34 | /* | ||
35 | * Initial thread structure. | ||
36 | * | ||
37 | * We need to make sure that this is 8192-byte aligned due to the | ||
38 | * way process stacks are handled. This is done by making sure | ||
39 | * the linker maps this in the .text segment right after head.S, | ||
40 | * and making head.S ensure the proper alignment. | ||
41 | */ | ||
42 | union thread_union init_thread_union | ||
43 | __attribute__((__section__(".data.init_task"), | ||
44 | __aligned__(THREAD_SIZE))) = { | ||
45 | INIT_THREAD_INFO(init_task) | ||
46 | }; | ||
47 | |||
48 | /* | ||
49 | * Initial task structure. | ||
50 | * | ||
51 | * All other task structs will be allocated on slabs in fork.c | ||
52 | */ | ||
53 | struct task_struct init_task = INIT_TASK(init_task); | ||
54 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/hexagon/kernel/smp.c b/arch/hexagon/kernel/smp.c index 1298141874a3..f7264621e58d 100644 --- a/arch/hexagon/kernel/smp.c +++ b/arch/hexagon/kernel/smp.c | |||
@@ -196,18 +196,11 @@ void __cpuinit start_secondary(void) | |||
196 | * maintains control until "cpu_online(cpu)" is set. | 196 | * maintains control until "cpu_online(cpu)" is set. |
197 | */ | 197 | */ |
198 | 198 | ||
199 | int __cpuinit __cpu_up(unsigned int cpu) | 199 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle) |
200 | { | 200 | { |
201 | struct task_struct *idle; | 201 | struct thread_info *thread = (struct thread_info *)idle->stack; |
202 | struct thread_info *thread; | ||
203 | void *stack_start; | 202 | void *stack_start; |
204 | 203 | ||
205 | /* Create new init task for the CPU */ | ||
206 | idle = fork_idle(cpu); | ||
207 | if (IS_ERR(idle)) | ||
208 | panic(KERN_ERR "fork_idle failed\n"); | ||
209 | |||
210 | thread = (struct thread_info *)idle->stack; | ||
211 | thread->cpu = cpu; | 204 | thread->cpu = cpu; |
212 | 205 | ||
213 | /* Boot to the head. */ | 206 | /* Boot to the head. */ |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index bd7266903bf8..022ea3a9d1ab 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -33,6 +33,8 @@ config IA64 | |||
33 | select ARCH_WANT_OPTIONAL_GPIOLIB | 33 | select ARCH_WANT_OPTIONAL_GPIOLIB |
34 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 34 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
35 | select GENERIC_IOMAP | 35 | select GENERIC_IOMAP |
36 | select GENERIC_SMP_IDLE_THREAD | ||
37 | select ARCH_INIT_TASK | ||
36 | default y | 38 | default y |
37 | help | 39 | help |
38 | The Itanium Processor Family is Intel's 64-bit successor to | 40 | The Itanium Processor Family is Intel's 64-bit successor to |
diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h index 483f6c6a4238..f92f67aba618 100644 --- a/arch/ia64/include/asm/processor.h +++ b/arch/ia64/include/asm/processor.h | |||
@@ -723,7 +723,6 @@ extern unsigned long boot_option_idle_override; | |||
723 | enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_FORCE_MWAIT, | 723 | enum idle_boot_override {IDLE_NO_OVERRIDE=0, IDLE_HALT, IDLE_FORCE_MWAIT, |
724 | IDLE_NOMWAIT, IDLE_POLL}; | 724 | IDLE_NOMWAIT, IDLE_POLL}; |
725 | 725 | ||
726 | void cpu_idle_wait(void); | ||
727 | void default_idle(void); | 726 | void default_idle(void); |
728 | 727 | ||
729 | #define ia64_platform_is(x) (strcmp(x, platform_name) == 0) | 728 | #define ia64_platform_is(x) (strcmp(x, platform_name) == 0) |
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index ce74e143aea3..5e0e86ddb12f 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c | |||
@@ -273,26 +273,6 @@ static inline void play_dead(void) | |||
273 | } | 273 | } |
274 | #endif /* CONFIG_HOTPLUG_CPU */ | 274 | #endif /* CONFIG_HOTPLUG_CPU */ |
275 | 275 | ||
276 | static void do_nothing(void *unused) | ||
277 | { | ||
278 | } | ||
279 | |||
280 | /* | ||
281 | * cpu_idle_wait - Used to ensure that all the CPUs discard old value of | ||
282 | * pm_idle and update to new pm_idle value. Required while changing pm_idle | ||
283 | * handler on SMP systems. | ||
284 | * | ||
285 | * Caller must have changed pm_idle to the new value before the call. Old | ||
286 | * pm_idle value will not be used by any CPU after the return of this function. | ||
287 | */ | ||
288 | void cpu_idle_wait(void) | ||
289 | { | ||
290 | smp_mb(); | ||
291 | /* kick all the CPUs so that they exit out of pm_idle */ | ||
292 | smp_call_function(do_nothing, NULL, 1); | ||
293 | } | ||
294 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | ||
295 | |||
296 | void __attribute__((noreturn)) | 276 | void __attribute__((noreturn)) |
297 | cpu_idle (void) | 277 | cpu_idle (void) |
298 | { | 278 | { |
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c index 796f6a5b966a..1113b8aba07f 100644 --- a/arch/ia64/kernel/smpboot.c +++ b/arch/ia64/kernel/smpboot.c | |||
@@ -75,13 +75,6 @@ | |||
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * Store all idle threads, this can be reused instead of creating | ||
79 | * a new thread. Also avoids complicated thread destroy functionality | ||
80 | * for idle threads. | ||
81 | */ | ||
82 | struct task_struct *idle_thread_array[NR_CPUS]; | ||
83 | |||
84 | /* | ||
85 | * Global array allocated for NR_CPUS at boot time | 78 | * Global array allocated for NR_CPUS at boot time |
86 | */ | 79 | */ |
87 | struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS]; | 80 | struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS]; |
@@ -94,13 +87,7 @@ struct sal_to_os_boot *sal_state_for_booting_cpu = &sal_boot_rendez_state[0]; | |||
94 | 87 | ||
95 | #define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]); | 88 | #define set_brendez_area(x) (sal_state_for_booting_cpu = &sal_boot_rendez_state[(x)]); |
96 | 89 | ||
97 | #define get_idle_for_cpu(x) (idle_thread_array[(x)]) | ||
98 | #define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p)) | ||
99 | |||
100 | #else | 90 | #else |
101 | |||
102 | #define get_idle_for_cpu(x) (NULL) | ||
103 | #define set_idle_for_cpu(x,p) | ||
104 | #define set_brendez_area(x) | 91 | #define set_brendez_area(x) |
105 | #endif | 92 | #endif |
106 | 93 | ||
@@ -480,54 +467,12 @@ struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs) | |||
480 | return NULL; | 467 | return NULL; |
481 | } | 468 | } |
482 | 469 | ||
483 | struct create_idle { | ||
484 | struct work_struct work; | ||
485 | struct task_struct *idle; | ||
486 | struct completion done; | ||
487 | int cpu; | ||
488 | }; | ||
489 | |||
490 | void __cpuinit | ||
491 | do_fork_idle(struct work_struct *work) | ||
492 | { | ||
493 | struct create_idle *c_idle = | ||
494 | container_of(work, struct create_idle, work); | ||
495 | |||
496 | c_idle->idle = fork_idle(c_idle->cpu); | ||
497 | complete(&c_idle->done); | ||
498 | } | ||
499 | |||
500 | static int __cpuinit | 470 | static int __cpuinit |
501 | do_boot_cpu (int sapicid, int cpu) | 471 | do_boot_cpu (int sapicid, int cpu, struct task_struct *idle) |
502 | { | 472 | { |
503 | int timeout; | 473 | int timeout; |
504 | struct create_idle c_idle = { | ||
505 | .work = __WORK_INITIALIZER(c_idle.work, do_fork_idle), | ||
506 | .cpu = cpu, | ||
507 | .done = COMPLETION_INITIALIZER(c_idle.done), | ||
508 | }; | ||
509 | |||
510 | /* | ||
511 | * We can't use kernel_thread since we must avoid to | ||
512 | * reschedule the child. | ||
513 | */ | ||
514 | c_idle.idle = get_idle_for_cpu(cpu); | ||
515 | if (c_idle.idle) { | ||
516 | init_idle(c_idle.idle, cpu); | ||
517 | goto do_rest; | ||
518 | } | ||
519 | |||
520 | schedule_work(&c_idle.work); | ||
521 | wait_for_completion(&c_idle.done); | ||
522 | |||
523 | if (IS_ERR(c_idle.idle)) | ||
524 | panic("failed fork for CPU %d", cpu); | ||
525 | |||
526 | set_idle_for_cpu(cpu, c_idle.idle); | ||
527 | |||
528 | do_rest: | ||
529 | task_for_booting_cpu = c_idle.idle; | ||
530 | 474 | ||
475 | task_for_booting_cpu = idle; | ||
531 | Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid); | 476 | Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid); |
532 | 477 | ||
533 | set_brendez_area(cpu); | 478 | set_brendez_area(cpu); |
@@ -793,7 +738,7 @@ set_cpu_sibling_map(int cpu) | |||
793 | } | 738 | } |
794 | 739 | ||
795 | int __cpuinit | 740 | int __cpuinit |
796 | __cpu_up (unsigned int cpu) | 741 | __cpu_up(unsigned int cpu, struct task_struct *tidle) |
797 | { | 742 | { |
798 | int ret; | 743 | int ret; |
799 | int sapicid; | 744 | int sapicid; |
@@ -811,7 +756,7 @@ __cpu_up (unsigned int cpu) | |||
811 | 756 | ||
812 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; | 757 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; |
813 | /* Processor goes to start_secondary(), sets online flag */ | 758 | /* Processor goes to start_secondary(), sets online flag */ |
814 | ret = do_boot_cpu(sapicid, cpu); | 759 | ret = do_boot_cpu(sapicid, cpu, tidle); |
815 | if (ret < 0) | 760 | if (ret < 0) |
816 | return ret; | 761 | return ret; |
817 | 762 | ||
diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile index 8ff5ba0ea26c..def8dd0b6bc5 100644 --- a/arch/m32r/Makefile +++ b/arch/m32r/Makefile | |||
@@ -31,7 +31,7 @@ KBUILD_AFLAGS += $(aflags-y) | |||
31 | 31 | ||
32 | CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1 | 32 | CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1 |
33 | 33 | ||
34 | head-y := arch/m32r/kernel/head.o arch/m32r/kernel/init_task.o | 34 | head-y := arch/m32r/kernel/head.o |
35 | 35 | ||
36 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) | 36 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
37 | 37 | ||
diff --git a/arch/m32r/kernel/Makefile b/arch/m32r/kernel/Makefile index b1a4b6036591..0c09dad8b1f8 100644 --- a/arch/m32r/kernel/Makefile +++ b/arch/m32r/kernel/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the Linux/M32R kernel. | 2 | # Makefile for the Linux/M32R kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | extra-y := head.o init_task.o vmlinux.lds | 5 | extra-y := head.o vmlinux.lds |
6 | 6 | ||
7 | obj-y := process.o entry.o traps.o align.o irq.o setup.o time.o \ | 7 | obj-y := process.o entry.o traps.o align.o irq.o setup.o time.o \ |
8 | m32r_ksyms.o sys_m32r.o signal.o ptrace.o | 8 | m32r_ksyms.o sys_m32r.o signal.o ptrace.o |
diff --git a/arch/m32r/kernel/init_task.c b/arch/m32r/kernel/init_task.c deleted file mode 100644 index 6c42d5f8df50..000000000000 --- a/arch/m32r/kernel/init_task.c +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /* orig : i386 init_task.c */ | ||
2 | |||
3 | #include <linux/mm.h> | ||
4 | #include <linux/module.h> | ||
5 | #include <linux/sched.h> | ||
6 | #include <linux/init.h> | ||
7 | #include <linux/init_task.h> | ||
8 | #include <linux/fs.h> | ||
9 | #include <linux/mqueue.h> | ||
10 | |||
11 | #include <asm/uaccess.h> | ||
12 | #include <asm/pgtable.h> | ||
13 | |||
14 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
15 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
16 | /* | ||
17 | * Initial thread structure. | ||
18 | * | ||
19 | * We need to make sure that this is 8192-byte aligned due to the | ||
20 | * way process stacks are handled. This is done by having a special | ||
21 | * "init_task" linker map entry.. | ||
22 | */ | ||
23 | union thread_union init_thread_union __init_task_data = | ||
24 | { INIT_THREAD_INFO(init_task) }; | ||
25 | |||
26 | /* | ||
27 | * Initial task structure. | ||
28 | * | ||
29 | * All other task structs will be allocated on slabs in fork.c | ||
30 | */ | ||
31 | struct task_struct init_task = INIT_TASK(init_task); | ||
32 | |||
33 | EXPORT_SYMBOL(init_task); | ||
34 | |||
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c index cfdbe5d15002..a2cfc0abb05c 100644 --- a/arch/m32r/kernel/smpboot.c +++ b/arch/m32r/kernel/smpboot.c | |||
@@ -109,12 +109,8 @@ static unsigned int calibration_result; | |||
109 | /* Function Prototypes */ | 109 | /* Function Prototypes */ |
110 | /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ | 110 | /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ |
111 | 111 | ||
112 | void smp_prepare_boot_cpu(void); | ||
113 | void smp_prepare_cpus(unsigned int); | ||
114 | static void init_ipi_lock(void); | 112 | static void init_ipi_lock(void); |
115 | static void do_boot_cpu(int); | 113 | static void do_boot_cpu(int); |
116 | int __cpu_up(unsigned int); | ||
117 | void smp_cpus_done(unsigned int); | ||
118 | 114 | ||
119 | int start_secondary(void *); | 115 | int start_secondary(void *); |
120 | static void smp_callin(void); | 116 | static void smp_callin(void); |
@@ -347,7 +343,7 @@ static void __init do_boot_cpu(int phys_id) | |||
347 | } | 343 | } |
348 | } | 344 | } |
349 | 345 | ||
350 | int __cpuinit __cpu_up(unsigned int cpu_id) | 346 | int __cpuinit __cpu_up(unsigned int cpu_id, struct task_struct *tidle) |
351 | { | 347 | { |
352 | int timeout; | 348 | int timeout; |
353 | 349 | ||
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile index 40d29a788b05..5c7070e21eb7 100644 --- a/arch/m68k/kernel/Makefile +++ b/arch/m68k/kernel/Makefile | |||
@@ -13,7 +13,7 @@ extra-$(CONFIG_SUN3X) := head.o | |||
13 | extra-$(CONFIG_SUN3) := sun3-head.o | 13 | extra-$(CONFIG_SUN3) := sun3-head.o |
14 | extra-y += vmlinux.lds | 14 | extra-y += vmlinux.lds |
15 | 15 | ||
16 | obj-y := entry.o init_task.o irq.o m68k_ksyms.o module.o process.o ptrace.o | 16 | obj-y := entry.o irq.o m68k_ksyms.o module.o process.o ptrace.o |
17 | obj-y += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o | 17 | obj-y += setup.o signal.o sys_m68k.o syscalltable.o time.o traps.o |
18 | 18 | ||
19 | obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o | 19 | obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o |
diff --git a/arch/m68k/kernel/init_task.c b/arch/m68k/kernel/init_task.c deleted file mode 100644 index c744cfc6bfa1..000000000000 --- a/arch/m68k/kernel/init_task.c +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/m68knommu/kernel/init_task.c | ||
3 | */ | ||
4 | #include <linux/mm.h> | ||
5 | #include <linux/module.h> | ||
6 | #include <linux/sched.h> | ||
7 | #include <linux/init.h> | ||
8 | #include <linux/init_task.h> | ||
9 | #include <linux/fs.h> | ||
10 | #include <linux/mqueue.h> | ||
11 | |||
12 | #include <asm/uaccess.h> | ||
13 | #include <asm/pgtable.h> | ||
14 | |||
15 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
16 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
17 | /* | ||
18 | * Initial task structure. | ||
19 | * | ||
20 | * All other task structs will be allocated on slabs in fork.c | ||
21 | */ | ||
22 | struct task_struct init_task = INIT_TASK(init_task); | ||
23 | |||
24 | EXPORT_SYMBOL(init_task); | ||
25 | |||
26 | /* | ||
27 | * Initial thread structure. | ||
28 | * | ||
29 | * We need to make sure that this is THREAD size aligned due to the | ||
30 | * way process stacks are handled. This is done by having a special | ||
31 | * "init_task" linker map entry.. | ||
32 | */ | ||
33 | union thread_union init_thread_union __init_task_data = | ||
34 | { INIT_THREAD_INFO(init_task) }; | ||
35 | |||
diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile index 494b63b72dd7..928c950fc14c 100644 --- a/arch/microblaze/kernel/Makefile +++ b/arch/microblaze/kernel/Makefile | |||
@@ -16,7 +16,7 @@ endif | |||
16 | extra-y := head.o vmlinux.lds | 16 | extra-y := head.o vmlinux.lds |
17 | 17 | ||
18 | obj-y += dma.o exceptions.o \ | 18 | obj-y += dma.o exceptions.o \ |
19 | hw_exception_handler.o init_task.o intc.o irq.o \ | 19 | hw_exception_handler.o intc.o irq.o \ |
20 | process.o prom.o prom_parse.o ptrace.o \ | 20 | process.o prom.o prom_parse.o ptrace.o \ |
21 | reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o | 21 | reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o |
22 | 22 | ||
diff --git a/arch/microblaze/kernel/init_task.c b/arch/microblaze/kernel/init_task.c deleted file mode 100644 index b5d711f94ff8..000000000000 --- a/arch/microblaze/kernel/init_task.c +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 Michal Simek <monstr@monstr.eu> | ||
3 | * Copyright (C) 2009 PetaLogix | ||
4 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/module.h> | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/init_task.h> | ||
14 | #include <linux/fs.h> | ||
15 | #include <linux/mqueue.h> | ||
16 | |||
17 | #include <asm/pgtable.h> | ||
18 | |||
19 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
20 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
21 | |||
22 | union thread_union init_thread_union __init_task_data = | ||
23 | { INIT_THREAD_INFO(init_task) }; | ||
24 | |||
25 | struct task_struct init_task = INIT_TASK(init_task); | ||
26 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ce30e2f91d77..186fc8cf9ee0 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -29,6 +29,7 @@ config MIPS | |||
29 | select HAVE_MEMBLOCK | 29 | select HAVE_MEMBLOCK |
30 | select HAVE_MEMBLOCK_NODE_MAP | 30 | select HAVE_MEMBLOCK_NODE_MAP |
31 | select ARCH_DISCARD_MEMBLOCK | 31 | select ARCH_DISCARD_MEMBLOCK |
32 | select GENERIC_SMP_IDLE_THREAD | ||
32 | 33 | ||
33 | menu "Machine selection" | 34 | menu "Machine selection" |
34 | 35 | ||
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 4fedf5a51d96..76017c25a9e6 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile | |||
@@ -235,7 +235,7 @@ endif | |||
235 | 235 | ||
236 | OBJCOPYFLAGS += --remove-section=.reginfo | 236 | OBJCOPYFLAGS += --remove-section=.reginfo |
237 | 237 | ||
238 | head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o | 238 | head-y := arch/mips/kernel/head.o |
239 | 239 | ||
240 | libs-y += arch/mips/lib/ | 240 | libs-y += arch/mips/lib/ |
241 | 241 | ||
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index 0c6877ea9004..fdaf65e1a99d 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the Linux/MIPS kernel. | 2 | # Makefile for the Linux/MIPS kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | extra-y := head.o init_task.o vmlinux.lds | 5 | extra-y := head.o vmlinux.lds |
6 | 6 | ||
7 | obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ | 7 | obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ |
8 | ptrace.o reset.o setup.o signal.o syscall.o \ | 8 | ptrace.o reset.o setup.o signal.o syscall.o \ |
diff --git a/arch/mips/kernel/init_task.c b/arch/mips/kernel/init_task.c deleted file mode 100644 index 5f9a76263c9a..000000000000 --- a/arch/mips/kernel/init_task.c +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | #include <linux/mm.h> | ||
2 | #include <linux/export.h> | ||
3 | #include <linux/sched.h> | ||
4 | #include <linux/init_task.h> | ||
5 | #include <linux/fs.h> | ||
6 | #include <linux/mqueue.h> | ||
7 | |||
8 | #include <asm/thread_info.h> | ||
9 | #include <asm/uaccess.h> | ||
10 | #include <asm/pgtable.h> | ||
11 | |||
12 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
13 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
14 | /* | ||
15 | * Initial thread structure. | ||
16 | * | ||
17 | * We need to make sure that this is 8192-byte aligned due to the | ||
18 | * way process stacks are handled. This is done by making sure | ||
19 | * the linker maps this in the .text segment right after head.S, | ||
20 | * and making head.S ensure the proper alignment. | ||
21 | * | ||
22 | * The things we do for performance.. | ||
23 | */ | ||
24 | union thread_union init_thread_union __init_task_data | ||
25 | __attribute__((__aligned__(THREAD_SIZE))) = | ||
26 | { INIT_THREAD_INFO(init_task) }; | ||
27 | |||
28 | /* | ||
29 | * Initial task structure. | ||
30 | * | ||
31 | * All other task structs will be allocated on slabs in fork.c | ||
32 | */ | ||
33 | struct task_struct init_task = INIT_TASK(init_task); | ||
34 | |||
35 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index ba9376bf52a1..71a95f55a649 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -186,61 +186,9 @@ void __devinit smp_prepare_boot_cpu(void) | |||
186 | cpu_set(0, cpu_callin_map); | 186 | cpu_set(0, cpu_callin_map); |
187 | } | 187 | } |
188 | 188 | ||
189 | /* | 189 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) |
190 | * Called once for each "cpu_possible(cpu)". Needs to spin up the cpu | ||
191 | * and keep control until "cpu_online(cpu)" is set. Note: cpu is | ||
192 | * physical, not logical. | ||
193 | */ | ||
194 | static struct task_struct *cpu_idle_thread[NR_CPUS]; | ||
195 | |||
196 | struct create_idle { | ||
197 | struct work_struct work; | ||
198 | struct task_struct *idle; | ||
199 | struct completion done; | ||
200 | int cpu; | ||
201 | }; | ||
202 | |||
203 | static void __cpuinit do_fork_idle(struct work_struct *work) | ||
204 | { | ||
205 | struct create_idle *c_idle = | ||
206 | container_of(work, struct create_idle, work); | ||
207 | |||
208 | c_idle->idle = fork_idle(c_idle->cpu); | ||
209 | complete(&c_idle->done); | ||
210 | } | ||
211 | |||
212 | int __cpuinit __cpu_up(unsigned int cpu) | ||
213 | { | 190 | { |
214 | struct task_struct *idle; | 191 | mp_ops->boot_secondary(cpu, tidle); |
215 | |||
216 | /* | ||
217 | * Processor goes to start_secondary(), sets online flag | ||
218 | * The following code is purely to make sure | ||
219 | * Linux can schedule processes on this slave. | ||
220 | */ | ||
221 | if (!cpu_idle_thread[cpu]) { | ||
222 | /* | ||
223 | * Schedule work item to avoid forking user task | ||
224 | * Ported from arch/x86/kernel/smpboot.c | ||
225 | */ | ||
226 | struct create_idle c_idle = { | ||
227 | .cpu = cpu, | ||
228 | .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), | ||
229 | }; | ||
230 | |||
231 | INIT_WORK_ONSTACK(&c_idle.work, do_fork_idle); | ||
232 | schedule_work(&c_idle.work); | ||
233 | wait_for_completion(&c_idle.done); | ||
234 | idle = cpu_idle_thread[cpu] = c_idle.idle; | ||
235 | |||
236 | if (IS_ERR(idle)) | ||
237 | panic(KERN_ERR "Fork failed for CPU %d", cpu); | ||
238 | } else { | ||
239 | idle = cpu_idle_thread[cpu]; | ||
240 | init_idle(idle, cpu); | ||
241 | } | ||
242 | |||
243 | mp_ops->boot_secondary(cpu, idle); | ||
244 | 192 | ||
245 | /* | 193 | /* |
246 | * Trust is futile. We should really have timeouts ... | 194 | * Trust is futile. We should really have timeouts ... |
diff --git a/arch/mn10300/Makefile b/arch/mn10300/Makefile index 7120282bf0d8..33188b6e81e4 100644 --- a/arch/mn10300/Makefile +++ b/arch/mn10300/Makefile | |||
@@ -51,7 +51,7 @@ UNIT := asb2364 | |||
51 | endif | 51 | endif |
52 | 52 | ||
53 | 53 | ||
54 | head-y := arch/mn10300/kernel/head.o arch/mn10300/kernel/init_task.o | 54 | head-y := arch/mn10300/kernel/head.o |
55 | 55 | ||
56 | core-y += arch/mn10300/kernel/ arch/mn10300/mm/ | 56 | core-y += arch/mn10300/kernel/ arch/mn10300/mm/ |
57 | 57 | ||
diff --git a/arch/mn10300/kernel/Makefile b/arch/mn10300/kernel/Makefile index 47ed30fe8178..d06749173d63 100644 --- a/arch/mn10300/kernel/Makefile +++ b/arch/mn10300/kernel/Makefile | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Makefile for the MN10300-specific core kernel code | 2 | # Makefile for the MN10300-specific core kernel code |
3 | # | 3 | # |
4 | extra-y := head.o init_task.o vmlinux.lds | 4 | extra-y := head.o vmlinux.lds |
5 | 5 | ||
6 | fpu-obj-y := fpu-nofpu.o fpu-nofpu-low.o | 6 | fpu-obj-y := fpu-nofpu.o fpu-nofpu-low.o |
7 | fpu-obj-$(CONFIG_FPU) := fpu.o fpu-low.o | 7 | fpu-obj-$(CONFIG_FPU) := fpu.o fpu-low.o |
diff --git a/arch/mn10300/kernel/init_task.c b/arch/mn10300/kernel/init_task.c deleted file mode 100644 index a481b043bea7..000000000000 --- a/arch/mn10300/kernel/init_task.c +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /* MN10300 Initial task definitions | ||
2 | * | ||
3 | * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. | ||
4 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | #include <linux/mm.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/sched.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/init_task.h> | ||
16 | #include <linux/fs.h> | ||
17 | #include <linux/mqueue.h> | ||
18 | #include <asm/uaccess.h> | ||
19 | #include <asm/pgtable.h> | ||
20 | |||
21 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
22 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
23 | /* | ||
24 | * Initial thread structure. | ||
25 | * | ||
26 | * We need to make sure that this is THREAD_SIZE aligned due to the | ||
27 | * way process stacks are handled. This is done by having a special | ||
28 | * "init_task" linker map entry.. | ||
29 | */ | ||
30 | union thread_union init_thread_union __init_task_data = | ||
31 | { INIT_THREAD_INFO(init_task) }; | ||
32 | |||
33 | /* | ||
34 | * Initial task structure. | ||
35 | * | ||
36 | * All other task structs will be allocated on slabs in fork.c | ||
37 | */ | ||
38 | struct task_struct init_task = INIT_TASK(init_task); | ||
39 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c index 910dddf65e44..c6b40dad0d0b 100644 --- a/arch/mn10300/kernel/smp.c +++ b/arch/mn10300/kernel/smp.c | |||
@@ -921,7 +921,7 @@ void initialize_secondary(void) | |||
921 | * __cpu_up - Set smp_commenced_mask for the nominated CPU | 921 | * __cpu_up - Set smp_commenced_mask for the nominated CPU |
922 | * @cpu: The target CPU. | 922 | * @cpu: The target CPU. |
923 | */ | 923 | */ |
924 | int __devinit __cpu_up(unsigned int cpu) | 924 | int __devinit __cpu_up(unsigned int cpu, struct task_struct *tidle) |
925 | { | 925 | { |
926 | int timeout; | 926 | int timeout; |
927 | 927 | ||
diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile index 158ae4c0dc6c..966886c8daf5 100644 --- a/arch/openrisc/Makefile +++ b/arch/openrisc/Makefile | |||
@@ -38,7 +38,7 @@ else | |||
38 | KBUILD_CFLAGS += $(call cc-option,-msoft-div) | 38 | KBUILD_CFLAGS += $(call cc-option,-msoft-div) |
39 | endif | 39 | endif |
40 | 40 | ||
41 | head-y := arch/openrisc/kernel/head.o arch/openrisc/kernel/init_task.o | 41 | head-y := arch/openrisc/kernel/head.o |
42 | 42 | ||
43 | core-y += arch/openrisc/lib/ \ | 43 | core-y += arch/openrisc/lib/ \ |
44 | arch/openrisc/kernel/ \ | 44 | arch/openrisc/kernel/ \ |
diff --git a/arch/openrisc/kernel/Makefile b/arch/openrisc/kernel/Makefile index 9a4c2706d795..e1ee0fa2bbda 100644 --- a/arch/openrisc/kernel/Makefile +++ b/arch/openrisc/kernel/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | extra-y := head.o vmlinux.lds init_task.o | 5 | extra-y := head.o vmlinux.lds |
6 | 6 | ||
7 | obj-y := setup.o idle.o or32_ksyms.o process.o dma.o \ | 7 | obj-y := setup.o idle.o or32_ksyms.o process.o dma.o \ |
8 | traps.o time.o irq.o entry.o ptrace.o signal.o sys_or32.o \ | 8 | traps.o time.o irq.o entry.o ptrace.o signal.o sys_or32.o \ |
diff --git a/arch/openrisc/kernel/init_task.c b/arch/openrisc/kernel/init_task.c deleted file mode 100644 index ca534082d5f3..000000000000 --- a/arch/openrisc/kernel/init_task.c +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * OpenRISC init_task.c | ||
3 | * | ||
4 | * Linux architectural port borrowing liberally from similar works of | ||
5 | * others. All original copyrights apply as per the original source | ||
6 | * declaration. | ||
7 | * | ||
8 | * Modifications for the OpenRISC architecture: | ||
9 | * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> | ||
10 | * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version | ||
15 | * 2 of the License, or (at your option) any later version. | ||
16 | */ | ||
17 | |||
18 | #include <linux/init_task.h> | ||
19 | #include <linux/mqueue.h> | ||
20 | #include <linux/export.h> | ||
21 | |||
22 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
23 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
24 | |||
25 | /* | ||
26 | * Initial thread structure. | ||
27 | * | ||
28 | * We need to make sure that this is THREAD_SIZE aligned due to the | ||
29 | * way process stacks are handled. This is done by having a special | ||
30 | * "init_task" linker map entry.. | ||
31 | */ | ||
32 | union thread_union init_thread_union __init_task_data = { | ||
33 | INIT_THREAD_INFO(init_task) | ||
34 | }; | ||
35 | |||
36 | /* | ||
37 | * Initial task structure. | ||
38 | * | ||
39 | * All other task structs will be allocated on slabs in fork.c | ||
40 | */ | ||
41 | struct task_struct init_task = INIT_TASK(init_task); | ||
42 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 242a1b7ac759..ddb8b24b823d 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -17,6 +17,7 @@ config PARISC | |||
17 | select GENERIC_PCI_IOMAP | 17 | select GENERIC_PCI_IOMAP |
18 | select IRQ_PER_CPU | 18 | select IRQ_PER_CPU |
19 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 19 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
20 | select GENERIC_SMP_IDLE_THREAD | ||
20 | 21 | ||
21 | help | 22 | help |
22 | The PA-RISC microprocessor is designed by Hewlett-Packard and used | 23 | The PA-RISC microprocessor is designed by Hewlett-Packard and used |
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile index 19ab7b2ea1cd..dbc3850b1d0d 100644 --- a/arch/parisc/Makefile +++ b/arch/parisc/Makefile | |||
@@ -75,7 +75,7 @@ head-y := arch/parisc/kernel/head.o | |||
75 | 75 | ||
76 | KBUILD_CFLAGS += $(cflags-y) | 76 | KBUILD_CFLAGS += $(cflags-y) |
77 | 77 | ||
78 | kernel-y := mm/ kernel/ math-emu/ kernel/init_task.o | 78 | kernel-y := mm/ kernel/ math-emu/ |
79 | kernel-$(CONFIG_HPUX) += hpux/ | 79 | kernel-$(CONFIG_HPUX) += hpux/ |
80 | 80 | ||
81 | core-y += $(addprefix arch/parisc/, $(kernel-y)) | 81 | core-y += $(addprefix arch/parisc/, $(kernel-y)) |
diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile index 67db0722e6ca..66ee3f12df58 100644 --- a/arch/parisc/kernel/Makefile +++ b/arch/parisc/kernel/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for arch/parisc/kernel | 2 | # Makefile for arch/parisc/kernel |
3 | # | 3 | # |
4 | 4 | ||
5 | extra-y := init_task.o head.o vmlinux.lds | 5 | extra-y := head.o vmlinux.lds |
6 | 6 | ||
7 | obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \ | 7 | obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \ |
8 | pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \ | 8 | pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \ |
diff --git a/arch/parisc/kernel/init_task.c b/arch/parisc/kernel/init_task.c deleted file mode 100644 index 4a91e433416f..000000000000 --- a/arch/parisc/kernel/init_task.c +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* | ||
2 | * Static declaration of "init" task data structure. | ||
3 | * | ||
4 | * Copyright (C) 2000 Paul Bame <bame at parisc-linux.org> | ||
5 | * Copyright (C) 2000-2001 John Marvin <jsm at parisc-linux.org> | ||
6 | * Copyright (C) 2001 Helge Deller <deller @ parisc-linux.org> | ||
7 | * Copyright (C) 2002 Matthew Wilcox <willy with parisc-linux.org> | ||
8 | * | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | #include <linux/mm.h> | ||
26 | #include <linux/fs.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/sched.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/init_task.h> | ||
31 | #include <linux/mqueue.h> | ||
32 | |||
33 | #include <asm/uaccess.h> | ||
34 | #include <asm/pgtable.h> | ||
35 | #include <asm/pgalloc.h> | ||
36 | |||
37 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
38 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
39 | /* | ||
40 | * Initial task structure. | ||
41 | * | ||
42 | * We need to make sure that this is 16384-byte aligned due to the | ||
43 | * way process stacks are handled. This is done by having a special | ||
44 | * "init_task" linker map entry.. | ||
45 | */ | ||
46 | union thread_union init_thread_union __init_task_data | ||
47 | __attribute__((aligned(128))) = | ||
48 | { INIT_THREAD_INFO(init_task) }; | ||
49 | |||
50 | #if PT_NLEVELS == 3 | ||
51 | /* NOTE: This layout exactly conforms to the hybrid L2/L3 page table layout | ||
52 | * with the first pmd adjacent to the pgd and below it. gcc doesn't actually | ||
53 | * guarantee that global objects will be laid out in memory in the same order | ||
54 | * as the order of declaration, so put these in different sections and use | ||
55 | * the linker script to order them. */ | ||
56 | pmd_t pmd0[PTRS_PER_PMD] __attribute__ ((__section__ (".data..vm0.pmd"), aligned(PAGE_SIZE))); | ||
57 | #endif | ||
58 | |||
59 | pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((__section__ (".data..vm0.pgd"), aligned(PAGE_SIZE))); | ||
60 | pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((__section__ (".data..vm0.pte"), aligned(PAGE_SIZE))); | ||
61 | |||
62 | /* | ||
63 | * Initial task structure. | ||
64 | * | ||
65 | * All other task structs will be allocated on slabs in fork.c | ||
66 | */ | ||
67 | EXPORT_SYMBOL(init_task); | ||
68 | |||
69 | __asm__(".data"); | ||
70 | struct task_struct init_task = INIT_TASK(init_task); | ||
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index 0bb1d63907f8..f64f381b4d82 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c | |||
@@ -334,26 +334,11 @@ void __init smp_callin(void) | |||
334 | /* | 334 | /* |
335 | * Bring one cpu online. | 335 | * Bring one cpu online. |
336 | */ | 336 | */ |
337 | int __cpuinit smp_boot_one_cpu(int cpuid) | 337 | int __cpuinit smp_boot_one_cpu(int cpuid, struct task_struct *idle) |
338 | { | 338 | { |
339 | const struct cpuinfo_parisc *p = &per_cpu(cpu_data, cpuid); | 339 | const struct cpuinfo_parisc *p = &per_cpu(cpu_data, cpuid); |
340 | struct task_struct *idle; | ||
341 | long timeout; | 340 | long timeout; |
342 | 341 | ||
343 | /* | ||
344 | * Create an idle task for this CPU. Note the address wed* give | ||
345 | * to kernel_thread is irrelevant -- it's going to start | ||
346 | * where OS_BOOT_RENDEVZ vector in SAL says to start. But | ||
347 | * this gets all the other task-y sort of data structures set | ||
348 | * up like we wish. We need to pull the just created idle task | ||
349 | * off the run queue and stuff it into the init_tasks[] array. | ||
350 | * Sheesh . . . | ||
351 | */ | ||
352 | |||
353 | idle = fork_idle(cpuid); | ||
354 | if (IS_ERR(idle)) | ||
355 | panic("SMP: fork failed for CPU:%d", cpuid); | ||
356 | |||
357 | task_thread_info(idle)->cpu = cpuid; | 342 | task_thread_info(idle)->cpu = cpuid; |
358 | 343 | ||
359 | /* Let _start know what logical CPU we're booting | 344 | /* Let _start know what logical CPU we're booting |
@@ -397,10 +382,6 @@ int __cpuinit smp_boot_one_cpu(int cpuid) | |||
397 | udelay(100); | 382 | udelay(100); |
398 | barrier(); | 383 | barrier(); |
399 | } | 384 | } |
400 | |||
401 | put_task_struct(idle); | ||
402 | idle = NULL; | ||
403 | |||
404 | printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid); | 385 | printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid); |
405 | return -1; | 386 | return -1; |
406 | 387 | ||
@@ -449,10 +430,10 @@ void smp_cpus_done(unsigned int cpu_max) | |||
449 | } | 430 | } |
450 | 431 | ||
451 | 432 | ||
452 | int __cpuinit __cpu_up(unsigned int cpu) | 433 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) |
453 | { | 434 | { |
454 | if (cpu != 0 && cpu < parisc_max_cpus) | 435 | if (cpu != 0 && cpu < parisc_max_cpus) |
455 | smp_boot_one_cpu(cpu); | 436 | smp_boot_one_cpu(cpu, tidle); |
456 | 437 | ||
457 | return cpu_online(cpu) ? 0 : -ENOSYS; | 438 | return cpu_online(cpu) ? 0 : -ENOSYS; |
458 | } | 439 | } |
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 82f364e209fc..3ac462de53a4 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -33,6 +33,18 @@ | |||
33 | 33 | ||
34 | extern int data_start; | 34 | extern int data_start; |
35 | 35 | ||
36 | #if PT_NLEVELS == 3 | ||
37 | /* NOTE: This layout exactly conforms to the hybrid L2/L3 page table layout | ||
38 | * with the first pmd adjacent to the pgd and below it. gcc doesn't actually | ||
39 | * guarantee that global objects will be laid out in memory in the same order | ||
40 | * as the order of declaration, so put these in different sections and use | ||
41 | * the linker script to order them. */ | ||
42 | pmd_t pmd0[PTRS_PER_PMD] __attribute__ ((__section__ (".data..vm0.pmd"), aligned(PAGE_SIZE))); | ||
43 | #endif | ||
44 | |||
45 | pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__ ((__section__ (".data..vm0.pgd"), aligned(PAGE_SIZE))); | ||
46 | pte_t pg0[PT_INITIAL * PTRS_PER_PTE] __attribute__ ((__section__ (".data..vm0.pte"), aligned(PAGE_SIZE))); | ||
47 | |||
36 | #ifdef CONFIG_DISCONTIGMEM | 48 | #ifdef CONFIG_DISCONTIGMEM |
37 | struct node_map_data node_data[MAX_NUMNODES] __read_mostly; | 49 | struct node_map_data node_data[MAX_NUMNODES] __read_mostly; |
38 | unsigned char pfnnid_map[PFNNID_MAP_MAX] __read_mostly; | 50 | unsigned char pfnnid_map[PFNNID_MAP_MAX] __read_mostly; |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index feab3bad6d0f..296e4f997974 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -87,10 +87,6 @@ config ARCH_HAS_ILOG2_U64 | |||
87 | bool | 87 | bool |
88 | default y if 64BIT | 88 | default y if 64BIT |
89 | 89 | ||
90 | config ARCH_HAS_CPU_IDLE_WAIT | ||
91 | bool | ||
92 | default y | ||
93 | |||
94 | config GENERIC_HWEIGHT | 90 | config GENERIC_HWEIGHT |
95 | bool | 91 | bool |
96 | default y | 92 | default y |
@@ -144,6 +140,7 @@ config PPC | |||
144 | select HAVE_BPF_JIT if (PPC64 && NET) | 140 | select HAVE_BPF_JIT if (PPC64 && NET) |
145 | select HAVE_ARCH_JUMP_LABEL | 141 | select HAVE_ARCH_JUMP_LABEL |
146 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 142 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
143 | select GENERIC_SMP_IDLE_THREAD | ||
147 | 144 | ||
148 | config EARLY_PRINTK | 145 | config EARLY_PRINTK |
149 | bool | 146 | bool |
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 8e2d0371fe1e..48a26d379222 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h | |||
@@ -386,7 +386,6 @@ extern unsigned long cpuidle_disable; | |||
386 | enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF}; | 386 | enum idle_boot_override {IDLE_NO_OVERRIDE = 0, IDLE_POWERSAVE_OFF}; |
387 | 387 | ||
388 | extern int powersave_nap; /* set if nap mode can be used in idle loop */ | 388 | extern int powersave_nap; /* set if nap mode can be used in idle loop */ |
389 | void cpu_idle_wait(void); | ||
390 | 389 | ||
391 | #ifdef CONFIG_PSERIES_IDLE | 390 | #ifdef CONFIG_PSERIES_IDLE |
392 | extern void update_smt_snooze_delay(int snooze); | 391 | extern void update_smt_snooze_delay(int snooze); |
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index f5808a35688c..83afacd3ba7b 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -28,7 +28,7 @@ endif | |||
28 | 28 | ||
29 | obj-y := cputable.o ptrace.o syscalls.o \ | 29 | obj-y := cputable.o ptrace.o syscalls.o \ |
30 | irq.o align.o signal_32.o pmc.o vdso.o \ | 30 | irq.o align.o signal_32.o pmc.o vdso.o \ |
31 | init_task.o process.o systbl.o idle.o \ | 31 | process.o systbl.o idle.o \ |
32 | signal.o sysfs.o cacheinfo.o time.o \ | 32 | signal.o sysfs.o cacheinfo.o time.o \ |
33 | prom.o traps.o setup-common.o \ | 33 | prom.o traps.o setup-common.o \ |
34 | udbg.o misc.o io.o dma.o \ | 34 | udbg.o misc.o io.o dma.o \ |
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c index 6d2209ac0c44..2099d9a879e8 100644 --- a/arch/powerpc/kernel/idle.c +++ b/arch/powerpc/kernel/idle.c | |||
@@ -113,29 +113,6 @@ void cpu_idle(void) | |||
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | |||
117 | /* | ||
118 | * cpu_idle_wait - Used to ensure that all the CPUs come out of the old | ||
119 | * idle loop and start using the new idle loop. | ||
120 | * Required while changing idle handler on SMP systems. | ||
121 | * Caller must have changed idle handler to the new value before the call. | ||
122 | * This window may be larger on shared systems. | ||
123 | */ | ||
124 | void cpu_idle_wait(void) | ||
125 | { | ||
126 | int cpu; | ||
127 | smp_mb(); | ||
128 | |||
129 | /* kick all the CPUs so that they exit out of old idle routine */ | ||
130 | get_online_cpus(); | ||
131 | for_each_online_cpu(cpu) { | ||
132 | if (cpu != smp_processor_id()) | ||
133 | smp_send_reschedule(cpu); | ||
134 | } | ||
135 | put_online_cpus(); | ||
136 | } | ||
137 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | ||
138 | |||
139 | int powersave_nap; | 116 | int powersave_nap; |
140 | 117 | ||
141 | #ifdef CONFIG_SYSCTL | 118 | #ifdef CONFIG_SYSCTL |
diff --git a/arch/powerpc/kernel/init_task.c b/arch/powerpc/kernel/init_task.c deleted file mode 100644 index d076d465dbd1..000000000000 --- a/arch/powerpc/kernel/init_task.c +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | #include <linux/mm.h> | ||
2 | #include <linux/export.h> | ||
3 | #include <linux/sched.h> | ||
4 | #include <linux/init.h> | ||
5 | #include <linux/init_task.h> | ||
6 | #include <linux/fs.h> | ||
7 | #include <linux/mqueue.h> | ||
8 | #include <asm/uaccess.h> | ||
9 | |||
10 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
11 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
12 | /* | ||
13 | * Initial thread structure. | ||
14 | * | ||
15 | * We need to make sure that this is 16384-byte aligned due to the | ||
16 | * way process stacks are handled. This is done by having a special | ||
17 | * "init_task" linker map entry.. | ||
18 | */ | ||
19 | union thread_union init_thread_union __init_task_data = | ||
20 | { INIT_THREAD_INFO(init_task) }; | ||
21 | |||
22 | /* | ||
23 | * Initial task structure. | ||
24 | * | ||
25 | * All other task structs will be allocated on slabs in fork.c | ||
26 | */ | ||
27 | struct task_struct init_task = INIT_TASK(init_task); | ||
28 | |||
29 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index d9f94410fd7f..e4cb34322de4 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c | |||
@@ -57,27 +57,9 @@ | |||
57 | #define DBG(fmt...) | 57 | #define DBG(fmt...) |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | |||
61 | /* Store all idle threads, this can be reused instead of creating | ||
62 | * a new thread. Also avoids complicated thread destroy functionality | ||
63 | * for idle threads. | ||
64 | */ | ||
65 | #ifdef CONFIG_HOTPLUG_CPU | 60 | #ifdef CONFIG_HOTPLUG_CPU |
66 | /* | ||
67 | * Needed only for CONFIG_HOTPLUG_CPU because __cpuinitdata is | ||
68 | * removed after init for !CONFIG_HOTPLUG_CPU. | ||
69 | */ | ||
70 | static DEFINE_PER_CPU(struct task_struct *, idle_thread_array); | ||
71 | #define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x)) | ||
72 | #define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p)) | ||
73 | |||
74 | /* State of each CPU during hotplug phases */ | 61 | /* State of each CPU during hotplug phases */ |
75 | static DEFINE_PER_CPU(int, cpu_state) = { 0 }; | 62 | static DEFINE_PER_CPU(int, cpu_state) = { 0 }; |
76 | |||
77 | #else | ||
78 | static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ; | ||
79 | #define get_idle_for_cpu(x) (idle_thread_array[(x)]) | ||
80 | #define set_idle_for_cpu(x, p) (idle_thread_array[(x)] = (p)) | ||
81 | #endif | 63 | #endif |
82 | 64 | ||
83 | struct thread_info *secondary_ti; | 65 | struct thread_info *secondary_ti; |
@@ -429,60 +411,19 @@ int generic_check_cpu_restart(unsigned int cpu) | |||
429 | } | 411 | } |
430 | #endif | 412 | #endif |
431 | 413 | ||
432 | struct create_idle { | 414 | static void cpu_idle_thread_init(unsigned int cpu, struct task_struct *idle) |
433 | struct work_struct work; | ||
434 | struct task_struct *idle; | ||
435 | struct completion done; | ||
436 | int cpu; | ||
437 | }; | ||
438 | |||
439 | static void __cpuinit do_fork_idle(struct work_struct *work) | ||
440 | { | 415 | { |
441 | struct create_idle *c_idle = | 416 | struct thread_info *ti = task_thread_info(idle); |
442 | container_of(work, struct create_idle, work); | ||
443 | |||
444 | c_idle->idle = fork_idle(c_idle->cpu); | ||
445 | complete(&c_idle->done); | ||
446 | } | ||
447 | |||
448 | static int __cpuinit create_idle(unsigned int cpu) | ||
449 | { | ||
450 | struct thread_info *ti; | ||
451 | struct create_idle c_idle = { | ||
452 | .cpu = cpu, | ||
453 | .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), | ||
454 | }; | ||
455 | INIT_WORK_ONSTACK(&c_idle.work, do_fork_idle); | ||
456 | |||
457 | c_idle.idle = get_idle_for_cpu(cpu); | ||
458 | |||
459 | /* We can't use kernel_thread since we must avoid to | ||
460 | * reschedule the child. We use a workqueue because | ||
461 | * we want to fork from a kernel thread, not whatever | ||
462 | * userspace process happens to be trying to online us. | ||
463 | */ | ||
464 | if (!c_idle.idle) { | ||
465 | schedule_work(&c_idle.work); | ||
466 | wait_for_completion(&c_idle.done); | ||
467 | } else | ||
468 | init_idle(c_idle.idle, cpu); | ||
469 | if (IS_ERR(c_idle.idle)) { | ||
470 | pr_err("Failed fork for CPU %u: %li", cpu, PTR_ERR(c_idle.idle)); | ||
471 | return PTR_ERR(c_idle.idle); | ||
472 | } | ||
473 | ti = task_thread_info(c_idle.idle); | ||
474 | 417 | ||
475 | #ifdef CONFIG_PPC64 | 418 | #ifdef CONFIG_PPC64 |
476 | paca[cpu].__current = c_idle.idle; | 419 | paca[cpu].__current = idle; |
477 | paca[cpu].kstack = (unsigned long)ti + THREAD_SIZE - STACK_FRAME_OVERHEAD; | 420 | paca[cpu].kstack = (unsigned long)ti + THREAD_SIZE - STACK_FRAME_OVERHEAD; |
478 | #endif | 421 | #endif |
479 | ti->cpu = cpu; | 422 | ti->cpu = cpu; |
480 | current_set[cpu] = ti; | 423 | secondary_ti = current_set[cpu] = ti; |
481 | |||
482 | return 0; | ||
483 | } | 424 | } |
484 | 425 | ||
485 | int __cpuinit __cpu_up(unsigned int cpu) | 426 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) |
486 | { | 427 | { |
487 | int rc, c; | 428 | int rc, c; |
488 | 429 | ||
@@ -490,12 +431,7 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
490 | (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu))) | 431 | (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu))) |
491 | return -EINVAL; | 432 | return -EINVAL; |
492 | 433 | ||
493 | /* Make sure we have an idle thread */ | 434 | cpu_idle_thread_init(cpu, tidle); |
494 | rc = create_idle(cpu); | ||
495 | if (rc) | ||
496 | return rc; | ||
497 | |||
498 | secondary_ti = current_set[cpu]; | ||
499 | 435 | ||
500 | /* Make sure callin-map entry is 0 (can be leftover a CPU | 436 | /* Make sure callin-map entry is 0 (can be leftover a CPU |
501 | * hotplug | 437 | * hotplug |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 9015060919a0..15cab3ee44e8 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -122,6 +122,7 @@ config S390 | |||
122 | select ARCH_INLINE_WRITE_UNLOCK_BH | 122 | select ARCH_INLINE_WRITE_UNLOCK_BH |
123 | select ARCH_INLINE_WRITE_UNLOCK_IRQ | 123 | select ARCH_INLINE_WRITE_UNLOCK_IRQ |
124 | select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE | 124 | select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE |
125 | select GENERIC_SMP_IDLE_THREAD | ||
125 | 126 | ||
126 | config SCHED_OMIT_FRAME_POINTER | 127 | config SCHED_OMIT_FRAME_POINTER |
127 | def_bool y | 128 | def_bool y |
diff --git a/arch/s390/Makefile b/arch/s390/Makefile index 0ad2f1e1ce9e..49e76e8b477d 100644 --- a/arch/s390/Makefile +++ b/arch/s390/Makefile | |||
@@ -91,7 +91,6 @@ OBJCOPYFLAGS := -O binary | |||
91 | 91 | ||
92 | head-y := arch/s390/kernel/head.o | 92 | head-y := arch/s390/kernel/head.o |
93 | head-y += arch/s390/kernel/$(if $(CONFIG_64BIT),head64.o,head31.o) | 93 | head-y += arch/s390/kernel/$(if $(CONFIG_64BIT),head64.o,head31.o) |
94 | head-y += arch/s390/kernel/init_task.o | ||
95 | 94 | ||
96 | # See arch/s390/Kbuild for content of core part of the kernel | 95 | # See arch/s390/Kbuild for content of core part of the kernel |
97 | core-y += arch/s390/ | 96 | core-y += arch/s390/ |
diff --git a/arch/s390/include/asm/smp.h b/arch/s390/include/asm/smp.h index c77c6de6f6c0..0b6f586c1383 100644 --- a/arch/s390/include/asm/smp.h +++ b/arch/s390/include/asm/smp.h | |||
@@ -16,7 +16,7 @@ | |||
16 | extern struct mutex smp_cpu_state_mutex; | 16 | extern struct mutex smp_cpu_state_mutex; |
17 | extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1]; | 17 | extern struct save_area *zfcpdump_save_areas[NR_CPUS + 1]; |
18 | 18 | ||
19 | extern int __cpu_up(unsigned int cpu); | 19 | extern int __cpu_up(unsigned int cpu, struct task_struct *tidle); |
20 | 20 | ||
21 | extern void arch_send_call_function_single_ipi(int cpu); | 21 | extern void arch_send_call_function_single_ipi(int cpu); |
22 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); | 22 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile index 884b18afc864..9733b3f0eb6d 100644 --- a/arch/s390/kernel/Makefile +++ b/arch/s390/kernel/Makefile | |||
@@ -28,7 +28,7 @@ obj-y := bitmap.o traps.o time.o process.o base.o early.o setup.o vtime.o \ | |||
28 | obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) | 28 | obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o) |
29 | obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) | 29 | obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o) |
30 | 30 | ||
31 | extra-y += head.o init_task.o vmlinux.lds | 31 | extra-y += head.o vmlinux.lds |
32 | extra-y += $(if $(CONFIG_64BIT),head64.o,head31.o) | 32 | extra-y += $(if $(CONFIG_64BIT),head64.o,head31.o) |
33 | 33 | ||
34 | obj-$(CONFIG_MODULES) += s390_ksyms.o module.o | 34 | obj-$(CONFIG_MODULES) += s390_ksyms.o module.o |
diff --git a/arch/s390/kernel/init_task.c b/arch/s390/kernel/init_task.c deleted file mode 100644 index 4d1c9fb0b540..000000000000 --- a/arch/s390/kernel/init_task.c +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | /* | ||
2 | * arch/s390/kernel/init_task.c | ||
3 | * | ||
4 | * S390 version | ||
5 | * | ||
6 | * Derived from "arch/i386/kernel/init_task.c" | ||
7 | */ | ||
8 | |||
9 | #include <linux/mm.h> | ||
10 | #include <linux/fs.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/sched.h> | ||
13 | #include <linux/init_task.h> | ||
14 | #include <linux/mqueue.h> | ||
15 | |||
16 | #include <asm/uaccess.h> | ||
17 | #include <asm/pgtable.h> | ||
18 | |||
19 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
20 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
21 | /* | ||
22 | * Initial thread structure. | ||
23 | * | ||
24 | * We need to make sure that this is THREAD_SIZE aligned due to the | ||
25 | * way process stacks are handled. This is done by having a special | ||
26 | * "init_task" linker map entry.. | ||
27 | */ | ||
28 | union thread_union init_thread_union __init_task_data = | ||
29 | { INIT_THREAD_INFO(init_task) }; | ||
30 | |||
31 | /* | ||
32 | * Initial task structure. | ||
33 | * | ||
34 | * All other task structs will be allocated on slabs in fork.c | ||
35 | */ | ||
36 | struct task_struct init_task = INIT_TASK(init_task); | ||
37 | |||
38 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 1f77227669e8..992b7b93a574 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
@@ -85,7 +85,6 @@ enum { | |||
85 | 85 | ||
86 | struct pcpu { | 86 | struct pcpu { |
87 | struct cpu cpu; | 87 | struct cpu cpu; |
88 | struct task_struct *idle; /* idle process for the cpu */ | ||
89 | struct _lowcore *lowcore; /* lowcore page(s) for the cpu */ | 88 | struct _lowcore *lowcore; /* lowcore page(s) for the cpu */ |
90 | unsigned long async_stack; /* async stack for the cpu */ | 89 | unsigned long async_stack; /* async stack for the cpu */ |
91 | unsigned long panic_stack; /* panic stack for the cpu */ | 90 | unsigned long panic_stack; /* panic stack for the cpu */ |
@@ -721,26 +720,9 @@ static void __cpuinit smp_start_secondary(void *cpuvoid) | |||
721 | cpu_idle(); | 720 | cpu_idle(); |
722 | } | 721 | } |
723 | 722 | ||
724 | struct create_idle { | ||
725 | struct work_struct work; | ||
726 | struct task_struct *idle; | ||
727 | struct completion done; | ||
728 | int cpu; | ||
729 | }; | ||
730 | |||
731 | static void __cpuinit smp_fork_idle(struct work_struct *work) | ||
732 | { | ||
733 | struct create_idle *c_idle; | ||
734 | |||
735 | c_idle = container_of(work, struct create_idle, work); | ||
736 | c_idle->idle = fork_idle(c_idle->cpu); | ||
737 | complete(&c_idle->done); | ||
738 | } | ||
739 | |||
740 | /* Upping and downing of CPUs */ | 723 | /* Upping and downing of CPUs */ |
741 | int __cpuinit __cpu_up(unsigned int cpu) | 724 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) |
742 | { | 725 | { |
743 | struct create_idle c_idle; | ||
744 | struct pcpu *pcpu; | 726 | struct pcpu *pcpu; |
745 | int rc; | 727 | int rc; |
746 | 728 | ||
@@ -750,22 +732,12 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
750 | if (pcpu_sigp_retry(pcpu, sigp_initial_cpu_reset, 0) != | 732 | if (pcpu_sigp_retry(pcpu, sigp_initial_cpu_reset, 0) != |
751 | sigp_order_code_accepted) | 733 | sigp_order_code_accepted) |
752 | return -EIO; | 734 | return -EIO; |
753 | if (!pcpu->idle) { | 735 | |
754 | c_idle.done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done); | ||
755 | INIT_WORK_ONSTACK(&c_idle.work, smp_fork_idle); | ||
756 | c_idle.cpu = cpu; | ||
757 | schedule_work(&c_idle.work); | ||
758 | wait_for_completion(&c_idle.done); | ||
759 | if (IS_ERR(c_idle.idle)) | ||
760 | return PTR_ERR(c_idle.idle); | ||
761 | pcpu->idle = c_idle.idle; | ||
762 | } | ||
763 | init_idle(pcpu->idle, cpu); | ||
764 | rc = pcpu_alloc_lowcore(pcpu, cpu); | 736 | rc = pcpu_alloc_lowcore(pcpu, cpu); |
765 | if (rc) | 737 | if (rc) |
766 | return rc; | 738 | return rc; |
767 | pcpu_prepare_secondary(pcpu, cpu); | 739 | pcpu_prepare_secondary(pcpu, cpu); |
768 | pcpu_attach_task(pcpu, pcpu->idle); | 740 | pcpu_attach_task(pcpu, tidle); |
769 | pcpu_start_fn(pcpu, smp_start_secondary, NULL); | 741 | pcpu_start_fn(pcpu, smp_start_secondary, NULL); |
770 | while (!cpu_online(cpu)) | 742 | while (!cpu_online(cpu)) |
771 | cpu_relax(); | 743 | cpu_relax(); |
@@ -852,7 +824,6 @@ void __init smp_prepare_boot_cpu(void) | |||
852 | struct pcpu *pcpu = pcpu_devices; | 824 | struct pcpu *pcpu = pcpu_devices; |
853 | 825 | ||
854 | boot_cpu_address = stap(); | 826 | boot_cpu_address = stap(); |
855 | pcpu->idle = current; | ||
856 | pcpu->state = CPU_STATE_CONFIGURED; | 827 | pcpu->state = CPU_STATE_CONFIGURED; |
857 | pcpu->address = boot_cpu_address; | 828 | pcpu->address = boot_cpu_address; |
858 | pcpu->lowcore = (struct _lowcore *)(unsigned long) store_prefix(); | 829 | pcpu->lowcore = (struct _lowcore *)(unsigned long) store_prefix(); |
diff --git a/arch/score/kernel/Makefile b/arch/score/kernel/Makefile index f218673b5d3d..fb1802b3f542 100644 --- a/arch/score/kernel/Makefile +++ b/arch/score/kernel/Makefile | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | extra-y := head.o vmlinux.lds | 5 | extra-y := head.o vmlinux.lds |
6 | 6 | ||
7 | obj-y += entry.o init_task.o irq.o process.o ptrace.o \ | 7 | obj-y += entry.o irq.o process.o ptrace.o \ |
8 | setup.o signal.o sys_score.o time.o traps.o \ | 8 | setup.o signal.o sys_score.o time.o traps.o \ |
9 | sys_call_table.o | 9 | sys_call_table.o |
10 | 10 | ||
diff --git a/arch/score/kernel/init_task.c b/arch/score/kernel/init_task.c deleted file mode 100644 index baa03ee217d1..000000000000 --- a/arch/score/kernel/init_task.c +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | /* | ||
2 | * arch/score/kernel/init_task.c | ||
3 | * | ||
4 | * Score Processor version. | ||
5 | * | ||
6 | * Copyright (C) 2009 Sunplus Core Technology Co., Ltd. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, see the file COPYING, or write | ||
20 | * to the Free Software Foundation, Inc., | ||
21 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/init_task.h> | ||
25 | #include <linux/mqueue.h> | ||
26 | |||
27 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
28 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
29 | |||
30 | /* | ||
31 | * Initial thread structure. | ||
32 | * | ||
33 | * We need to make sure that this is THREAD_SIZE aligned due to the | ||
34 | * way process stacks are handled. This is done by having a special | ||
35 | * "init_task" linker map entry.. | ||
36 | */ | ||
37 | union thread_union init_thread_union __init_task_data = | ||
38 | { INIT_THREAD_INFO(init_task) }; | ||
39 | |||
40 | /* | ||
41 | * Initial task structure. | ||
42 | * | ||
43 | * All other task structs will be allocated on slabs in fork.c | ||
44 | */ | ||
45 | struct task_struct init_task = INIT_TASK(init_task); | ||
46 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index ff9e033ce626..04a8cb4700af 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -28,6 +28,7 @@ config SUPERH | |||
28 | select RTC_LIB | 28 | select RTC_LIB |
29 | select GENERIC_ATOMIC64 | 29 | select GENERIC_ATOMIC64 |
30 | select GENERIC_IRQ_SHOW | 30 | select GENERIC_IRQ_SHOW |
31 | select GENERIC_SMP_IDLE_THREAD | ||
31 | help | 32 | help |
32 | The SuperH is a RISC processor targeted for use in embedded systems | 33 | The SuperH is a RISC processor targeted for use in embedded systems |
33 | and consumer electronics; it was also used in the Sega Dreamcast | 34 | and consumer electronics; it was also used in the Sega Dreamcast |
@@ -152,9 +153,6 @@ config ARCH_NO_VIRT_TO_BUS | |||
152 | config ARCH_HAS_DEFAULT_IDLE | 153 | config ARCH_HAS_DEFAULT_IDLE |
153 | def_bool y | 154 | def_bool y |
154 | 155 | ||
155 | config ARCH_HAS_CPU_IDLE_WAIT | ||
156 | def_bool y | ||
157 | |||
158 | config NO_IOPORT | 156 | config NO_IOPORT |
159 | def_bool !PCI | 157 | def_bool !PCI |
160 | depends on !SH_CAYMAN && !SH_SH4202_MICRODEV && !SH_SHMIN | 158 | depends on !SH_CAYMAN && !SH_SH4202_MICRODEV && !SH_SHMIN |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index 3fc0f413777c..e14a676a0c7d 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
@@ -124,7 +124,7 @@ endif | |||
124 | 124 | ||
125 | export ld-bfd BITS | 125 | export ld-bfd BITS |
126 | 126 | ||
127 | head-y := arch/sh/kernel/init_task.o arch/sh/kernel/head_$(BITS).o | 127 | head-y := arch/sh/kernel/head_$(BITS).o |
128 | 128 | ||
129 | core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/ | 129 | core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/ |
130 | core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/ | 130 | core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/ |
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h index a229c393826a..6dbc1be28a0f 100644 --- a/arch/sh/include/asm/processor.h +++ b/arch/sh/include/asm/processor.h | |||
@@ -85,10 +85,6 @@ struct sh_cpuinfo { | |||
85 | struct tlb_info itlb; | 85 | struct tlb_info itlb; |
86 | struct tlb_info dtlb; | 86 | struct tlb_info dtlb; |
87 | 87 | ||
88 | #ifdef CONFIG_SMP | ||
89 | struct task_struct *idle; | ||
90 | #endif | ||
91 | |||
92 | unsigned int phys_bits; | 88 | unsigned int phys_bits; |
93 | unsigned long flags; | 89 | unsigned long flags; |
94 | } __attribute__ ((aligned(L1_CACHE_BYTES))); | 90 | } __attribute__ ((aligned(L1_CACHE_BYTES))); |
@@ -102,7 +98,6 @@ extern struct sh_cpuinfo cpu_data[]; | |||
102 | #define cpu_relax() barrier() | 98 | #define cpu_relax() barrier() |
103 | 99 | ||
104 | void default_idle(void); | 100 | void default_idle(void); |
105 | void cpu_idle_wait(void); | ||
106 | void stop_this_cpu(void *); | 101 | void stop_this_cpu(void *); |
107 | 102 | ||
108 | /* Forward decl */ | 103 | /* Forward decl */ |
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile index 77f7ae1d4647..88571ff8eeec 100644 --- a/arch/sh/kernel/Makefile +++ b/arch/sh/kernel/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the Linux/SuperH kernel. | 2 | # Makefile for the Linux/SuperH kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | extra-y := head_$(BITS).o init_task.o vmlinux.lds | 5 | extra-y := head_$(BITS).o vmlinux.lds |
6 | 6 | ||
7 | ifdef CONFIG_FUNCTION_TRACER | 7 | ifdef CONFIG_FUNCTION_TRACER |
8 | # Do not profile debug and lowlevel utilities | 8 | # Do not profile debug and lowlevel utilities |
diff --git a/arch/sh/kernel/idle.c b/arch/sh/kernel/idle.c index ee226e20c20c..0c910163caa3 100644 --- a/arch/sh/kernel/idle.c +++ b/arch/sh/kernel/idle.c | |||
@@ -132,10 +132,6 @@ void __init select_idle_routine(void) | |||
132 | pm_idle = poll_idle; | 132 | pm_idle = poll_idle; |
133 | } | 133 | } |
134 | 134 | ||
135 | static void do_nothing(void *unused) | ||
136 | { | ||
137 | } | ||
138 | |||
139 | void stop_this_cpu(void *unused) | 135 | void stop_this_cpu(void *unused) |
140 | { | 136 | { |
141 | local_irq_disable(); | 137 | local_irq_disable(); |
@@ -144,19 +140,3 @@ void stop_this_cpu(void *unused) | |||
144 | for (;;) | 140 | for (;;) |
145 | cpu_sleep(); | 141 | cpu_sleep(); |
146 | } | 142 | } |
147 | |||
148 | /* | ||
149 | * cpu_idle_wait - Used to ensure that all the CPUs discard old value of | ||
150 | * pm_idle and update to new pm_idle value. Required while changing pm_idle | ||
151 | * handler on SMP systems. | ||
152 | * | ||
153 | * Caller must have changed pm_idle to the new value before the call. Old | ||
154 | * pm_idle value will not be used by any CPU after the return of this function. | ||
155 | */ | ||
156 | void cpu_idle_wait(void) | ||
157 | { | ||
158 | smp_mb(); | ||
159 | /* kick all the CPUs so that they exit out of pm_idle */ | ||
160 | smp_call_function(do_nothing, NULL, 1); | ||
161 | } | ||
162 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | ||
diff --git a/arch/sh/kernel/init_task.c b/arch/sh/kernel/init_task.c deleted file mode 100644 index 11f2ea556a6b..000000000000 --- a/arch/sh/kernel/init_task.c +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | #include <linux/mm.h> | ||
2 | #include <linux/module.h> | ||
3 | #include <linux/sched.h> | ||
4 | #include <linux/init_task.h> | ||
5 | #include <linux/mqueue.h> | ||
6 | #include <linux/fs.h> | ||
7 | #include <asm/uaccess.h> | ||
8 | #include <asm/pgtable.h> | ||
9 | |||
10 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
11 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
12 | struct pt_regs fake_swapper_regs; | ||
13 | /* | ||
14 | * Initial thread structure. | ||
15 | * | ||
16 | * We need to make sure that this is 8192-byte aligned due to the | ||
17 | * way process stacks are handled. This is done by having a special | ||
18 | * "init_task" linker map entry.. | ||
19 | */ | ||
20 | union thread_union init_thread_union __init_task_data = | ||
21 | { INIT_THREAD_INFO(init_task) }; | ||
22 | |||
23 | /* | ||
24 | * Initial task structure. | ||
25 | * | ||
26 | * All other task structs will be allocated on slabs in fork.c | ||
27 | */ | ||
28 | struct task_struct init_task = INIT_TASK(init_task); | ||
29 | |||
30 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index eaebdf6a5c77..b86e9ca79455 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c | |||
@@ -220,22 +220,10 @@ extern struct { | |||
220 | void *thread_info; | 220 | void *thread_info; |
221 | } stack_start; | 221 | } stack_start; |
222 | 222 | ||
223 | int __cpuinit __cpu_up(unsigned int cpu) | 223 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tsk) |
224 | { | 224 | { |
225 | struct task_struct *tsk; | ||
226 | unsigned long timeout; | 225 | unsigned long timeout; |
227 | 226 | ||
228 | tsk = cpu_data[cpu].idle; | ||
229 | if (!tsk) { | ||
230 | tsk = fork_idle(cpu); | ||
231 | if (IS_ERR(tsk)) { | ||
232 | pr_err("Failed forking idle task for cpu %d\n", cpu); | ||
233 | return PTR_ERR(tsk); | ||
234 | } | ||
235 | |||
236 | cpu_data[cpu].idle = tsk; | ||
237 | } | ||
238 | |||
239 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; | 227 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; |
240 | 228 | ||
241 | /* Fill in data in head.S for secondary cpus */ | 229 | /* Fill in data in head.S for secondary cpus */ |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 6c0683d3fcba..e417f35d5912 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -30,6 +30,7 @@ config SPARC | |||
30 | select USE_GENERIC_SMP_HELPERS if SMP | 30 | select USE_GENERIC_SMP_HELPERS if SMP |
31 | select GENERIC_PCI_IOMAP | 31 | select GENERIC_PCI_IOMAP |
32 | select HAVE_NMI_WATCHDOG if SPARC64 | 32 | select HAVE_NMI_WATCHDOG if SPARC64 |
33 | select GENERIC_SMP_IDLE_THREAD | ||
33 | 34 | ||
34 | config SPARC32 | 35 | config SPARC32 |
35 | def_bool !64BIT | 36 | def_bool !64BIT |
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index eddcfb36aafb..cf39aaf24189 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile | |||
@@ -62,7 +62,6 @@ endif | |||
62 | endif | 62 | endif |
63 | 63 | ||
64 | head-y := arch/sparc/kernel/head_$(BITS).o | 64 | head-y := arch/sparc/kernel/head_$(BITS).o |
65 | head-y += arch/sparc/kernel/init_task.o | ||
66 | 65 | ||
67 | core-y += arch/sparc/kernel/ | 66 | core-y += arch/sparc/kernel/ |
68 | core-y += arch/sparc/mm/ arch/sparc/math-emu/ | 67 | core-y += arch/sparc/mm/ arch/sparc/math-emu/ |
diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h index a4e457f003ed..6a1585b52c49 100644 --- a/arch/sparc/include/asm/leon.h +++ b/arch/sparc/include/asm/leon.h | |||
@@ -315,6 +315,7 @@ struct leon2_cacheregs { | |||
315 | #include <linux/interrupt.h> | 315 | #include <linux/interrupt.h> |
316 | 316 | ||
317 | struct device_node; | 317 | struct device_node; |
318 | struct task_struct; | ||
318 | extern unsigned int leon_build_device_irq(unsigned int real_irq, | 319 | extern unsigned int leon_build_device_irq(unsigned int real_irq, |
319 | irq_flow_handler_t flow_handler, | 320 | irq_flow_handler_t flow_handler, |
320 | const char *name, int do_ack); | 321 | const char *name, int do_ack); |
@@ -344,7 +345,7 @@ extern int leon_smp_nrcpus(void); | |||
344 | extern void leon_clear_profile_irq(int cpu); | 345 | extern void leon_clear_profile_irq(int cpu); |
345 | extern void leon_smp_done(void); | 346 | extern void leon_smp_done(void); |
346 | extern void leon_boot_cpus(void); | 347 | extern void leon_boot_cpus(void); |
347 | extern int leon_boot_one_cpu(int i); | 348 | extern int leon_boot_one_cpu(int i, struct task_struct *); |
348 | void leon_init_smp(void); | 349 | void leon_init_smp(void); |
349 | extern void cpu_idle(void); | 350 | extern void cpu_idle(void); |
350 | extern void init_IRQ(void); | 351 | extern void init_IRQ(void); |
@@ -380,7 +381,7 @@ extern int leon_ipi_irq; | |||
380 | #define init_leon() do {} while (0) | 381 | #define init_leon() do {} while (0) |
381 | #define leon_smp_done() do {} while (0) | 382 | #define leon_smp_done() do {} while (0) |
382 | #define leon_boot_cpus() do {} while (0) | 383 | #define leon_boot_cpus() do {} while (0) |
383 | #define leon_boot_one_cpu(i) 1 | 384 | #define leon_boot_one_cpu(i, t) 1 |
384 | #define leon_init_smp() do {} while (0) | 385 | #define leon_init_smp() do {} while (0) |
385 | 386 | ||
386 | #endif /* !defined(CONFIG_SPARC_LEON) */ | 387 | #endif /* !defined(CONFIG_SPARC_LEON) */ |
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index cb85458f89d2..9c74bdc0349c 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile | |||
@@ -6,7 +6,6 @@ asflags-y := -ansi | |||
6 | ccflags-y := -Werror | 6 | ccflags-y := -Werror |
7 | 7 | ||
8 | extra-y := head_$(BITS).o | 8 | extra-y := head_$(BITS).o |
9 | extra-y += init_task.o | ||
10 | 9 | ||
11 | # Undefine sparc when processing vmlinux.lds - it is used | 10 | # Undefine sparc when processing vmlinux.lds - it is used |
12 | # And teach CPP we are doing $(BITS) builds (for this case) | 11 | # And teach CPP we are doing $(BITS) builds (for this case) |
diff --git a/arch/sparc/kernel/init_task.c b/arch/sparc/kernel/init_task.c deleted file mode 100644 index 35f141a9f506..000000000000 --- a/arch/sparc/kernel/init_task.c +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | #include <linux/mm.h> | ||
2 | #include <linux/fs.h> | ||
3 | #include <linux/module.h> | ||
4 | #include <linux/sched.h> | ||
5 | #include <linux/init_task.h> | ||
6 | #include <linux/mqueue.h> | ||
7 | |||
8 | #include <asm/pgtable.h> | ||
9 | #include <asm/uaccess.h> | ||
10 | |||
11 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
12 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
13 | struct task_struct init_task = INIT_TASK(init_task); | ||
14 | EXPORT_SYMBOL(init_task); | ||
15 | |||
16 | /* .text section in head.S is aligned at 8k boundary and this gets linked | ||
17 | * right after that so that the init_thread_union is aligned properly as well. | ||
18 | * If this is not aligned on a 8k boundary, then you should change code | ||
19 | * in etrap.S which assumes it. | ||
20 | */ | ||
21 | union thread_union init_thread_union __init_task_data = | ||
22 | { INIT_THREAD_INFO(init_task) }; | ||
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index 160cac9c4036..b34c93c351b6 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c | |||
@@ -204,16 +204,11 @@ void __init leon_boot_cpus(void) | |||
204 | 204 | ||
205 | } | 205 | } |
206 | 206 | ||
207 | int __cpuinit leon_boot_one_cpu(int i) | 207 | int __cpuinit leon_boot_one_cpu(int i, struct task_struct *idle) |
208 | { | 208 | { |
209 | |||
210 | struct task_struct *p; | ||
211 | int timeout; | 209 | int timeout; |
212 | 210 | ||
213 | /* Cook up an idler for this guy. */ | 211 | current_set[i] = task_thread_info(idle); |
214 | p = fork_idle(i); | ||
215 | |||
216 | current_set[i] = task_thread_info(p); | ||
217 | 212 | ||
218 | /* See trampoline.S:leon_smp_cpu_startup for details... | 213 | /* See trampoline.S:leon_smp_cpu_startup for details... |
219 | * Initialize the contexts table | 214 | * Initialize the contexts table |
diff --git a/arch/sparc/kernel/smp_32.c b/arch/sparc/kernel/smp_32.c index f671e7fd6ddc..9028566b3cd6 100644 --- a/arch/sparc/kernel/smp_32.c +++ b/arch/sparc/kernel/smp_32.c | |||
@@ -411,10 +411,10 @@ void __init smp_prepare_boot_cpu(void) | |||
411 | set_cpu_possible(cpuid, true); | 411 | set_cpu_possible(cpuid, true); |
412 | } | 412 | } |
413 | 413 | ||
414 | int __cpuinit __cpu_up(unsigned int cpu) | 414 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) |
415 | { | 415 | { |
416 | extern int __cpuinit smp4m_boot_one_cpu(int); | 416 | extern int __cpuinit smp4m_boot_one_cpu(int, struct task_struct *); |
417 | extern int __cpuinit smp4d_boot_one_cpu(int); | 417 | extern int __cpuinit smp4d_boot_one_cpu(int, struct task_struct *); |
418 | int ret=0; | 418 | int ret=0; |
419 | 419 | ||
420 | switch(sparc_cpu_model) { | 420 | switch(sparc_cpu_model) { |
@@ -427,13 +427,13 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
427 | BUG(); | 427 | BUG(); |
428 | break; | 428 | break; |
429 | case sun4m: | 429 | case sun4m: |
430 | ret = smp4m_boot_one_cpu(cpu); | 430 | ret = smp4m_boot_one_cpu(cpu, tidle); |
431 | break; | 431 | break; |
432 | case sun4d: | 432 | case sun4d: |
433 | ret = smp4d_boot_one_cpu(cpu); | 433 | ret = smp4d_boot_one_cpu(cpu, tidle); |
434 | break; | 434 | break; |
435 | case sparc_leon: | 435 | case sparc_leon: |
436 | ret = leon_boot_one_cpu(cpu); | 436 | ret = leon_boot_one_cpu(cpu, tidle); |
437 | break; | 437 | break; |
438 | case sun4e: | 438 | case sun4e: |
439 | printk("SUN4E\n"); | 439 | printk("SUN4E\n"); |
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index 3b1bd7c50164..f591598d92f6 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c | |||
@@ -343,21 +343,17 @@ extern unsigned long sparc64_cpu_startup; | |||
343 | */ | 343 | */ |
344 | static struct thread_info *cpu_new_thread = NULL; | 344 | static struct thread_info *cpu_new_thread = NULL; |
345 | 345 | ||
346 | static int __cpuinit smp_boot_one_cpu(unsigned int cpu) | 346 | static int __cpuinit smp_boot_one_cpu(unsigned int cpu, struct task_struct *idle) |
347 | { | 347 | { |
348 | unsigned long entry = | 348 | unsigned long entry = |
349 | (unsigned long)(&sparc64_cpu_startup); | 349 | (unsigned long)(&sparc64_cpu_startup); |
350 | unsigned long cookie = | 350 | unsigned long cookie = |
351 | (unsigned long)(&cpu_new_thread); | 351 | (unsigned long)(&cpu_new_thread); |
352 | struct task_struct *p; | ||
353 | void *descr = NULL; | 352 | void *descr = NULL; |
354 | int timeout, ret; | 353 | int timeout, ret; |
355 | 354 | ||
356 | p = fork_idle(cpu); | ||
357 | if (IS_ERR(p)) | ||
358 | return PTR_ERR(p); | ||
359 | callin_flag = 0; | 355 | callin_flag = 0; |
360 | cpu_new_thread = task_thread_info(p); | 356 | cpu_new_thread = task_thread_info(idle); |
361 | 357 | ||
362 | if (tlb_type == hypervisor) { | 358 | if (tlb_type == hypervisor) { |
363 | #if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) | 359 | #if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU) |
@@ -1227,9 +1223,9 @@ void __devinit smp_fill_in_sib_core_maps(void) | |||
1227 | } | 1223 | } |
1228 | } | 1224 | } |
1229 | 1225 | ||
1230 | int __cpuinit __cpu_up(unsigned int cpu) | 1226 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) |
1231 | { | 1227 | { |
1232 | int ret = smp_boot_one_cpu(cpu); | 1228 | int ret = smp_boot_one_cpu(cpu, tidle); |
1233 | 1229 | ||
1234 | if (!ret) { | 1230 | if (!ret) { |
1235 | cpumask_set_cpu(cpu, &smp_commenced_mask); | 1231 | cpumask_set_cpu(cpu, &smp_commenced_mask); |
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index 540b2fec09f0..4c11030dc1e8 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c | |||
@@ -127,18 +127,14 @@ void __init smp4d_boot_cpus(void) | |||
127 | local_flush_cache_all(); | 127 | local_flush_cache_all(); |
128 | } | 128 | } |
129 | 129 | ||
130 | int __cpuinit smp4d_boot_one_cpu(int i) | 130 | int __cpuinit smp4d_boot_one_cpu(int i, struct task_struct *idle) |
131 | { | 131 | { |
132 | unsigned long *entry = &sun4d_cpu_startup; | 132 | unsigned long *entry = &sun4d_cpu_startup; |
133 | struct task_struct *p; | ||
134 | int timeout; | 133 | int timeout; |
135 | int cpu_node; | 134 | int cpu_node; |
136 | 135 | ||
137 | cpu_find_by_instance(i, &cpu_node, NULL); | 136 | cpu_find_by_instance(i, &cpu_node, NULL); |
138 | /* Cook up an idler for this guy. */ | 137 | current_set[i] = task_thread_info(idle); |
139 | p = fork_idle(i); | ||
140 | current_set[i] = task_thread_info(p); | ||
141 | |||
142 | /* | 138 | /* |
143 | * Initialize the contexts table | 139 | * Initialize the contexts table |
144 | * Since the call to prom_startcpu() trashes the structure, | 140 | * Since the call to prom_startcpu() trashes the structure, |
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index 02db9a0412ce..579427359d4f 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c | |||
@@ -91,18 +91,15 @@ void __init smp4m_boot_cpus(void) | |||
91 | local_flush_cache_all(); | 91 | local_flush_cache_all(); |
92 | } | 92 | } |
93 | 93 | ||
94 | int __cpuinit smp4m_boot_one_cpu(int i) | 94 | int __cpuinit smp4m_boot_one_cpu(int i, struct task_struct *idle) |
95 | { | 95 | { |
96 | unsigned long *entry = &sun4m_cpu_startup; | 96 | unsigned long *entry = &sun4m_cpu_startup; |
97 | struct task_struct *p; | ||
98 | int timeout; | 97 | int timeout; |
99 | int cpu_node; | 98 | int cpu_node; |
100 | 99 | ||
101 | cpu_find_by_mid(i, &cpu_node); | 100 | cpu_find_by_mid(i, &cpu_node); |
101 | current_set[i] = task_thread_info(idle); | ||
102 | 102 | ||
103 | /* Cook up an idler for this guy. */ | ||
104 | p = fork_idle(i); | ||
105 | current_set[i] = task_thread_info(p); | ||
106 | /* See trampoline.S for details... */ | 103 | /* See trampoline.S for details... */ |
107 | entry += ((i - 1) * 3); | 104 | entry += ((i - 1) * 3); |
108 | 105 | ||
diff --git a/arch/tile/kernel/Makefile b/arch/tile/kernel/Makefile index b4dbc057baad..0d826faf8f35 100644 --- a/arch/tile/kernel/Makefile +++ b/arch/tile/kernel/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | extra-y := vmlinux.lds head_$(BITS).o | 5 | extra-y := vmlinux.lds head_$(BITS).o |
6 | obj-y := backtrace.o entry.o init_task.o irq.o messaging.o \ | 6 | obj-y := backtrace.o entry.o irq.o messaging.o \ |
7 | pci-dma.o proc.o process.o ptrace.o reboot.o \ | 7 | pci-dma.o proc.o process.o ptrace.o reboot.o \ |
8 | setup.o signal.o single_step.o stack.o sys.o sysfs.o time.o traps.o \ | 8 | setup.o signal.o single_step.o stack.o sys.o sysfs.o time.o traps.o \ |
9 | intvec_$(BITS).o regs_$(BITS).o tile-desc_$(BITS).o | 9 | intvec_$(BITS).o regs_$(BITS).o tile-desc_$(BITS).o |
diff --git a/arch/tile/kernel/init_task.c b/arch/tile/kernel/init_task.c deleted file mode 100644 index 928b31870669..000000000000 --- a/arch/tile/kernel/init_task.c +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2010 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/mm.h> | ||
16 | #include <linux/fs.h> | ||
17 | #include <linux/init_task.h> | ||
18 | #include <linux/mqueue.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/start_kernel.h> | ||
21 | #include <linux/uaccess.h> | ||
22 | |||
23 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
24 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
25 | |||
26 | /* | ||
27 | * Initial thread structure. | ||
28 | * | ||
29 | * We need to make sure that this is THREAD_SIZE aligned due to the | ||
30 | * way process stacks are handled. This is done by having a special | ||
31 | * "init_task" linker map entry.. | ||
32 | */ | ||
33 | union thread_union init_thread_union __init_task_data = { | ||
34 | INIT_THREAD_INFO(init_task) | ||
35 | }; | ||
36 | |||
37 | /* | ||
38 | * Initial task structure. | ||
39 | * | ||
40 | * All other task structs will be allocated on slabs in fork.c | ||
41 | */ | ||
42 | struct task_struct init_task = INIT_TASK(init_task); | ||
43 | EXPORT_SYMBOL(init_task); | ||
44 | |||
45 | /* | ||
46 | * per-CPU stack and boot info. | ||
47 | */ | ||
48 | DEFINE_PER_CPU(unsigned long, boot_sp) = | ||
49 | (unsigned long)init_stack + THREAD_SIZE; | ||
50 | |||
51 | #ifdef CONFIG_SMP | ||
52 | DEFINE_PER_CPU(unsigned long, boot_pc) = (unsigned long)start_kernel; | ||
53 | #else | ||
54 | /* | ||
55 | * The variable must be __initdata since it references __init code. | ||
56 | * With CONFIG_SMP it is per-cpu data, which is exempt from validation. | ||
57 | */ | ||
58 | unsigned long __initdata boot_pc = (unsigned long)start_kernel; | ||
59 | #endif | ||
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c index bff23f476110..98d80eb49ddb 100644 --- a/arch/tile/kernel/setup.c +++ b/arch/tile/kernel/setup.c | |||
@@ -61,6 +61,22 @@ unsigned long __initdata node_free_pfn[MAX_NUMNODES]; | |||
61 | 61 | ||
62 | static unsigned long __initdata node_percpu[MAX_NUMNODES]; | 62 | static unsigned long __initdata node_percpu[MAX_NUMNODES]; |
63 | 63 | ||
64 | /* | ||
65 | * per-CPU stack and boot info. | ||
66 | */ | ||
67 | DEFINE_PER_CPU(unsigned long, boot_sp) = | ||
68 | (unsigned long)init_stack + THREAD_SIZE; | ||
69 | |||
70 | #ifdef CONFIG_SMP | ||
71 | DEFINE_PER_CPU(unsigned long, boot_pc) = (unsigned long)start_kernel; | ||
72 | #else | ||
73 | /* | ||
74 | * The variable must be __initdata since it references __init code. | ||
75 | * With CONFIG_SMP it is per-cpu data, which is exempt from validation. | ||
76 | */ | ||
77 | unsigned long __initdata boot_pc = (unsigned long)start_kernel; | ||
78 | #endif | ||
79 | |||
64 | #ifdef CONFIG_HIGHMEM | 80 | #ifdef CONFIG_HIGHMEM |
65 | /* Page frame index of end of lowmem on each controller. */ | 81 | /* Page frame index of end of lowmem on each controller. */ |
66 | unsigned long __cpuinitdata node_lowmem_end_pfn[MAX_NUMNODES]; | 82 | unsigned long __cpuinitdata node_lowmem_end_pfn[MAX_NUMNODES]; |
diff --git a/arch/tile/kernel/smpboot.c b/arch/tile/kernel/smpboot.c index 172aef7d3159..84873fbe8f27 100644 --- a/arch/tile/kernel/smpboot.c +++ b/arch/tile/kernel/smpboot.c | |||
@@ -222,7 +222,7 @@ void __cpuinit online_secondary(void) | |||
222 | cpu_idle(); | 222 | cpu_idle(); |
223 | } | 223 | } |
224 | 224 | ||
225 | int __cpuinit __cpu_up(unsigned int cpu) | 225 | int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *tidle) |
226 | { | 226 | { |
227 | /* Wait 5s total for all CPUs for them to come online */ | 227 | /* Wait 5s total for all CPUs for them to come online */ |
228 | static int timeout; | 228 | static int timeout; |
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile index 65a1c3d690ea..babe21826e3e 100644 --- a/arch/um/kernel/Makefile +++ b/arch/um/kernel/Makefile | |||
@@ -10,7 +10,7 @@ CPPFLAGS_vmlinux.lds := -DSTART=$(LDS_START) \ | |||
10 | extra-y := vmlinux.lds | 10 | extra-y := vmlinux.lds |
11 | clean-files := | 11 | clean-files := |
12 | 12 | ||
13 | obj-y = config.o exec.o exitcode.o init_task.o irq.o ksyms.o mem.o \ | 13 | obj-y = config.o exec.o exitcode.o irq.o ksyms.o mem.o \ |
14 | physmem.o process.o ptrace.o reboot.o sigio.o \ | 14 | physmem.o process.o ptrace.o reboot.o sigio.o \ |
15 | signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \ | 15 | signal.o smp.o syscall.o sysrq.o time.o tlb.o trap.o \ |
16 | um_arch.o umid.o skas/ | 16 | um_arch.o umid.o skas/ |
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c deleted file mode 100644 index ddc9698b66ed..000000000000 --- a/arch/um/kernel/init_task.c +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,intel.linux}.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include "linux/sched.h" | ||
7 | #include "linux/init_task.h" | ||
8 | #include "linux/fs.h" | ||
9 | #include "linux/module.h" | ||
10 | #include "linux/mqueue.h" | ||
11 | #include "asm/uaccess.h" | ||
12 | |||
13 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
14 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
15 | /* | ||
16 | * Initial task structure. | ||
17 | * | ||
18 | * All other task structs will be allocated on slabs in fork.c | ||
19 | */ | ||
20 | |||
21 | struct task_struct init_task = INIT_TASK(init_task); | ||
22 | |||
23 | EXPORT_SYMBOL(init_task); | ||
24 | |||
25 | /* | ||
26 | * Initial thread structure. | ||
27 | * | ||
28 | * We need to make sure that this is aligned due to the | ||
29 | * way process stacks are handled. This is done by having a special | ||
30 | * "init_task" linker map entry.. | ||
31 | */ | ||
32 | |||
33 | union thread_union init_thread_union __init_task_data = | ||
34 | { INIT_THREAD_INFO(init_task) }; | ||
35 | |||
36 | union thread_union cpu0_irqstack | ||
37 | __attribute__((__section__(".data..init_irqstack"))) = | ||
38 | { INIT_THREAD_INFO(init_task) }; | ||
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c index 6f588e160fb0..a02b7e9e6b94 100644 --- a/arch/um/kernel/smp.c +++ b/arch/um/kernel/smp.c | |||
@@ -140,7 +140,7 @@ void smp_prepare_boot_cpu(void) | |||
140 | set_cpu_online(smp_processor_id(), true); | 140 | set_cpu_online(smp_processor_id(), true); |
141 | } | 141 | } |
142 | 142 | ||
143 | int __cpu_up(unsigned int cpu) | 143 | int __cpu_up(unsigned int cpu, struct task_struct *tidle) |
144 | { | 144 | { |
145 | cpu_set(cpu, smp_commenced_mask); | 145 | cpu_set(cpu, smp_commenced_mask); |
146 | while (!cpu_online(cpu)) | 146 | while (!cpu_online(cpu)) |
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index ba00eae45aad..4db8770906ca 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/seq_file.h> | 10 | #include <linux/seq_file.h> |
11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
12 | #include <linux/utsname.h> | 12 | #include <linux/utsname.h> |
13 | #include <linux/sched.h> | ||
13 | #include <asm/pgtable.h> | 14 | #include <asm/pgtable.h> |
14 | #include <asm/processor.h> | 15 | #include <asm/processor.h> |
15 | #include <asm/setup.h> | 16 | #include <asm/setup.h> |
@@ -47,6 +48,10 @@ struct cpuinfo_um boot_cpu_data = { | |||
47 | .ipi_pipe = { -1, -1 } | 48 | .ipi_pipe = { -1, -1 } |
48 | }; | 49 | }; |
49 | 50 | ||
51 | union thread_union cpu0_irqstack | ||
52 | __attribute__((__section__(".data..init_irqstack"))) = | ||
53 | { INIT_THREAD_INFO(init_task) }; | ||
54 | |||
50 | unsigned long thread_saved_pc(struct task_struct *task) | 55 | unsigned long thread_saved_pc(struct task_struct *task) |
51 | { | 56 | { |
52 | /* FIXME: Need to look up userspace_pid by cpu */ | 57 | /* FIXME: Need to look up userspace_pid by cpu */ |
diff --git a/arch/unicore32/Makefile b/arch/unicore32/Makefile index 6af4bc415f2b..b6f5c4c1eaf9 100644 --- a/arch/unicore32/Makefile +++ b/arch/unicore32/Makefile | |||
@@ -33,7 +33,6 @@ endif | |||
33 | CHECKFLAGS += -D__unicore32__ | 33 | CHECKFLAGS += -D__unicore32__ |
34 | 34 | ||
35 | head-y := arch/unicore32/kernel/head.o | 35 | head-y := arch/unicore32/kernel/head.o |
36 | head-y += arch/unicore32/kernel/init_task.o | ||
37 | 36 | ||
38 | core-y += arch/unicore32/kernel/ | 37 | core-y += arch/unicore32/kernel/ |
39 | core-y += arch/unicore32/mm/ | 38 | core-y += arch/unicore32/mm/ |
diff --git a/arch/unicore32/kernel/Makefile b/arch/unicore32/kernel/Makefile index aeb0f181568e..324010156958 100644 --- a/arch/unicore32/kernel/Makefile +++ b/arch/unicore32/kernel/Makefile | |||
@@ -29,4 +29,4 @@ obj-$(CONFIG_PUV3_NB0916) += puv3-nb0916.o | |||
29 | head-y := head.o | 29 | head-y := head.o |
30 | obj-$(CONFIG_DEBUG_LL) += debug.o | 30 | obj-$(CONFIG_DEBUG_LL) += debug.o |
31 | 31 | ||
32 | extra-y := $(head-y) init_task.o vmlinux.lds | 32 | extra-y := $(head-y) vmlinux.lds |
diff --git a/arch/unicore32/kernel/init_task.c b/arch/unicore32/kernel/init_task.c deleted file mode 100644 index a35a1e50e4f4..000000000000 --- a/arch/unicore32/kernel/init_task.c +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/unicore32/kernel/init_task.c | ||
3 | * | ||
4 | * Code specific to PKUnity SoC and UniCore ISA | ||
5 | * | ||
6 | * Copyright (C) 2001-2010 GUAN Xue-tao | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #include <linux/mm.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/fs.h> | ||
15 | #include <linux/sched.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/init_task.h> | ||
18 | #include <linux/mqueue.h> | ||
19 | #include <linux/uaccess.h> | ||
20 | |||
21 | #include <asm/pgtable.h> | ||
22 | |||
23 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
24 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
25 | /* | ||
26 | * Initial thread structure. | ||
27 | * | ||
28 | * We need to make sure that this is 8192-byte aligned due to the | ||
29 | * way process stacks are handled. This is done by making sure | ||
30 | * the linker maps this in the .text segment right after head.S, | ||
31 | * and making head.S ensure the proper alignment. | ||
32 | * | ||
33 | * The things we do for performance.. | ||
34 | */ | ||
35 | union thread_union init_thread_union __init_task_data = { | ||
36 | INIT_THREAD_INFO(init_task) }; | ||
37 | |||
38 | /* | ||
39 | * Initial task structure. | ||
40 | * | ||
41 | * All other task structs will be allocated on slabs in fork.c | ||
42 | */ | ||
43 | struct task_struct init_task = INIT_TASK(init_task); | ||
44 | EXPORT_SYMBOL(init_task); | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1d14cc6b79ad..98876f55a2e0 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -82,6 +82,7 @@ config X86 | |||
82 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 82 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
83 | select GENERIC_IOMAP | 83 | select GENERIC_IOMAP |
84 | select DCACHE_WORD_ACCESS if !DEBUG_PAGEALLOC | 84 | select DCACHE_WORD_ACCESS if !DEBUG_PAGEALLOC |
85 | select GENERIC_SMP_IDLE_THREAD | ||
85 | 86 | ||
86 | config INSTRUCTION_DECODER | 87 | config INSTRUCTION_DECODER |
87 | def_bool (KPROBES || PERF_EVENTS) | 88 | def_bool (KPROBES || PERF_EVENTS) |
@@ -160,9 +161,6 @@ config RWSEM_GENERIC_SPINLOCK | |||
160 | config RWSEM_XCHGADD_ALGORITHM | 161 | config RWSEM_XCHGADD_ALGORITHM |
161 | def_bool X86_XADD | 162 | def_bool X86_XADD |
162 | 163 | ||
163 | config ARCH_HAS_CPU_IDLE_WAIT | ||
164 | def_bool y | ||
165 | |||
166 | config GENERIC_CALIBRATE_DELAY | 164 | config GENERIC_CALIBRATE_DELAY |
167 | def_bool y | 165 | def_bool y |
168 | 166 | ||
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 41a7237606a3..3e48b26f67d5 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -146,7 +146,6 @@ archheaders: | |||
146 | head-y := arch/x86/kernel/head_$(BITS).o | 146 | head-y := arch/x86/kernel/head_$(BITS).o |
147 | head-y += arch/x86/kernel/head$(BITS).o | 147 | head-y += arch/x86/kernel/head$(BITS).o |
148 | head-y += arch/x86/kernel/head.o | 148 | head-y += arch/x86/kernel/head.o |
149 | head-y += arch/x86/kernel/init_task.o | ||
150 | 149 | ||
151 | libs-y += arch/x86/lib/ | 150 | libs-y += arch/x86/lib/ |
152 | 151 | ||
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 4fa7dcceb6c0..ccbb1ea99ccb 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -974,8 +974,6 @@ extern bool cpu_has_amd_erratum(const int *); | |||
974 | #define cpu_has_amd_erratum(x) (false) | 974 | #define cpu_has_amd_erratum(x) (false) |
975 | #endif /* CONFIG_CPU_SUP_AMD */ | 975 | #endif /* CONFIG_CPU_SUP_AMD */ |
976 | 976 | ||
977 | void cpu_idle_wait(void); | ||
978 | |||
979 | extern unsigned long arch_align_stack(unsigned long sp); | 977 | extern unsigned long arch_align_stack(unsigned long sp); |
980 | extern void free_init_pages(char *what, unsigned long begin, unsigned long end); | 978 | extern void free_init_pages(char *what, unsigned long begin, unsigned long end); |
981 | 979 | ||
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 0434c400287c..f8cbc6f20e31 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
@@ -62,6 +62,8 @@ DECLARE_EARLY_PER_CPU(int, x86_cpu_to_logical_apicid); | |||
62 | /* Static state in head.S used to set up a CPU */ | 62 | /* Static state in head.S used to set up a CPU */ |
63 | extern unsigned long stack_start; /* Initial stack pointer address */ | 63 | extern unsigned long stack_start; /* Initial stack pointer address */ |
64 | 64 | ||
65 | struct task_struct; | ||
66 | |||
65 | struct smp_ops { | 67 | struct smp_ops { |
66 | void (*smp_prepare_boot_cpu)(void); | 68 | void (*smp_prepare_boot_cpu)(void); |
67 | void (*smp_prepare_cpus)(unsigned max_cpus); | 69 | void (*smp_prepare_cpus)(unsigned max_cpus); |
@@ -70,7 +72,7 @@ struct smp_ops { | |||
70 | void (*stop_other_cpus)(int wait); | 72 | void (*stop_other_cpus)(int wait); |
71 | void (*smp_send_reschedule)(int cpu); | 73 | void (*smp_send_reschedule)(int cpu); |
72 | 74 | ||
73 | int (*cpu_up)(unsigned cpu); | 75 | int (*cpu_up)(unsigned cpu, struct task_struct *tidle); |
74 | int (*cpu_disable)(void); | 76 | int (*cpu_disable)(void); |
75 | void (*cpu_die)(unsigned int cpu); | 77 | void (*cpu_die)(unsigned int cpu); |
76 | void (*play_dead)(void); | 78 | void (*play_dead)(void); |
@@ -113,9 +115,9 @@ static inline void smp_cpus_done(unsigned int max_cpus) | |||
113 | smp_ops.smp_cpus_done(max_cpus); | 115 | smp_ops.smp_cpus_done(max_cpus); |
114 | } | 116 | } |
115 | 117 | ||
116 | static inline int __cpu_up(unsigned int cpu) | 118 | static inline int __cpu_up(unsigned int cpu, struct task_struct *tidle) |
117 | { | 119 | { |
118 | return smp_ops.cpu_up(cpu); | 120 | return smp_ops.cpu_up(cpu, tidle); |
119 | } | 121 | } |
120 | 122 | ||
121 | static inline int __cpu_disable(void) | 123 | static inline int __cpu_disable(void) |
@@ -152,7 +154,7 @@ void cpu_disable_common(void); | |||
152 | void native_smp_prepare_boot_cpu(void); | 154 | void native_smp_prepare_boot_cpu(void); |
153 | void native_smp_prepare_cpus(unsigned int max_cpus); | 155 | void native_smp_prepare_cpus(unsigned int max_cpus); |
154 | void native_smp_cpus_done(unsigned int max_cpus); | 156 | void native_smp_cpus_done(unsigned int max_cpus); |
155 | int native_cpu_up(unsigned int cpunum); | 157 | int native_cpu_up(unsigned int cpunum, struct task_struct *tidle); |
156 | int native_cpu_disable(void); | 158 | int native_cpu_disable(void); |
157 | void native_cpu_die(unsigned int cpu); | 159 | void native_cpu_die(unsigned int cpu); |
158 | void native_play_dead(void); | 160 | void native_play_dead(void); |
@@ -162,6 +164,7 @@ int wbinvd_on_all_cpus(void); | |||
162 | 164 | ||
163 | void native_send_call_func_ipi(const struct cpumask *mask); | 165 | void native_send_call_func_ipi(const struct cpumask *mask); |
164 | void native_send_call_func_single_ipi(int cpu); | 166 | void native_send_call_func_single_ipi(int cpu); |
167 | void x86_idle_thread_init(unsigned int cpu, struct task_struct *idle); | ||
165 | 168 | ||
166 | void smp_store_cpu_info(int id); | 169 | void smp_store_cpu_info(int id); |
167 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) | 170 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) |
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 532d2e090e6f..56ebd1f98447 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | extra-y := head_$(BITS).o head$(BITS).o head.o init_task.o vmlinux.lds | 5 | extra-y := head_$(BITS).o head$(BITS).o head.o vmlinux.lds |
6 | 6 | ||
7 | CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE) | 7 | CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE) |
8 | 8 | ||
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 459e78cbf61e..07b0c0db466c 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
@@ -2401,7 +2401,7 @@ static void __exit apm_exit(void) | |||
2401 | * (pm_idle), Wait for all processors to update cached/local | 2401 | * (pm_idle), Wait for all processors to update cached/local |
2402 | * copies of pm_idle before proceeding. | 2402 | * copies of pm_idle before proceeding. |
2403 | */ | 2403 | */ |
2404 | cpu_idle_wait(); | 2404 | kick_all_cpus_sync(); |
2405 | } | 2405 | } |
2406 | if (((apm_info.bios.flags & APM_BIOS_DISENGAGED) == 0) | 2406 | if (((apm_info.bios.flags & APM_BIOS_DISENGAGED) == 0) |
2407 | && (apm_info.connection_version > 0x0100)) { | 2407 | && (apm_info.connection_version > 0x0100)) { |
diff --git a/arch/x86/kernel/init_task.c b/arch/x86/kernel/init_task.c deleted file mode 100644 index 43e9ccf44947..000000000000 --- a/arch/x86/kernel/init_task.c +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | #include <linux/mm.h> | ||
2 | #include <linux/module.h> | ||
3 | #include <linux/sched.h> | ||
4 | #include <linux/init.h> | ||
5 | #include <linux/init_task.h> | ||
6 | #include <linux/fs.h> | ||
7 | #include <linux/mqueue.h> | ||
8 | |||
9 | #include <asm/uaccess.h> | ||
10 | #include <asm/pgtable.h> | ||
11 | #include <asm/desc.h> | ||
12 | |||
13 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
14 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
15 | |||
16 | /* | ||
17 | * Initial thread structure. | ||
18 | * | ||
19 | * We need to make sure that this is THREAD_SIZE aligned due to the | ||
20 | * way process stacks are handled. This is done by having a special | ||
21 | * "init_task" linker map entry.. | ||
22 | */ | ||
23 | union thread_union init_thread_union __init_task_data = | ||
24 | { INIT_THREAD_INFO(init_task) }; | ||
25 | |||
26 | /* | ||
27 | * Initial task structure. | ||
28 | * | ||
29 | * All other task structs will be allocated on slabs in fork.c | ||
30 | */ | ||
31 | struct task_struct init_task = INIT_TASK(init_task); | ||
32 | EXPORT_SYMBOL(init_task); | ||
33 | |||
34 | /* | ||
35 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, | ||
36 | * no more per-task TSS's. The TSS size is kept cacheline-aligned | ||
37 | * so they are allowed to end up in the .data..cacheline_aligned | ||
38 | * section. Since TSS's are completely CPU-local, we want them | ||
39 | * on exact cacheline boundaries, to eliminate cacheline ping-pong. | ||
40 | */ | ||
41 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS; | ||
42 | |||
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 1d92a5ab6e8b..8215458f6af5 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -27,6 +27,15 @@ | |||
27 | #include <asm/debugreg.h> | 27 | #include <asm/debugreg.h> |
28 | #include <asm/nmi.h> | 28 | #include <asm/nmi.h> |
29 | 29 | ||
30 | /* | ||
31 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, | ||
32 | * no more per-task TSS's. The TSS size is kept cacheline-aligned | ||
33 | * so they are allowed to end up in the .data..cacheline_aligned | ||
34 | * section. Since TSS's are completely CPU-local, we want them | ||
35 | * on exact cacheline boundaries, to eliminate cacheline ping-pong. | ||
36 | */ | ||
37 | DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS; | ||
38 | |||
30 | #ifdef CONFIG_X86_64 | 39 | #ifdef CONFIG_X86_64 |
31 | static DEFINE_PER_CPU(unsigned char, is_idle); | 40 | static DEFINE_PER_CPU(unsigned char, is_idle); |
32 | static ATOMIC_NOTIFIER_HEAD(idle_notifier); | 41 | static ATOMIC_NOTIFIER_HEAD(idle_notifier); |
@@ -516,26 +525,6 @@ void stop_this_cpu(void *dummy) | |||
516 | } | 525 | } |
517 | } | 526 | } |
518 | 527 | ||
519 | static void do_nothing(void *unused) | ||
520 | { | ||
521 | } | ||
522 | |||
523 | /* | ||
524 | * cpu_idle_wait - Used to ensure that all the CPUs discard old value of | ||
525 | * pm_idle and update to new pm_idle value. Required while changing pm_idle | ||
526 | * handler on SMP systems. | ||
527 | * | ||
528 | * Caller must have changed pm_idle to the new value before the call. Old | ||
529 | * pm_idle value will not be used by any CPU after the return of this function. | ||
530 | */ | ||
531 | void cpu_idle_wait(void) | ||
532 | { | ||
533 | smp_mb(); | ||
534 | /* kick all the CPUs so that they exit out of pm_idle */ | ||
535 | smp_call_function(do_nothing, NULL, 1); | ||
536 | } | ||
537 | EXPORT_SYMBOL_GPL(cpu_idle_wait); | ||
538 | |||
539 | /* Default MONITOR/MWAIT with no hints, used for default C1 state */ | 528 | /* Default MONITOR/MWAIT with no hints, used for default C1 state */ |
540 | static void mwait_idle(void) | 529 | static void mwait_idle(void) |
541 | { | 530 | { |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 6e1e406038c2..3acaf51dfddb 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -76,20 +76,8 @@ | |||
76 | /* State of each CPU */ | 76 | /* State of each CPU */ |
77 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; | 77 | DEFINE_PER_CPU(int, cpu_state) = { 0 }; |
78 | 78 | ||
79 | /* Store all idle threads, this can be reused instead of creating | ||
80 | * a new thread. Also avoids complicated thread destroy functionality | ||
81 | * for idle threads. | ||
82 | */ | ||
83 | #ifdef CONFIG_HOTPLUG_CPU | 79 | #ifdef CONFIG_HOTPLUG_CPU |
84 | /* | 80 | /* |
85 | * Needed only for CONFIG_HOTPLUG_CPU because __cpuinitdata is | ||
86 | * removed after init for !CONFIG_HOTPLUG_CPU. | ||
87 | */ | ||
88 | static DEFINE_PER_CPU(struct task_struct *, idle_thread_array); | ||
89 | #define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x)) | ||
90 | #define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p)) | ||
91 | |||
92 | /* | ||
93 | * We need this for trampoline_base protection from concurrent accesses when | 81 | * We need this for trampoline_base protection from concurrent accesses when |
94 | * off- and onlining cores wildly. | 82 | * off- and onlining cores wildly. |
95 | */ | 83 | */ |
@@ -97,20 +85,16 @@ static DEFINE_MUTEX(x86_cpu_hotplug_driver_mutex); | |||
97 | 85 | ||
98 | void cpu_hotplug_driver_lock(void) | 86 | void cpu_hotplug_driver_lock(void) |
99 | { | 87 | { |
100 | mutex_lock(&x86_cpu_hotplug_driver_mutex); | 88 | mutex_lock(&x86_cpu_hotplug_driver_mutex); |
101 | } | 89 | } |
102 | 90 | ||
103 | void cpu_hotplug_driver_unlock(void) | 91 | void cpu_hotplug_driver_unlock(void) |
104 | { | 92 | { |
105 | mutex_unlock(&x86_cpu_hotplug_driver_mutex); | 93 | mutex_unlock(&x86_cpu_hotplug_driver_mutex); |
106 | } | 94 | } |
107 | 95 | ||
108 | ssize_t arch_cpu_probe(const char *buf, size_t count) { return -1; } | 96 | ssize_t arch_cpu_probe(const char *buf, size_t count) { return -1; } |
109 | ssize_t arch_cpu_release(const char *buf, size_t count) { return -1; } | 97 | ssize_t arch_cpu_release(const char *buf, size_t count) { return -1; } |
110 | #else | ||
111 | static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ; | ||
112 | #define get_idle_for_cpu(x) (idle_thread_array[(x)]) | ||
113 | #define set_idle_for_cpu(x, p) (idle_thread_array[(x)] = (p)) | ||
114 | #endif | 98 | #endif |
115 | 99 | ||
116 | /* Number of siblings per CPU package */ | 100 | /* Number of siblings per CPU package */ |
@@ -618,22 +602,6 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip) | |||
618 | return (send_status | accept_status); | 602 | return (send_status | accept_status); |
619 | } | 603 | } |
620 | 604 | ||
621 | struct create_idle { | ||
622 | struct work_struct work; | ||
623 | struct task_struct *idle; | ||
624 | struct completion done; | ||
625 | int cpu; | ||
626 | }; | ||
627 | |||
628 | static void __cpuinit do_fork_idle(struct work_struct *work) | ||
629 | { | ||
630 | struct create_idle *c_idle = | ||
631 | container_of(work, struct create_idle, work); | ||
632 | |||
633 | c_idle->idle = fork_idle(c_idle->cpu); | ||
634 | complete(&c_idle->done); | ||
635 | } | ||
636 | |||
637 | /* reduce the number of lines printed when booting a large cpu count system */ | 605 | /* reduce the number of lines printed when booting a large cpu count system */ |
638 | static void __cpuinit announce_cpu(int cpu, int apicid) | 606 | static void __cpuinit announce_cpu(int cpu, int apicid) |
639 | { | 607 | { |
@@ -660,58 +628,31 @@ static void __cpuinit announce_cpu(int cpu, int apicid) | |||
660 | * Returns zero if CPU booted OK, else error code from | 628 | * Returns zero if CPU booted OK, else error code from |
661 | * ->wakeup_secondary_cpu. | 629 | * ->wakeup_secondary_cpu. |
662 | */ | 630 | */ |
663 | static int __cpuinit do_boot_cpu(int apicid, int cpu) | 631 | static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle) |
664 | { | 632 | { |
665 | unsigned long boot_error = 0; | 633 | unsigned long boot_error = 0; |
666 | unsigned long start_ip; | 634 | unsigned long start_ip; |
667 | int timeout; | 635 | int timeout; |
668 | struct create_idle c_idle = { | ||
669 | .cpu = cpu, | ||
670 | .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), | ||
671 | }; | ||
672 | |||
673 | INIT_WORK_ONSTACK(&c_idle.work, do_fork_idle); | ||
674 | 636 | ||
675 | alternatives_smp_switch(1); | 637 | alternatives_smp_switch(1); |
676 | 638 | ||
677 | c_idle.idle = get_idle_for_cpu(cpu); | 639 | idle->thread.sp = (unsigned long) (((struct pt_regs *) |
678 | 640 | (THREAD_SIZE + task_stack_page(idle))) - 1); | |
679 | /* | 641 | per_cpu(current_task, cpu) = idle; |
680 | * We can't use kernel_thread since we must avoid to | ||
681 | * reschedule the child. | ||
682 | */ | ||
683 | if (c_idle.idle) { | ||
684 | c_idle.idle->thread.sp = (unsigned long) (((struct pt_regs *) | ||
685 | (THREAD_SIZE + task_stack_page(c_idle.idle))) - 1); | ||
686 | init_idle(c_idle.idle, cpu); | ||
687 | goto do_rest; | ||
688 | } | ||
689 | 642 | ||
690 | schedule_work(&c_idle.work); | ||
691 | wait_for_completion(&c_idle.done); | ||
692 | |||
693 | if (IS_ERR(c_idle.idle)) { | ||
694 | printk("failed fork for CPU %d\n", cpu); | ||
695 | destroy_work_on_stack(&c_idle.work); | ||
696 | return PTR_ERR(c_idle.idle); | ||
697 | } | ||
698 | |||
699 | set_idle_for_cpu(cpu, c_idle.idle); | ||
700 | do_rest: | ||
701 | per_cpu(current_task, cpu) = c_idle.idle; | ||
702 | #ifdef CONFIG_X86_32 | 643 | #ifdef CONFIG_X86_32 |
703 | /* Stack for startup_32 can be just as for start_secondary onwards */ | 644 | /* Stack for startup_32 can be just as for start_secondary onwards */ |
704 | irq_ctx_init(cpu); | 645 | irq_ctx_init(cpu); |
705 | #else | 646 | #else |
706 | clear_tsk_thread_flag(c_idle.idle, TIF_FORK); | 647 | clear_tsk_thread_flag(idle, TIF_FORK); |
707 | initial_gs = per_cpu_offset(cpu); | 648 | initial_gs = per_cpu_offset(cpu); |
708 | per_cpu(kernel_stack, cpu) = | 649 | per_cpu(kernel_stack, cpu) = |
709 | (unsigned long)task_stack_page(c_idle.idle) - | 650 | (unsigned long)task_stack_page(idle) - |
710 | KERNEL_STACK_OFFSET + THREAD_SIZE; | 651 | KERNEL_STACK_OFFSET + THREAD_SIZE; |
711 | #endif | 652 | #endif |
712 | early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); | 653 | early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); |
713 | initial_code = (unsigned long)start_secondary; | 654 | initial_code = (unsigned long)start_secondary; |
714 | stack_start = c_idle.idle->thread.sp; | 655 | stack_start = idle->thread.sp; |
715 | 656 | ||
716 | /* start_ip had better be page-aligned! */ | 657 | /* start_ip had better be page-aligned! */ |
717 | start_ip = trampoline_address(); | 658 | start_ip = trampoline_address(); |
@@ -813,12 +754,10 @@ do_rest: | |||
813 | */ | 754 | */ |
814 | smpboot_restore_warm_reset_vector(); | 755 | smpboot_restore_warm_reset_vector(); |
815 | } | 756 | } |
816 | |||
817 | destroy_work_on_stack(&c_idle.work); | ||
818 | return boot_error; | 757 | return boot_error; |
819 | } | 758 | } |
820 | 759 | ||
821 | int __cpuinit native_cpu_up(unsigned int cpu) | 760 | int __cpuinit native_cpu_up(unsigned int cpu, struct task_struct *tidle) |
822 | { | 761 | { |
823 | int apicid = apic->cpu_present_to_apicid(cpu); | 762 | int apicid = apic->cpu_present_to_apicid(cpu); |
824 | unsigned long flags; | 763 | unsigned long flags; |
@@ -851,7 +790,7 @@ int __cpuinit native_cpu_up(unsigned int cpu) | |||
851 | 790 | ||
852 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; | 791 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; |
853 | 792 | ||
854 | err = do_boot_cpu(apicid, cpu); | 793 | err = do_boot_cpu(apicid, cpu, tidle); |
855 | if (err) { | 794 | if (err) { |
856 | pr_debug("do_boot_cpu failed %d\n", err); | 795 | pr_debug("do_boot_cpu failed %d\n", err); |
857 | return -EIO; | 796 | return -EIO; |
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index 0503c0c493a9..3700945ed0d5 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
@@ -265,18 +265,8 @@ static void __init xen_smp_prepare_cpus(unsigned int max_cpus) | |||
265 | set_cpu_possible(cpu, false); | 265 | set_cpu_possible(cpu, false); |
266 | } | 266 | } |
267 | 267 | ||
268 | for_each_possible_cpu (cpu) { | 268 | for_each_possible_cpu(cpu) |
269 | struct task_struct *idle; | ||
270 | |||
271 | if (cpu == 0) | ||
272 | continue; | ||
273 | |||
274 | idle = fork_idle(cpu); | ||
275 | if (IS_ERR(idle)) | ||
276 | panic("failed fork for CPU %d", cpu); | ||
277 | |||
278 | set_cpu_present(cpu, true); | 269 | set_cpu_present(cpu, true); |
279 | } | ||
280 | } | 270 | } |
281 | 271 | ||
282 | static int __cpuinit | 272 | static int __cpuinit |
@@ -346,9 +336,8 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle) | |||
346 | return 0; | 336 | return 0; |
347 | } | 337 | } |
348 | 338 | ||
349 | static int __cpuinit xen_cpu_up(unsigned int cpu) | 339 | static int __cpuinit xen_cpu_up(unsigned int cpu, struct task_struct *idle) |
350 | { | 340 | { |
351 | struct task_struct *idle = idle_task(cpu); | ||
352 | int rc; | 341 | int rc; |
353 | 342 | ||
354 | per_cpu(current_task, cpu) = idle; | 343 | per_cpu(current_task, cpu) = idle; |
@@ -562,10 +551,10 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus) | |||
562 | xen_init_lock_cpu(0); | 551 | xen_init_lock_cpu(0); |
563 | } | 552 | } |
564 | 553 | ||
565 | static int __cpuinit xen_hvm_cpu_up(unsigned int cpu) | 554 | static int __cpuinit xen_hvm_cpu_up(unsigned int cpu, struct task_struct *tidle) |
566 | { | 555 | { |
567 | int rc; | 556 | int rc; |
568 | rc = native_cpu_up(cpu); | 557 | rc = native_cpu_up(cpu, tidle); |
569 | WARN_ON (xen_smp_intr_init(cpu)); | 558 | WARN_ON (xen_smp_intr_init(cpu)); |
570 | return rc; | 559 | return rc; |
571 | } | 560 | } |
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile index 2d2728b3e862..59fc3fe15572 100644 --- a/arch/xtensa/kernel/Makefile +++ b/arch/xtensa/kernel/Makefile | |||
@@ -6,7 +6,7 @@ extra-y := head.o vmlinux.lds | |||
6 | 6 | ||
7 | obj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o \ | 7 | obj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o \ |
8 | setup.o signal.o syscall.o time.o traps.o vectors.o platform.o \ | 8 | setup.o signal.o syscall.o time.o traps.o vectors.o platform.o \ |
9 | pci-dma.o init_task.o io.o | 9 | pci-dma.o io.o |
10 | 10 | ||
11 | obj-$(CONFIG_KGDB) += xtensa-stub.o | 11 | obj-$(CONFIG_KGDB) += xtensa-stub.o |
12 | obj-$(CONFIG_PCI) += pci.o | 12 | obj-$(CONFIG_PCI) += pci.o |
diff --git a/arch/xtensa/kernel/init_task.c b/arch/xtensa/kernel/init_task.c deleted file mode 100644 index cd122fb7e48a..000000000000 --- a/arch/xtensa/kernel/init_task.c +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* | ||
2 | * arch/xtensa/kernel/init_task.c | ||
3 | * | ||
4 | * Xtensa Processor version. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copyright (C) 2007 Tensilica Inc. | ||
11 | * | ||
12 | * Chris Zankel <chris@zankel.net> | ||
13 | */ | ||
14 | |||
15 | #include <linux/mm.h> | ||
16 | #include <linux/fs.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/init_task.h> | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/mqueue.h> | ||
21 | |||
22 | #include <asm/uaccess.h> | ||
23 | |||
24 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | ||
25 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | ||
26 | union thread_union init_thread_union __init_task_data = | ||
27 | { INIT_THREAD_INFO(init_task) }; | ||
28 | |||
29 | struct task_struct init_task = INIT_TASK(init_task); | ||
30 | |||
31 | EXPORT_SYMBOL(init_task); | ||
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 2f0083a51a9a..d90519cec880 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -40,17 +40,6 @@ void disable_cpuidle(void) | |||
40 | off = 1; | 40 | off = 1; |
41 | } | 41 | } |
42 | 42 | ||
43 | #if defined(CONFIG_ARCH_HAS_CPU_IDLE_WAIT) | ||
44 | static void cpuidle_kick_cpus(void) | ||
45 | { | ||
46 | cpu_idle_wait(); | ||
47 | } | ||
48 | #elif defined(CONFIG_SMP) | ||
49 | # error "Arch needs cpu_idle_wait() equivalent here" | ||
50 | #else /* !CONFIG_ARCH_HAS_CPU_IDLE_WAIT && !CONFIG_SMP */ | ||
51 | static void cpuidle_kick_cpus(void) {} | ||
52 | #endif | ||
53 | |||
54 | static int __cpuidle_register_device(struct cpuidle_device *dev); | 43 | static int __cpuidle_register_device(struct cpuidle_device *dev); |
55 | 44 | ||
56 | static inline int cpuidle_enter(struct cpuidle_device *dev, | 45 | static inline int cpuidle_enter(struct cpuidle_device *dev, |
@@ -186,7 +175,7 @@ void cpuidle_uninstall_idle_handler(void) | |||
186 | { | 175 | { |
187 | if (enabled_devices) { | 176 | if (enabled_devices) { |
188 | initialized = 0; | 177 | initialized = 0; |
189 | cpuidle_kick_cpus(); | 178 | kick_all_cpus_sync(); |
190 | } | 179 | } |
191 | } | 180 | } |
192 | 181 | ||
diff --git a/include/linux/smp.h b/include/linux/smp.h index 10530d92c04b..717fb746c9a8 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -61,7 +61,7 @@ extern void smp_prepare_cpus(unsigned int max_cpus); | |||
61 | /* | 61 | /* |
62 | * Bring a CPU up | 62 | * Bring a CPU up |
63 | */ | 63 | */ |
64 | extern int __cpu_up(unsigned int cpunum); | 64 | extern int __cpu_up(unsigned int cpunum, struct task_struct *tidle); |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * Final polishing of CPUs | 67 | * Final polishing of CPUs |
@@ -81,6 +81,8 @@ void __smp_call_function_single(int cpuid, struct call_single_data *data, | |||
81 | int smp_call_function_any(const struct cpumask *mask, | 81 | int smp_call_function_any(const struct cpumask *mask, |
82 | smp_call_func_t func, void *info, int wait); | 82 | smp_call_func_t func, void *info, int wait); |
83 | 83 | ||
84 | void kick_all_cpus_sync(void); | ||
85 | |||
84 | /* | 86 | /* |
85 | * Generic and arch helpers | 87 | * Generic and arch helpers |
86 | */ | 88 | */ |
@@ -192,6 +194,8 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func, | |||
192 | return smp_call_function_single(0, func, info, wait); | 194 | return smp_call_function_single(0, func, info, wait); |
193 | } | 195 | } |
194 | 196 | ||
197 | static inline void kick_all_cpus_sync(void) { } | ||
198 | |||
195 | #endif /* !SMP */ | 199 | #endif /* !SMP */ |
196 | 200 | ||
197 | /* | 201 | /* |
diff --git a/init/Makefile b/init/Makefile index 0bf677aa0872..7bc47ee31c36 100644 --- a/init/Makefile +++ b/init/Makefile | |||
@@ -10,6 +10,10 @@ obj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o | |||
10 | endif | 10 | endif |
11 | obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o | 11 | obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o |
12 | 12 | ||
13 | ifneq ($(CONFIG_ARCH_INIT_TASK),y) | ||
14 | obj-y += init_task.o | ||
15 | endif | ||
16 | |||
13 | mounts-y := do_mounts.o | 17 | mounts-y := do_mounts.o |
14 | mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o | 18 | mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o |
15 | mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o | 19 | mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o |
diff --git a/arch/alpha/kernel/init_task.c b/init/init_task.c index 6f80ca4f9766..8b2f3996b035 100644 --- a/arch/alpha/kernel/init_task.c +++ b/init/init_task.c | |||
@@ -1,17 +1,24 @@ | |||
1 | #include <linux/mm.h> | 1 | #include <linux/init_task.h> |
2 | #include <linux/module.h> | 2 | #include <linux/export.h> |
3 | #include <linux/mqueue.h> | ||
3 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
4 | #include <linux/init.h> | 5 | #include <linux/init.h> |
5 | #include <linux/init_task.h> | ||
6 | #include <linux/fs.h> | 6 | #include <linux/fs.h> |
7 | #include <linux/mqueue.h> | 7 | #include <linux/mm.h> |
8 | #include <asm/uaccess.h> | ||
9 | 8 | ||
9 | #include <asm/pgtable.h> | ||
10 | #include <asm/uaccess.h> | ||
10 | 11 | ||
11 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | 12 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); |
12 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | 13 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); |
14 | |||
15 | /* Initial task structure */ | ||
13 | struct task_struct init_task = INIT_TASK(init_task); | 16 | struct task_struct init_task = INIT_TASK(init_task); |
14 | EXPORT_SYMBOL(init_task); | 17 | EXPORT_SYMBOL(init_task); |
15 | 18 | ||
19 | /* | ||
20 | * Initial thread structure. Alignment of this is handled by a special | ||
21 | * linker map entry. | ||
22 | */ | ||
16 | union thread_union init_thread_union __init_task_data = | 23 | union thread_union init_thread_union __init_task_data = |
17 | { INIT_THREAD_INFO(init_task) }; | 24 | { INIT_THREAD_INFO(init_task) }; |
diff --git a/kernel/Makefile b/kernel/Makefile index cb41b9547c9f..6c07f30fa9b7 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -43,6 +43,7 @@ obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o | |||
43 | obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o | 43 | obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o |
44 | obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o | 44 | obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o |
45 | obj-$(CONFIG_SMP) += smp.o | 45 | obj-$(CONFIG_SMP) += smp.o |
46 | obj-$(CONFIG_SMP) += smpboot.o | ||
46 | ifneq ($(CONFIG_SMP),y) | 47 | ifneq ($(CONFIG_SMP),y) |
47 | obj-y += up.o | 48 | obj-y += up.o |
48 | endif | 49 | endif |
diff --git a/kernel/cpu.c b/kernel/cpu.c index 2060c6e57027..0e6353cf147a 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/gfp.h> | 17 | #include <linux/gfp.h> |
18 | #include <linux/suspend.h> | 18 | #include <linux/suspend.h> |
19 | 19 | ||
20 | #include "smpboot.h" | ||
21 | |||
20 | #ifdef CONFIG_SMP | 22 | #ifdef CONFIG_SMP |
21 | /* Serializes the updates to cpu_online_mask, cpu_present_mask */ | 23 | /* Serializes the updates to cpu_online_mask, cpu_present_mask */ |
22 | static DEFINE_MUTEX(cpu_add_remove_lock); | 24 | static DEFINE_MUTEX(cpu_add_remove_lock); |
@@ -295,11 +297,19 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen) | |||
295 | int ret, nr_calls = 0; | 297 | int ret, nr_calls = 0; |
296 | void *hcpu = (void *)(long)cpu; | 298 | void *hcpu = (void *)(long)cpu; |
297 | unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0; | 299 | unsigned long mod = tasks_frozen ? CPU_TASKS_FROZEN : 0; |
300 | struct task_struct *idle; | ||
298 | 301 | ||
299 | if (cpu_online(cpu) || !cpu_present(cpu)) | 302 | if (cpu_online(cpu) || !cpu_present(cpu)) |
300 | return -EINVAL; | 303 | return -EINVAL; |
301 | 304 | ||
302 | cpu_hotplug_begin(); | 305 | cpu_hotplug_begin(); |
306 | |||
307 | idle = idle_thread_get(cpu); | ||
308 | if (IS_ERR(idle)) { | ||
309 | ret = PTR_ERR(idle); | ||
310 | goto out; | ||
311 | } | ||
312 | |||
303 | ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls); | 313 | ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls); |
304 | if (ret) { | 314 | if (ret) { |
305 | nr_calls--; | 315 | nr_calls--; |
@@ -309,7 +319,7 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen) | |||
309 | } | 319 | } |
310 | 320 | ||
311 | /* Arch-specific enabling code. */ | 321 | /* Arch-specific enabling code. */ |
312 | ret = __cpu_up(cpu); | 322 | ret = __cpu_up(cpu, idle); |
313 | if (ret != 0) | 323 | if (ret != 0) |
314 | goto out_notify; | 324 | goto out_notify; |
315 | BUG_ON(!cpu_online(cpu)); | 325 | BUG_ON(!cpu_online(cpu)); |
@@ -320,6 +330,7 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen) | |||
320 | out_notify: | 330 | out_notify: |
321 | if (ret != 0) | 331 | if (ret != 0) |
322 | __cpu_notify(CPU_UP_CANCELED | mod, hcpu, nr_calls, NULL); | 332 | __cpu_notify(CPU_UP_CANCELED | mod, hcpu, nr_calls, NULL); |
333 | out: | ||
323 | cpu_hotplug_done(); | 334 | cpu_hotplug_done(); |
324 | 335 | ||
325 | return ret; | 336 | return ret; |
diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile index 9a7dd35102a3..173ea52f3af0 100644 --- a/kernel/sched/Makefile +++ b/kernel/sched/Makefile | |||
@@ -16,5 +16,3 @@ obj-$(CONFIG_SMP) += cpupri.o | |||
16 | obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o | 16 | obj-$(CONFIG_SCHED_AUTOGROUP) += auto_group.o |
17 | obj-$(CONFIG_SCHEDSTATS) += stats.o | 17 | obj-$(CONFIG_SCHEDSTATS) += stats.o |
18 | obj-$(CONFIG_SCHED_DEBUG) += debug.o | 18 | obj-$(CONFIG_SCHED_DEBUG) += debug.o |
19 | |||
20 | |||
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 0533a688ce22..7b77e3b84b4f 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -83,6 +83,7 @@ | |||
83 | 83 | ||
84 | #include "sched.h" | 84 | #include "sched.h" |
85 | #include "../workqueue_sched.h" | 85 | #include "../workqueue_sched.h" |
86 | #include "../smpboot.h" | ||
86 | 87 | ||
87 | #define CREATE_TRACE_POINTS | 88 | #define CREATE_TRACE_POINTS |
88 | #include <trace/events/sched.h> | 89 | #include <trace/events/sched.h> |
@@ -7059,6 +7060,7 @@ void __init sched_init(void) | |||
7059 | /* May be allocated at isolcpus cmdline parse time */ | 7060 | /* May be allocated at isolcpus cmdline parse time */ |
7060 | if (cpu_isolated_map == NULL) | 7061 | if (cpu_isolated_map == NULL) |
7061 | zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT); | 7062 | zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT); |
7063 | idle_thread_set_boot_cpu(); | ||
7062 | #endif | 7064 | #endif |
7063 | init_sched_fair_class(); | 7065 | init_sched_fair_class(); |
7064 | 7066 | ||
diff --git a/kernel/smp.c b/kernel/smp.c index 2f8b10ecf759..d0ae5b24875e 100644 --- a/kernel/smp.c +++ b/kernel/smp.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
14 | #include <linux/cpu.h> | 14 | #include <linux/cpu.h> |
15 | 15 | ||
16 | #include "smpboot.h" | ||
17 | |||
16 | #ifdef CONFIG_USE_GENERIC_SMP_HELPERS | 18 | #ifdef CONFIG_USE_GENERIC_SMP_HELPERS |
17 | static struct { | 19 | static struct { |
18 | struct list_head queue; | 20 | struct list_head queue; |
@@ -669,6 +671,8 @@ void __init smp_init(void) | |||
669 | { | 671 | { |
670 | unsigned int cpu; | 672 | unsigned int cpu; |
671 | 673 | ||
674 | idle_threads_init(); | ||
675 | |||
672 | /* FIXME: This should be done in userspace --RR */ | 676 | /* FIXME: This should be done in userspace --RR */ |
673 | for_each_present_cpu(cpu) { | 677 | for_each_present_cpu(cpu) { |
674 | if (num_online_cpus() >= setup_max_cpus) | 678 | if (num_online_cpus() >= setup_max_cpus) |
@@ -791,3 +795,26 @@ void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info), | |||
791 | } | 795 | } |
792 | } | 796 | } |
793 | EXPORT_SYMBOL(on_each_cpu_cond); | 797 | EXPORT_SYMBOL(on_each_cpu_cond); |
798 | |||
799 | static void do_nothing(void *unused) | ||
800 | { | ||
801 | } | ||
802 | |||
803 | /** | ||
804 | * kick_all_cpus_sync - Force all cpus out of idle | ||
805 | * | ||
806 | * Used to synchronize the update of pm_idle function pointer. It's | ||
807 | * called after the pointer is updated and returns after the dummy | ||
808 | * callback function has been executed on all cpus. The execution of | ||
809 | * the function can only happen on the remote cpus after they have | ||
810 | * left the idle function which had been called via pm_idle function | ||
811 | * pointer. So it's guaranteed that nothing uses the previous pointer | ||
812 | * anymore. | ||
813 | */ | ||
814 | void kick_all_cpus_sync(void) | ||
815 | { | ||
816 | /* Make sure the change is visible before we kick the cpus */ | ||
817 | smp_mb(); | ||
818 | smp_call_function(do_nothing, NULL, 1); | ||
819 | } | ||
820 | EXPORT_SYMBOL_GPL(kick_all_cpus_sync); | ||
diff --git a/kernel/smpboot.c b/kernel/smpboot.c new file mode 100644 index 000000000000..e1a797e028a3 --- /dev/null +++ b/kernel/smpboot.c | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Common SMP CPU bringup/teardown functions | ||
3 | */ | ||
4 | #include <linux/err.h> | ||
5 | #include <linux/smp.h> | ||
6 | #include <linux/init.h> | ||
7 | #include <linux/sched.h> | ||
8 | #include <linux/percpu.h> | ||
9 | |||
10 | #include "smpboot.h" | ||
11 | |||
12 | #ifdef CONFIG_GENERIC_SMP_IDLE_THREAD | ||
13 | /* | ||
14 | * For the hotplug case we keep the task structs around and reuse | ||
15 | * them. | ||
16 | */ | ||
17 | static DEFINE_PER_CPU(struct task_struct *, idle_threads); | ||
18 | |||
19 | struct task_struct * __cpuinit idle_thread_get(unsigned int cpu) | ||
20 | { | ||
21 | struct task_struct *tsk = per_cpu(idle_threads, cpu); | ||
22 | |||
23 | if (!tsk) | ||
24 | return ERR_PTR(-ENOMEM); | ||
25 | init_idle(tsk, cpu); | ||
26 | return tsk; | ||
27 | } | ||
28 | |||
29 | void __init idle_thread_set_boot_cpu(void) | ||
30 | { | ||
31 | per_cpu(idle_threads, smp_processor_id()) = current; | ||
32 | } | ||
33 | |||
34 | static inline void idle_init(unsigned int cpu) | ||
35 | { | ||
36 | struct task_struct *tsk = per_cpu(idle_threads, cpu); | ||
37 | |||
38 | if (!tsk) { | ||
39 | tsk = fork_idle(cpu); | ||
40 | if (IS_ERR(tsk)) | ||
41 | pr_err("SMP: fork_idle() failed for CPU %u\n", cpu); | ||
42 | else | ||
43 | per_cpu(idle_threads, cpu) = tsk; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | /** | ||
48 | * idle_thread_init - Initialize the idle thread for a cpu | ||
49 | * @cpu: The cpu for which the idle thread should be initialized | ||
50 | * | ||
51 | * Creates the thread if it does not exist. | ||
52 | */ | ||
53 | void __init idle_threads_init(void) | ||
54 | { | ||
55 | unsigned int cpu; | ||
56 | |||
57 | for_each_possible_cpu(cpu) { | ||
58 | if (cpu != smp_processor_id()) | ||
59 | idle_init(cpu); | ||
60 | } | ||
61 | } | ||
62 | #endif | ||
diff --git a/kernel/smpboot.h b/kernel/smpboot.h new file mode 100644 index 000000000000..80c0acfb8472 --- /dev/null +++ b/kernel/smpboot.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef SMPBOOT_H | ||
2 | #define SMPBOOT_H | ||
3 | |||
4 | struct task_struct; | ||
5 | |||
6 | int smpboot_prepare(unsigned int cpu); | ||
7 | |||
8 | #ifdef CONFIG_GENERIC_SMP_IDLE_THREAD | ||
9 | struct task_struct *idle_thread_get(unsigned int cpu); | ||
10 | void idle_thread_set_boot_cpu(void); | ||
11 | void idle_threads_init(void); | ||
12 | #else | ||
13 | static inline struct task_struct *idle_thread_get(unsigned int cpu) { return NULL; } | ||
14 | static inline void idle_thread_set_boot_cpu(void) { } | ||
15 | static inline void idle_threads_init(void) { } | ||
16 | #endif | ||
17 | |||
18 | #endif | ||