[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-3.4-testing] Replace process_pending_timers() with process_pending_softirqs().
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1261554838 0 # Node ID 6b0f9559fbd5c6e04c10c18953a77a41a0464440 # Parent fc6ca854775c70d502aa0c9ad0dcfc07977e0ea9 Replace process_pending_timers() with process_pending_softirqs(). This ensures that any critical softirqs are handled in a timely manner (e.g., TIME_CALIBRATE_SOFTIRQ) while still avoiding being preempted by the scheduler (by SCHEDULE_SOFTIRQ), which is the reason for avoiding use of do_softirq() directly. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> xen-unstable changeset: 20714:a60f508548a8 xen-unstable date: Tue Dec 22 18:35:34 2009 +0000 --- xen/arch/x86/acpi/cpu_idle.c | 2 +- xen/arch/x86/domain_build.c | 6 +++--- xen/arch/x86/smpboot.c | 4 ++-- xen/common/page_alloc.c | 2 +- xen/common/softirq.c | 16 ++++++++++++++-- xen/common/timer.c | 9 --------- xen/drivers/char/console.c | 2 +- xen/include/xen/softirq.h | 7 +++++++ xen/include/xen/timer.h | 6 ------ 9 files changed, 29 insertions(+), 25 deletions(-) diff -r fc6ca854775c -r 6b0f9559fbd5 xen/arch/x86/acpi/cpu_idle.c --- a/xen/arch/x86/acpi/cpu_idle.c Tue Dec 22 11:37:27 2009 +0000 +++ b/xen/arch/x86/acpi/cpu_idle.c Wed Dec 23 07:53:58 2009 +0000 @@ -201,7 +201,7 @@ static void acpi_processor_idle(void) sched_tick_suspend(); /* sched_tick_suspend() can raise TIMER_SOFTIRQ. Process it now. */ - process_pending_timers(); + process_pending_softirqs(); /* * Interrupts must be disabled during bus mastering calculations and diff -r fc6ca854775c -r 6b0f9559fbd5 xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c Tue Dec 22 11:37:27 2009 +0000 +++ b/xen/arch/x86/domain_build.c Wed Dec 23 07:53:58 2009 +0000 @@ -878,7 +878,7 @@ int __init construct_dom0( ((unsigned int *)vphysmap_start)[pfn] = mfn; set_gpfn_from_mfn(mfn, pfn); if (!(pfn & 0xfffff)) - process_pending_timers(); + process_pending_softirqs(); } si->first_p2m_pfn = pfn; si->nr_p2m_frames = d->tot_pages - count; @@ -898,7 +898,7 @@ int __init construct_dom0( ++alloc_epfn; #endif if (!(pfn & 0xfffff)) - process_pending_timers(); + process_pending_softirqs(); } } BUG_ON(pfn != d->tot_pages); @@ -920,7 +920,7 @@ int __init construct_dom0( #undef pfn page++; pfn++; if (!(pfn & 0xfffff)) - process_pending_timers(); + process_pending_softirqs(); } } diff -r fc6ca854775c -r 6b0f9559fbd5 xen/arch/x86/smpboot.c --- a/xen/arch/x86/smpboot.c Tue Dec 22 11:37:27 2009 +0000 +++ b/xen/arch/x86/smpboot.c Wed Dec 23 07:53:58 2009 +0000 @@ -1305,7 +1305,7 @@ void __cpu_die(unsigned int cpu) } mdelay(100); mb(); - process_pending_timers(); + process_pending_softirqs(); if ((++i % 10) == 0) printk(KERN_ERR "CPU %u still not dead...\n", cpu); } @@ -1470,7 +1470,7 @@ int __devinit __cpu_up(unsigned int cpu) cpu_set(cpu, smp_commenced_mask); while (!cpu_isset(cpu, cpu_online_map)) { mb(); - process_pending_timers(); + process_pending_softirqs(); } cpufreq_add_cpu(cpu); diff -r fc6ca854775c -r 6b0f9559fbd5 xen/common/page_alloc.c --- a/xen/common/page_alloc.c Tue Dec 22 11:37:27 2009 +0000 +++ b/xen/common/page_alloc.c Wed Dec 23 07:53:58 2009 +0000 @@ -945,7 +945,7 @@ void __init scrub_heap_pages(void) for ( mfn = first_valid_mfn; mfn < max_page; mfn++ ) { - process_pending_timers(); + process_pending_softirqs(); /* Quick lock-free check. */ if ( allocated_in_map(mfn) ) diff -r fc6ca854775c -r 6b0f9559fbd5 xen/common/softirq.c --- a/xen/common/softirq.c Tue Dec 22 11:37:27 2009 +0000 +++ b/xen/common/softirq.c Wed Dec 23 07:53:58 2009 +0000 @@ -22,7 +22,7 @@ irq_cpustat_t irq_stat[NR_CPUS]; static softirq_handler softirq_handlers[NR_SOFTIRQS]; -asmlinkage void do_softirq(void) +static void __do_softirq(unsigned long ignore_mask) { unsigned int i, cpu; unsigned long pending; @@ -38,13 +38,25 @@ asmlinkage void do_softirq(void) if ( rcu_pending(cpu) ) rcu_check_callbacks(cpu); - if ( (pending = softirq_pending(cpu)) == 0 ) + if ( (pending = (softirq_pending(cpu) & ~ignore_mask)) == 0 ) break; i = find_first_set_bit(pending); clear_bit(i, &softirq_pending(cpu)); (*softirq_handlers[i])(); } +} + +void process_pending_softirqs(void) +{ + ASSERT(!in_irq() && local_irq_is_enabled()); + /* Do not enter scheduler as it can preempt the calling context. */ + __do_softirq(1ul<<SCHEDULE_SOFTIRQ); +} + +asmlinkage void do_softirq(void) +{ + __do_softirq(0); } void open_softirq(int nr, softirq_handler handler) diff -r fc6ca854775c -r 6b0f9559fbd5 xen/common/timer.c --- a/xen/common/timer.c Tue Dec 22 11:37:27 2009 +0000 +++ b/xen/common/timer.c Wed Dec 23 07:53:58 2009 +0000 @@ -464,15 +464,6 @@ static void timer_softirq_action(void) spin_unlock_irq(&ts->lock); } - -void process_pending_timers(void) -{ - unsigned int cpu = smp_processor_id(); - ASSERT(!in_irq() && local_irq_is_enabled()); - if ( test_and_clear_bit(TIMER_SOFTIRQ, &softirq_pending(cpu)) ) - timer_softirq_action(); -} - s_time_t align_timer(s_time_t firsttick, uint64_t period) { if ( !period ) diff -r fc6ca854775c -r 6b0f9559fbd5 xen/drivers/char/console.c --- a/xen/drivers/char/console.c Tue Dec 22 11:37:27 2009 +0000 +++ b/xen/drivers/char/console.c Wed Dec 23 07:53:58 2009 +0000 @@ -657,7 +657,7 @@ void __init console_endboot(void) printk("%d... ", 3-i); for ( j = 0; j < 100; j++ ) { - process_pending_timers(); + process_pending_softirqs(); mdelay(10); } } diff -r fc6ca854775c -r 6b0f9559fbd5 xen/include/xen/softirq.h --- a/xen/include/xen/softirq.h Tue Dec 22 11:37:27 2009 +0000 +++ b/xen/include/xen/softirq.h Wed Dec 23 07:53:58 2009 +0000 @@ -54,6 +54,13 @@ static inline void raise_softirq(unsigne } /* + * Process pending softirqs on this CPU. This should be called periodically + * when performing work that prevents softirqs from running in a timely manner. + * Use this instead of do_softirq() when you do not want to be preempted. + */ +void process_pending_softirqs(void); + +/* * TASKLETS -- dynamically-allocatable tasks run in softirq context * on at most one CPU at a time. */ diff -r fc6ca854775c -r 6b0f9559fbd5 xen/include/xen/timer.h --- a/xen/include/xen/timer.h Tue Dec 22 11:37:27 2009 +0000 +++ b/xen/include/xen/timer.h Wed Dec 23 07:53:58 2009 +0000 @@ -103,12 +103,6 @@ extern void kill_timer(struct timer *tim extern void kill_timer(struct timer *timer); /* - * Process pending timers on this CPU. This should be called periodically - * when performing work that prevents softirqs from running in a timely manner. - */ -extern void process_pending_timers(void); - -/* * Bootstrap initialisation. Must be called before any other timer function. */ extern void timer_init(void); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |