Skip to content

Commit 38498a6

Browse files
committed
smp: Add generic smpboot facility
Start a new file, which will hold SMP and CPU hotplug related generic infrastructure. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Cc: Matt Turner <mattst88@gmail.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Jesper Nilsson <jesper.nilsson@axis.com> Cc: Richard Kuo <rkuo@codeaurora.org> Cc: Tony Luck <tony.luck@intel.com> Cc: Hirokazu Takata <takata@linux-m32r.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: David Howells <dhowells@redhat.com> Cc: James E.J. Bottomley <jejb@parisc-linux.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: David S. Miller <davem@davemloft.net> Cc: Chris Metcalf <cmetcalf@tilera.com> Cc: Richard Weinberger <richard@nod.at> Cc: x86@kernel.org Link: http://lkml.kernel.org/r/20120420124557.035417523@linutronix.de
1 parent 8239c25 commit 38498a6

4 files changed

Lines changed: 29 additions & 0 deletions

File tree

kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
4343
obj-$(CONFIG_RT_MUTEX_TESTER) += rtmutex-tester.o
4444
obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
4545
obj-$(CONFIG_SMP) += smp.o
46+
obj-$(CONFIG_SMP) += smpboot.o
4647
ifneq ($(CONFIG_SMP),y)
4748
obj-y += up.o
4849
endif

kernel/cpu.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <linux/gfp.h>
1818
#include <linux/suspend.h>
1919

20+
#include "smpboot.h"
21+
2022
#ifdef CONFIG_SMP
2123
/* Serializes the updates to cpu_online_mask, cpu_present_mask */
2224
static DEFINE_MUTEX(cpu_add_remove_lock);
@@ -300,6 +302,11 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
300302
return -EINVAL;
301303

302304
cpu_hotplug_begin();
305+
306+
ret = smpboot_prepare(cpu);
307+
if (ret)
308+
goto out;
309+
303310
ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls);
304311
if (ret) {
305312
nr_calls--;
@@ -320,6 +327,7 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
320327
out_notify:
321328
if (ret != 0)
322329
__cpu_notify(CPU_UP_CANCELED | mod, hcpu, nr_calls, NULL);
330+
out:
323331
cpu_hotplug_done();
324332

325333
return ret;

kernel/smpboot.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Common SMP CPU bringup/teardown functions
3+
*/
4+
#include <linux/init.h>
5+
6+
#include "smpboot.h"
7+
8+
/**
9+
* smpboot_prepare - generic smpboot preparation
10+
*/
11+
int __cpuinit smpboot_prepare(unsigned int cpu)
12+
{
13+
return 0;
14+
}

kernel/smpboot.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef SMPBOOT_H
2+
#define SMPBOOT_H
3+
4+
int smpboot_prepare(unsigned int cpu);
5+
6+
#endif

0 commit comments

Comments
 (0)