[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] stopmachine: Implement using tasklets rather than a softirq.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1271674079 -3600 # Node ID f1313dd68da4077ccd4f5530a7bc79d649bdffab # Parent 652e40d4dd8864a16084a1ff634d95f4a7260f20 stopmachine: Implement using tasklets rather than a softirq. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/arch/ia64/xen/domain.c | 4 ++++ xen/arch/x86/domain.c | 5 +++++ xen/common/stop_machine.c | 19 +++++++++++-------- xen/include/xen/sched.h | 3 +++ xen/include/xen/softirq.h | 1 - 5 files changed, 23 insertions(+), 9 deletions(-) diff -r 652e40d4dd88 -r f1313dd68da4 xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Mon Apr 19 11:34:49 2010 +0100 +++ b/xen/arch/ia64/xen/domain.c Mon Apr 19 11:47:59 2010 +0100 @@ -2343,6 +2343,10 @@ void machine_halt(void) while(1); } +void sync_local_execstate(void) +{ +} + void sync_vcpu_execstate(struct vcpu *v) { // __ia64_save_fpu(v->arch._thread.fph); diff -r 652e40d4dd88 -r f1313dd68da4 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Mon Apr 19 11:34:49 2010 +0100 +++ b/xen/arch/x86/domain.c Mon Apr 19 11:47:59 2010 +0100 @@ -1509,6 +1509,11 @@ int __sync_lazy_execstate(void) return switch_required; } +void sync_local_execstate(void) +{ + (void)__sync_lazy_execstate(); +} + void sync_vcpu_execstate(struct vcpu *v) { if ( cpu_isset(smp_processor_id(), v->vcpu_dirty_cpumask) ) diff -r 652e40d4dd88 -r f1313dd68da4 xen/common/stop_machine.c --- a/xen/common/stop_machine.c Mon Apr 19 11:34:49 2010 +0100 +++ b/xen/common/stop_machine.c Mon Apr 19 11:47:59 2010 +0100 @@ -24,7 +24,7 @@ #include <xen/init.h> #include <xen/sched.h> #include <xen/spinlock.h> -#include <xen/softirq.h> +#include <xen/tasklet.h> #include <xen/stop_machine.h> #include <xen/errno.h> #include <xen/smp.h> @@ -51,6 +51,7 @@ struct stopmachine_data { void *fn_data; }; +static DEFINE_PER_CPU(struct tasklet, stopmachine_tasklet); static struct stopmachine_data stopmachine_data; static DEFINE_SPINLOCK(stopmachine_lock); @@ -81,10 +82,7 @@ int stop_machine_run(int (*fn)(void *), return (*fn)(data); } - /* Note: We shouldn't spin on lock when it's held by others since others - * is expecting this cpus to enter softirq context. Or else deadlock - * is caused. - */ + /* Must not spin here as the holder will expect us to be descheduled. */ if ( !spin_trylock(&stopmachine_lock) ) return -EBUSY; @@ -98,8 +96,9 @@ int stop_machine_run(int (*fn)(void *), smp_wmb(); for_each_cpu_mask ( i, allbutself ) - cpu_raise_softirq(i, STOPMACHINE_SOFTIRQ); + tasklet_schedule_on_cpu(&per_cpu(stopmachine_tasklet, i), i); + sync_local_execstate(); stopmachine_set_state(STOPMACHINE_PREPARE); local_irq_disable(); @@ -118,10 +117,11 @@ int stop_machine_run(int (*fn)(void *), return ret; } -static void stopmachine_softirq(void) +static void stopmachine_action(unsigned long unused) { enum stopmachine_state state = STOPMACHINE_START; + sync_local_execstate(); smp_mb(); while ( state != STOPMACHINE_EXIT ) @@ -153,7 +153,10 @@ static void stopmachine_softirq(void) static int __init cpu_stopmachine_init(void) { - open_softirq(STOPMACHINE_SOFTIRQ, stopmachine_softirq); + unsigned int cpu; + for_each_possible_cpu ( cpu ) + tasklet_init(&per_cpu(stopmachine_tasklet, cpu), + stopmachine_action, 0); return 0; } __initcall(cpu_stopmachine_init); diff -r 652e40d4dd88 -r f1313dd68da4 xen/include/xen/sched.h --- a/xen/include/xen/sched.h Mon Apr 19 11:34:49 2010 +0100 +++ b/xen/include/xen/sched.h Mon Apr 19 11:47:59 2010 +0100 @@ -480,6 +480,9 @@ void vcpu_sleep_sync(struct vcpu *d); */ void sync_vcpu_execstate(struct vcpu *v); +/* As above, for any lazy state being held on the local CPU. */ +void sync_local_execstate(void); + /* * Called by the scheduler to switch to another VCPU. This function must * call context_saved(@prev) when the local CPU is no longer running in diff -r 652e40d4dd88 -r f1313dd68da4 xen/include/xen/softirq.h --- a/xen/include/xen/softirq.h Mon Apr 19 11:34:49 2010 +0100 +++ b/xen/include/xen/softirq.h Mon Apr 19 11:47:59 2010 +0100 @@ -8,7 +8,6 @@ enum { NEW_TLBFLUSH_CLOCK_PERIOD_SOFTIRQ, PAGE_SCRUB_SOFTIRQ, RCU_SOFTIRQ, - STOPMACHINE_SOFTIRQ, NR_COMMON_SOFTIRQS }; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |