WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Replace process_pending_timers() with pro

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Replace process_pending_timers() with process_pending_softirqs().
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 22 Dec 2009 10:40:14 -0800
Delivery-date: Tue, 22 Dec 2009 10:40:56 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1261506934 0
# Node ID a60f508548a848ab7f92a5960dcc5df8e75f8c0f
# Parent  affb589507a7bea502ce7d0c8c3fa47ec9e4ff22
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/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 affb589507a7 -r a60f508548a8 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c      Tue Dec 22 18:18:07 2009 +0000
+++ b/xen/arch/x86/acpi/cpu_idle.c      Tue Dec 22 18:35:34 2009 +0000
@@ -230,7 +230,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 affb589507a7 -r a60f508548a8 xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       Tue Dec 22 18:18:07 2009 +0000
+++ b/xen/arch/x86/domain_build.c       Tue Dec 22 18:35:34 2009 +0000
@@ -924,7 +924,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;
@@ -945,7 +945,7 @@ int __init construct_dom0(
             ++alloc_epfn;
 #endif
             if (!(pfn & 0xfffff))
-                process_pending_timers();
+                process_pending_softirqs();
         }
     }
     BUG_ON(pfn != d->tot_pages);
@@ -967,7 +967,7 @@ int __init construct_dom0(
 #undef pfn
             page++; pfn++;
             if (!(pfn & 0xfffff))
-                process_pending_timers();
+                process_pending_softirqs();
         }
     }
 
diff -r affb589507a7 -r a60f508548a8 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Tue Dec 22 18:18:07 2009 +0000
+++ b/xen/arch/x86/smpboot.c    Tue Dec 22 18:35:34 2009 +0000
@@ -1327,7 +1327,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);
        }
@@ -1547,7 +1547,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 affb589507a7 -r a60f508548a8 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Tue Dec 22 18:18:07 2009 +0000
+++ b/xen/common/page_alloc.c   Tue Dec 22 18:35:34 2009 +0000
@@ -893,7 +893,7 @@ void __init scrub_heap_pages(void)
 
     for ( mfn = first_valid_mfn; mfn < max_page; mfn++ )
     {
-        process_pending_timers();
+        process_pending_softirqs();
 
         pg = mfn_to_page(mfn);
 
diff -r affb589507a7 -r a60f508548a8 xen/common/softirq.c
--- a/xen/common/softirq.c      Tue Dec 22 18:18:07 2009 +0000
+++ b/xen/common/softirq.c      Tue Dec 22 18:35:34 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 affb589507a7 -r a60f508548a8 xen/common/timer.c
--- a/xen/common/timer.c        Tue Dec 22 18:18:07 2009 +0000
+++ b/xen/common/timer.c        Tue Dec 22 18:35:34 2009 +0000
@@ -467,15 +467,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 affb589507a7 -r a60f508548a8 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c        Tue Dec 22 18:18:07 2009 +0000
+++ b/xen/drivers/char/console.c        Tue Dec 22 18:35:34 2009 +0000
@@ -650,7 +650,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 affb589507a7 -r a60f508548a8 xen/include/xen/softirq.h
--- a/xen/include/xen/softirq.h Tue Dec 22 18:18:07 2009 +0000
+++ b/xen/include/xen/softirq.h Tue Dec 22 18:35:34 2009 +0000
@@ -34,6 +34,13 @@ void raise_softirq(unsigned int nr);
 void raise_softirq(unsigned int nr);
 
 /*
+ * 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 affb589507a7 -r a60f508548a8 xen/include/xen/timer.h
--- a/xen/include/xen/timer.h   Tue Dec 22 18:18:07 2009 +0000
+++ b/xen/include/xen/timer.h   Tue Dec 22 18:35:34 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Replace process_pending_timers() with process_pending_softirqs()., Xen patchbot-unstable <=