Skip to content

Commit

Permalink
Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/tip/tip

Pull smp hotplug cleanups from Thomas Gleixner:
 "This series is merily a cleanup of code copied around in arch/* and
  not changing any of the real cpu hotplug horrors yet.  I wish I'd had
  something more substantial for 3.5, but I underestimated the lurking
  horror..."

Fix up trivial conflicts in arch/{arm,sparc,x86}/Kconfig and
arch/sparc/include/asm/thread_info_32.h

* 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (79 commits)
  um: Remove leftover declaration of alloc_task_struct_node()
  task_allocator: Use config switches instead of magic defines
  sparc: Use common threadinfo allocator
  score: Use common threadinfo allocator
  sh-use-common-threadinfo-allocator
  mn10300: Use common threadinfo allocator
  powerpc: Use common threadinfo allocator
  mips: Use common threadinfo allocator
  hexagon: Use common threadinfo allocator
  m32r: Use common threadinfo allocator
  frv: Use common threadinfo allocator
  cris: Use common threadinfo allocator
  x86: Use common threadinfo allocator
  c6x: Use common threadinfo allocator
  fork: Provide kmemcache based thread_info allocator
  tile: Use common threadinfo allocator
  fork: Provide weak arch_release_[task_struct|thread_info] functions
  fork: Move thread info gfp flags to header
  fork: Remove the weak insanity
  sh: Remove cpu_idle_wait()
  ...
  • Loading branch information
torvalds committed May 22, 2012
2 parents 226da0d + 203dacb commit bf67f3a
Show file tree
Hide file tree
Showing 157 changed files with 415 additions and 1,934 deletions.
15 changes: 15 additions & 0 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,21 @@ config HAVE_DMA_ATTRS
config USE_GENERIC_SMP_HELPERS
bool

config GENERIC_SMP_IDLE_THREAD
bool

# Select if arch init_task initializer is different to init/init_task.c
config ARCH_INIT_TASK
bool

# Select if arch has its private alloc_task_struct() function
config ARCH_TASK_STRUCT_ALLOCATOR
bool

# Select if arch has its private alloc_thread_info() function
config ARCH_THREAD_INFO_ALLOCATOR
bool

config HAVE_REGS_AND_STACK_ACCESS_API
bool
help
Expand Down
1 change: 1 addition & 0 deletions arch/alpha/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ config ALPHA
select GENERIC_IRQ_SHOW
select ARCH_WANT_OPTIONAL_GPIOLIB
select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_SMP_IDLE_THREAD
help
The Alpha is a 64-bit general-purpose processor designed and
marketed by the Digital Equipment Corporation of blessed memory,
Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extra-y := head.o vmlinux.lds
asflags-y := $(KBUILD_CFLAGS)
ccflags-y := -Wno-sign-compare

obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \
obj-y := entry.o traps.o process.o osf_sys.o irq.o \
irq_alpha.o signal.o setup.o ptrace.o time.o \
alpha_ksyms.o systbls.o err_common.o io.o

Expand Down
20 changes: 3 additions & 17 deletions arch/alpha/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,24 +357,10 @@ secondary_cpu_start(int cpuid, struct task_struct *idle)
* Bring one cpu online.
*/
static int __cpuinit
smp_boot_one_cpu(int cpuid)
smp_boot_one_cpu(int cpuid, struct task_struct *idle)
{
struct task_struct *idle;
unsigned long timeout;

/* Cook up an idler for this guy. Note that the address we
give to kernel_thread is irrelevant -- it's going to start
where HWRPB.CPU_restart says to start. But this gets all
the other task-y sort of data structures set up like we
wish. We can't use kernel_thread since we must avoid
rescheduling the child. */
idle = fork_idle(cpuid);
if (IS_ERR(idle))
panic("failed fork for CPU %d", cpuid);

DBGS(("smp_boot_one_cpu: CPU %d state 0x%lx flags 0x%lx\n",
cpuid, idle->state, idle->flags));

/* Signal the secondary to wait a moment. */
smp_secondary_alive = -1;

Expand Down Expand Up @@ -487,9 +473,9 @@ smp_prepare_boot_cpu(void)
}

