[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xen: Clean up SMP/hotplug headers and implementation a bit.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1202927412 0 # Node ID e1dde6f8bc873b74786feb603289c502c9a43ed9 # Parent e7085b40dc08d3bff167bcad05b509da22c64e04 xen: Clean up SMP/hotplug headers and implementation a bit. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/arch/x86/smpboot.c | 5 +- xen/common/stop_machine.c | 20 ++--------- xen/include/xen/smp.h | 72 +++-------------------------------------- xen/include/xen/stop_machine.h | 11 ------ 4 files changed, 14 insertions(+), 94 deletions(-) diff -r e7085b40dc08 -r e1dde6f8bc87 xen/arch/x86/smpboot.c --- a/xen/arch/x86/smpboot.c Wed Feb 13 18:09:27 2008 +0000 +++ b/xen/arch/x86/smpboot.c Wed Feb 13 18:30:12 2008 +0000 @@ -112,7 +112,7 @@ DEFINE_PER_CPU(int, cpu_state) = { 0 }; DEFINE_PER_CPU(int, cpu_state) = { 0 }; static void *stack_base[NR_CPUS] __cacheline_aligned; -spinlock_t cpu_add_remove_lock; +static DEFINE_SPINLOCK(cpu_add_remove_lock); /* * The bootstrap kernel entry code has set these up. Save them for @@ -1164,7 +1164,6 @@ void __devinit smp_prepare_boot_cpu(void cpu_set(smp_processor_id(), cpu_present_map); cpu_set(smp_processor_id(), cpu_possible_map); per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; - spin_lock_init(&cpu_add_remove_lock); } #ifdef CONFIG_HOTPLUG_CPU @@ -1298,7 +1297,7 @@ int cpu_down(unsigned int cpu) printk("Prepare to bring CPU%d down...\n", cpu); - err = __stop_machine_run(take_cpu_down, NULL, cpu); + err = stop_machine_run(take_cpu_down, NULL, cpu); if ( err < 0 ) goto out; diff -r e7085b40dc08 -r e1dde6f8bc87 xen/common/stop_machine.c --- a/xen/common/stop_machine.c Wed Feb 13 18:09:27 2008 +0000 +++ b/xen/common/stop_machine.c Wed Feb 13 18:30:12 2008 +0000 @@ -22,12 +22,13 @@ #include <xen/config.h> #include <xen/init.h> +#include <xen/sched.h> #include <xen/spinlock.h> -#include <asm/smp.h> +#include <xen/softirq.h> +#include <xen/errno.h> +#include <xen/smp.h> #include <asm/current.h> -#include <xen/softirq.h> #include <asm/processor.h> -#include <xen/errno.h> enum stopmachine_state { STOPMACHINE_START, @@ -61,7 +62,7 @@ static void stopmachine_set_state(enum s cpu_relax(); } -int __stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) +int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) { cpumask_t allbutself; unsigned int i, nr_cpus; @@ -116,17 +117,6 @@ int __stop_machine_run(int (*fn)(void *) return ret; } -int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) -{ - int ret; - - lock_cpu_hotplug(); - ret = __stop_machine_run(fn, data, cpu); - unlock_cpu_hotplug(); - - return ret; -} - static void stopmachine_softirq(void) { enum stopmachine_state state = STOPMACHINE_START; diff -r e7085b40dc08 -r e1dde6f8bc87 xen/include/xen/smp.h --- a/xen/include/xen/smp.h Wed Feb 13 18:09:27 2008 +0000 +++ b/xen/include/xen/smp.h Wed Feb 13 18:30:12 2008 +0000 @@ -1,21 +1,8 @@ -#ifndef __LINUX_SMP_H -#define __LINUX_SMP_H - -/* - * Generic SMP support - * Alan Cox. <alan@xxxxxxxxxx> - */ +#ifndef __XEN_SMP_H__ +#define __XEN_SMP_H__ #include <xen/config.h> - -#ifdef CONFIG_SMP - #include <asm/smp.h> - -/* - * main cross-CPU interfaces, handles INIT, TLB flush, STOP, etc. - * (defined in asm header): - */ /* * stops all CPUs but the current one: @@ -66,38 +53,6 @@ extern int on_selected_cpus( */ void smp_prepare_boot_cpu(void); -#else - -/* - * These macros fold the SMP functionality into a single CPU system - */ - -#define smp_send_event_check_mask(m) ((void)0) -#define smp_send_event_check_cpu(p) ((void)0) -#define raw_smp_processor_id() 0 -#define hard_smp_processor_id() 0 -#define smp_call_function(func,info,retry,wait) ({ do {} while (0); 0; }) -#define num_booting_cpus() 1 -#define smp_prepare_boot_cpu() do {} while (0) - -static inline int on_selected_cpus( - cpumask_t selected, - void (*func) (void *info), - void *info, - int retry, - int wait) -{ - if ( cpu_isset(0, selected) ) - { - local_irq_disable(); - func(info); - local_irq_enable(); - } - return 0; -} - -#endif - /* * Call a function on all processors */ @@ -112,21 +67,8 @@ static inline int on_each_cpu( #define smp_processor_id() raw_smp_processor_id() -#ifdef CONFIG_HOTPLUG_CPU -extern spinlock_t cpu_add_remove_lock; -/* - * FIXME: need a better lock mechanism when real cpu hotplug is later - * supported, since spinlock may cause dead lock: - * cpu0: in stop_machine with lock held. Wait for cpu1 to respond - * to stop request - * cpu1: spin loop on lock upon cpu hotplug request from guest, - * without chance to handle softirq - * ... - */ -#define lock_cpu_hotplug() spin_lock(&cpu_add_remove_lock); -#define unlock_cpu_hotplug() spin_unlock(&cpu_add_remove_lock); -#else -#define lock_cpu_hotplug() do { } while ( 0 ) -#define unlock_cpu_hotplug() do { } while ( 0 ) -#endif -#endif +/* No Xen contexts can be preempted by CPU hotplug. */ +#define lock_cpu_hotplug() ((void)0) +#define unlock_cpu_hotplug() ((void)0) + +#endif /* __XEN_SMP_H__ */ diff -r e7085b40dc08 -r e1dde6f8bc87 xen/include/xen/stop_machine.h --- a/xen/include/xen/stop_machine.h Wed Feb 13 18:09:27 2008 +0000 +++ b/xen/include/xen/stop_machine.h Wed Feb 13 18:30:12 2008 +0000 @@ -16,15 +16,4 @@ * grabbing every spinlock in the kernel. */ int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu); -/** - * __stop_machine_run: freeze the machine on all CPUs and run this function - * @fn: the function to run - * @data: the data ptr for the @fn - * @cpu: the cpu to run @fn on (or any, if @cpu == NR_CPUS. - * - * Description: This is a special version of the above, without explicit - * lock acquisition. Used by hotplug cpu. - */ -int __stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu); - #endif /* __XEN_STOP_MACHINE_H__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |