x86: add cpu hotplug hooks into smp_ops
Signed-off-by: Alex Nixon <alex.nixon@citrix.com> Acked-by: Jeremy Fitzhardinge <jeremy@goop.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@@ -91,7 +91,7 @@ static void cpu_exit_clear(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We don't actually take CPU down, just spin without interrupts. */
|
/* We don't actually take CPU down, just spin without interrupts. */
|
||||||
static inline void play_dead(void)
|
void native_play_dead(void)
|
||||||
{
|
{
|
||||||
/* This must be done before dead CPU ack */
|
/* This must be done before dead CPU ack */
|
||||||
cpu_exit_clear();
|
cpu_exit_clear();
|
||||||
@@ -107,7 +107,7 @@ static inline void play_dead(void)
|
|||||||
wbinvd_halt();
|
wbinvd_halt();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static inline void play_dead(void)
|
void native_play_dead(void)
|
||||||
{
|
{
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
@@ -90,7 +90,7 @@ DECLARE_PER_CPU(int, cpu_state);
|
|||||||
|
|
||||||
#include <asm/nmi.h>
|
#include <asm/nmi.h>
|
||||||
/* We halt the CPU with physical CPU hotplug */
|
/* We halt the CPU with physical CPU hotplug */
|
||||||
static inline void play_dead(void)
|
void native_play_dead(void)
|
||||||
{
|
{
|
||||||
idle_task_exit();
|
idle_task_exit();
|
||||||
mb();
|
mb();
|
||||||
@@ -102,7 +102,7 @@ static inline void play_dead(void)
|
|||||||
wbinvd_halt();
|
wbinvd_halt();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static inline void play_dead(void)
|
void native_play_dead(void)
|
||||||
{
|
{
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
@@ -214,12 +214,16 @@ void smp_call_function_single_interrupt(struct pt_regs *regs)
|
|||||||
struct smp_ops smp_ops = {
|
struct smp_ops smp_ops = {
|
||||||
.smp_prepare_boot_cpu = native_smp_prepare_boot_cpu,
|
.smp_prepare_boot_cpu = native_smp_prepare_boot_cpu,
|
||||||
.smp_prepare_cpus = native_smp_prepare_cpus,
|
.smp_prepare_cpus = native_smp_prepare_cpus,
|
||||||
.cpu_up = native_cpu_up,
|
|
||||||
.smp_cpus_done = native_smp_cpus_done,
|
.smp_cpus_done = native_smp_cpus_done,
|
||||||
|
|
||||||
.smp_send_stop = native_smp_send_stop,
|
.smp_send_stop = native_smp_send_stop,
|
||||||
.smp_send_reschedule = native_smp_send_reschedule,
|
.smp_send_reschedule = native_smp_send_reschedule,
|
||||||
|
|
||||||
|
.cpu_up = native_cpu_up,
|
||||||
|
.cpu_die = native_cpu_die,
|
||||||
|
.cpu_disable = native_cpu_disable,
|
||||||
|
.play_dead = native_play_dead,
|
||||||
|
|
||||||
.send_call_func_ipi = native_send_call_func_ipi,
|
.send_call_func_ipi = native_send_call_func_ipi,
|
||||||
.send_call_func_single_ipi = native_send_call_func_single_ipi,
|
.send_call_func_single_ipi = native_send_call_func_single_ipi,
|
||||||
};
|
};
|
||||||
|
@@ -1346,7 +1346,7 @@ static void __ref remove_cpu_from_maps(int cpu)
|
|||||||
numa_remove_cpu(cpu);
|
numa_remove_cpu(cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
int __cpu_disable(void)
|
int native_cpu_disable(void)
|
||||||
{
|
{
|
||||||
int cpu = smp_processor_id();
|
int cpu = smp_processor_id();
|
||||||
|
|
||||||
@@ -1385,7 +1385,7 @@ int __cpu_disable(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __cpu_die(unsigned int cpu)
|
void native_cpu_die(unsigned int cpu)
|
||||||
{
|
{
|
||||||
/* We don't do anything here: idle task is faking death itself. */
|
/* We don't do anything here: idle task is faking death itself. */
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@@ -1403,12 +1403,12 @@ void __cpu_die(unsigned int cpu)
|
|||||||
printk(KERN_ERR "CPU %u didn't die...\n", cpu);
|
printk(KERN_ERR "CPU %u didn't die...\n", cpu);
|
||||||
}
|
}
|
||||||
#else /* ... !CONFIG_HOTPLUG_CPU */
|
#else /* ... !CONFIG_HOTPLUG_CPU */
|
||||||
int __cpu_disable(void)
|
int native_cpu_disable(void)
|
||||||
{
|
{
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __cpu_die(unsigned int cpu)
|
void native_cpu_die(unsigned int cpu)
|
||||||
{
|
{
|
||||||
/* We said "no" in __cpu_disable */
|
/* We said "no" in __cpu_disable */
|
||||||
BUG();
|
BUG();
|
||||||
|
@@ -47,12 +47,16 @@ extern struct {
|
|||||||
struct smp_ops {
|
struct smp_ops {
|
||||||
void (*smp_prepare_boot_cpu)(void);
|
void (*smp_prepare_boot_cpu)(void);
|
||||||
void (*smp_prepare_cpus)(unsigned max_cpus);
|
void (*smp_prepare_cpus)(unsigned max_cpus);
|
||||||
int (*cpu_up)(unsigned cpu);
|
|
||||||
void (*smp_cpus_done)(unsigned max_cpus);
|
void (*smp_cpus_done)(unsigned max_cpus);
|
||||||
|
|
||||||
void (*smp_send_stop)(void);
|
void (*smp_send_stop)(void);
|
||||||
void (*smp_send_reschedule)(int cpu);
|
void (*smp_send_reschedule)(int cpu);
|
||||||
|
|
||||||
|
int (*cpu_up)(unsigned cpu);
|
||||||
|
int (*cpu_disable)(void);
|
||||||
|
void (*cpu_die)(unsigned int cpu);
|
||||||
|
void (*play_dead)(void);
|
||||||
|
|
||||||
void (*send_call_func_ipi)(cpumask_t mask);
|
void (*send_call_func_ipi)(cpumask_t mask);
|
||||||
void (*send_call_func_single_ipi)(int cpu);
|
void (*send_call_func_single_ipi)(int cpu);
|
||||||
};
|
};
|
||||||
@@ -91,6 +95,21 @@ static inline int __cpu_up(unsigned int cpu)
|
|||||||
return smp_ops.cpu_up(cpu);
|
return smp_ops.cpu_up(cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int __cpu_disable(void)
|
||||||
|
{
|
||||||
|
return smp_ops.cpu_disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __cpu_die(unsigned int cpu)
|
||||||
|
{
|
||||||
|
smp_ops.cpu_die(cpu);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void play_dead(void)
|
||||||
|
{
|
||||||
|
smp_ops.play_dead();
|
||||||
|
}
|
||||||
|
|
||||||
static inline void smp_send_reschedule(int cpu)
|
static inline void smp_send_reschedule(int cpu)
|
||||||
{
|
{
|
||||||
smp_ops.smp_send_reschedule(cpu);
|
smp_ops.smp_send_reschedule(cpu);
|
||||||
@@ -110,12 +129,13 @@ void native_smp_prepare_boot_cpu(void);
|
|||||||
void native_smp_prepare_cpus(unsigned int max_cpus);
|
void native_smp_prepare_cpus(unsigned int max_cpus);
|
||||||
void native_smp_cpus_done(unsigned int max_cpus);
|
void native_smp_cpus_done(unsigned int max_cpus);
|
||||||
int native_cpu_up(unsigned int cpunum);
|
int native_cpu_up(unsigned int cpunum);
|
||||||
|
int native_cpu_disable(void);
|
||||||
|
void native_cpu_die(unsigned int cpu);
|
||||||
|
void native_play_dead(void);
|
||||||
|
|
||||||
void native_send_call_func_ipi(cpumask_t mask);
|
void native_send_call_func_ipi(cpumask_t mask);
|
||||||
void native_send_call_func_single_ipi(int cpu);
|
void native_send_call_func_single_ipi(int cpu);
|
||||||
|
|
||||||
extern int __cpu_disable(void);
|
|
||||||
extern void __cpu_die(unsigned int cpu);
|
|
||||||
|
|
||||||
void smp_store_cpu_info(int id);
|
void smp_store_cpu_info(int id);
|
||||||
#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
|
#define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user