int __cpuinit
__cpu_up(unsigned int cpu)
__cpu_up(unsigned int cpu, struct task_struct *tidle)
{
smp_boot_one_cpu(cpu);
smp_boot_one_cpu(cpu, tidle);

return cpu_online(cpu) ? 0 : -ENOSYS;
}
Expand Down
4 changes: 1 addition & 3 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ config ARM
select CPU_PM if (SUSPEND || CPU_IDLE)
select GENERIC_PCI_IOMAP
select HAVE_BPF_JIT
select GENERIC_SMP_IDLE_THREAD
help
The ARM series is a line of low-power-consumption RISC chip designs
licensed by ARM Ltd and targeted at embedded applications and
Expand Down Expand Up @@ -154,9 +155,6 @@ config ARCH_HAS_CPUFREQ
and that the relevant menu configurations are displayed for
it.

config ARCH_HAS_CPU_IDLE_WAIT
def_bool y

config GENERIC_HWEIGHT
bool
default y
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ KBUILD_AFLAGS +=$(CFLAGS_ABI) $(AFLAGS_THUMB2) $(arch-y) $(tune-y) -include asm/
CHECKFLAGS += -D__arm__

#Default value
head-y := arch/arm/kernel/head$(MMUEXT).o arch/arm/kernel/init_task.o
head-y := arch/arm/kernel/head$(MMUEXT).o
textofs-y := 0x00008000
textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000
# We don't want the htc bootloader to corrupt kernel during resume
Expand Down
1 change: 0 additions & 1 deletion arch/arm/include/asm/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
struct cpuinfo_arm {
struct cpu cpu;
#ifdef CONFIG_SMP
struct task_struct *idle;
unsigned int loops_per_jiffy;
#endif
};
Expand Down
2 changes: 0 additions & 2 deletions arch/arm/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ unsigned long get_wchan(struct task_struct *p);
#define cpu_relax() barrier()
#endif

void cpu_idle_wait(void);

/*
* Create a new kernel thread
*/
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ head-y := head$(MMUEXT).o
obj-$(CONFIG_DEBUG_LL) += debug.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o

extra-y := $(head-y) init_task.o vmlinux.lds
extra-y := $(head-y) vmlinux.lds
37 changes: 0 additions & 37 deletions arch/arm/kernel/init_task.c

This file was deleted.

20 changes: 0 additions & 20 deletions arch/arm/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,26 +157,6 @@ EXPORT_SYMBOL(pm_power_off);
void (*arm_pm_restart)(char str, const char *cmd) = null_restart;
EXPORT_SYMBOL_GPL(arm_pm_restart);

static void do_nothing(void *unused)
{
}

/*
* cpu_idle_wait - Used to ensure that all the CPUs discard old value of
* pm_idle and update to new pm_idle value. Required while changing pm_idle
* handler on SMP systems.
*
* Caller must have changed pm_idle to the new value before the call. Old
* pm_idle value will not be used by any CPU after the return of this function.
*/
void cpu_idle_wait(void)
{
smp_mb();
/* kick all the CPUs so that they exit out of pm_idle */
smp_call_function(do_nothing, NULL, 1);
}
EXPORT_SYMBOL_GPL(cpu_idle_wait);

/*
* This is our default idle handler.
*/
Expand Down
26 changes: 1 addition & 25 deletions arch/arm/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,10 @@ enum ipi_msg_type {

static DECLARE_COMPLETION(cpu_running);

int __cpuinit __cpu_up(unsigned int cpu)
int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
{
struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu);
struct task_struct *idle = ci->idle;
int ret;

/*
* Spawn a new process manually, if not already done.
* Grab a pointer to its task struct so we can mess with it
*/
if (!idle) {
idle = fork_idle(cpu);
if (IS_ERR(idle)) {
printk(KERN_ERR "CPU%u: fork() failed\n", cpu);
return PTR_ERR(idle);
}
ci->idle = idle;
} else {
/*
* Since this idle thread is being re-used, call
* init_idle() to reinitialize the thread structure.
*/
init_idle(idle, cpu);
}

/*
* We need to tell the secondary core where to find
* its stack and the page tables.
Expand Down Expand Up @@ -318,9 +297,6 @@ void __init smp_cpus_done(unsigned int max_cpus)

void __init smp_prepare_boot_cpu(void)
{
unsigned int cpu = smp_processor_id();

per_cpu(cpu_data, cpu).idle = current;
}

void __init smp_prepare_cpus(unsigned int max_cpus)
Expand Down
2 changes: 1 addition & 1 deletion arch/avr32/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ obj-$(CONFIG_SUBARCH_AVR32B) += entry-avr32b.o
obj-y += syscall_table.o syscall-stubs.o irq.o
obj-y += setup.o traps.o ocd.o ptrace.o
obj-y += signal.o sys_avr32.o process.o time.o
obj-y += init_task.o switch_to.o cpu.o
obj-y += switch_to.o cpu.o
obj-$(CONFIG_MODULES) += module.o avr32_ksyms.o
obj-$(CONFIG_KPROBES) += kprobes.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
Expand Down
31 changes: 0 additions & 31 deletions arch/avr32/kernel/init_task.c

This file was deleted.

1 change: 1 addition & 0 deletions arch/blackfin/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ config BLACKFIN
select GENERIC_IRQ_PROBE
select IRQ_PER_CPU if SMP
select HAVE_NMI_WATCHDOG if NMI_WATCHDOG
select GENERIC_SMP_IDLE_THREAD

config GENERIC_CSUM
def_bool y
Expand Down
2 changes: 0 additions & 2 deletions arch/blackfin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ KBUILD_AFLAGS += -mcpu=$(CPU_REV)
CHECKFLAGS_SILICON = $(shell echo "" | $(CPP) $(KBUILD_CFLAGS) -dD - 2>/dev/null | awk '$$2 == "__SILICON_REVISION__" { print $$3 }')
CHECKFLAGS += -D__SILICON_REVISION__=$(CHECKFLAGS_SILICON) -D__bfin__

head-y := arch/$(ARCH)/kernel/init_task.o

core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ arch/$(ARCH)/mach-common/

# If we have a machine-specific directory, then include it in the build.
Expand Down
2 changes: 1 addition & 1 deletion arch/blackfin/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# arch/blackfin/kernel/Makefile
#

extra-y := init_task.o vmlinux.lds
extra-y := vmlinux.lds

obj-y := \
entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \
Expand Down
32 changes: 0 additions & 32 deletions arch/blackfin/kernel/init_task.c

This file was deleted.

19 changes: 1 addition & 18 deletions arch/blackfin/mach-common/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,27 +340,10 @@ void smp_send_stop(void)
return;
}

int __cpuinit __cpu_up(unsigned int cpu)
int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
{
int ret;
struct blackfin_cpudata *ci = &per_cpu(cpu_data, cpu);
struct task_struct *idle = ci->idle;

if (idle) {
free_task(idle);
idle = NULL;
}

if (!idle) {
idle = fork_idle(cpu);
if (IS_ERR(idle)) {
printk(KERN_ERR "CPU%u: fork() failed\n", cpu);
return PTR_ERR(idle);
}
ci->idle = idle;
} else {
init_idle(idle, cpu);
}
secondary_stack = task_stack_page(idle) + THREAD_SIZE;

ret = platform_boot_secondary(cpu, idle);
Expand Down
17 changes: 2 additions & 15 deletions arch/c6x/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
#ifdef CONFIG_4KSTACKS
#define THREAD_SIZE 4096
#define THREAD_SHIFT 12
#define THREAD_ORDER 0
#define THREAD_SIZE_ORDER 0
#else
#define THREAD_SIZE 8192
#define THREAD_SHIFT 13
#define THREAD_ORDER 1
#define THREAD_SIZE_ORDER 1
#endif

#define THREAD_START_SP (THREAD_SIZE - 8)
Expand Down Expand Up @@ -80,19 +80,6 @@ struct thread_info *current_thread_info(void)
return ti;
}

#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR

/* thread information allocation */
#ifdef CONFIG_DEBUG_STACK_USAGE
#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
#else
#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK)
#endif

#define alloc_thread_info_node(tsk, node) \
((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER))

#define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER)
#define get_thread_info(ti) get_task_struct((ti)->task)
#define put_thread_info(ti) put_task_struct((ti)->task)
#endif /* __ASSEMBLY__ */
Expand Down
Loading

0 comments on commit bf67f3a

Please sign in to comment.