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] timer: Don't hardcode cpu0 in migrate_tim

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] timer: Don't hardcode cpu0 in migrate_timers_from_cpu().
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 17 Jan 2011 07:59:10 -0800
Delivery-date: Mon, 17 Jan 2011 08:09:26 -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@xxxxxxx>
# Date 1294483381 0
# Node ID 1a64415c959f264ec324e589060fab6417039705
# Parent  0e49e25904623af4b03b614c10c54fce77f05909
timer: Don't hardcode cpu0 in migrate_timers_from_cpu().

Although we don't allow cpu0 to be offlined, there's no need to
hardcode that assumption in the timer subsystem.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/common/timer.c |   56 ++++++++++++++++++++++++++++++++---------------------
 1 files changed, 34 insertions(+), 22 deletions(-)

diff -r 0e49e2590462 -r 1a64415c959f xen/common/timer.c
--- a/xen/common/timer.c        Sat Jan 08 10:09:44 2011 +0000
+++ b/xen/common/timer.c        Sat Jan 08 10:43:01 2011 +0000
@@ -546,39 +546,51 @@ static struct keyhandler dump_timerq_key
     .desc = "dump timer queues"
 };
 
-static void migrate_timers_from_cpu(unsigned int cpu)
-{
-    struct timers *ts;
+static void migrate_timers_from_cpu(unsigned int old_cpu)
+{
+    unsigned int new_cpu = first_cpu(cpu_online_map);
+    struct timers *old_ts, *new_ts;
     struct timer *t;
     bool_t notify = 0;
 
-    ASSERT((cpu != 0) && cpu_online(0));
-
-    ts = &per_cpu(timers, cpu);
-
-    spin_lock_irq(&per_cpu(timers, 0).lock);
-    spin_lock(&ts->lock);
-
-    while ( (t = GET_HEAP_SIZE(ts->heap) ? ts->heap[1] : ts->list) != NULL )
+    ASSERT(!cpu_online(old_cpu) && cpu_online(new_cpu));
+
+    old_ts = &per_cpu(timers, old_cpu);
+    new_ts = &per_cpu(timers, new_cpu);
+
+    if ( old_cpu < new_cpu )
+    {
+        spin_lock_irq(&old_ts->lock);
+        spin_lock(&new_ts->lock);
+    }
+    else
+    {
+        spin_lock_irq(&new_ts->lock);
+        spin_lock(&old_ts->lock);
+    }
+
+    while ( (t = GET_HEAP_SIZE(old_ts->heap)
+             ? old_ts->heap[1] : old_ts->list) != NULL )
     {
         remove_entry(t);
-        atomic_write16(&t->cpu, 0);
+        atomic_write16(&t->cpu, new_cpu);
         notify |= add_entry(t);
     }
 
-    while ( !list_empty(&ts->inactive) )
-    {
-        t = list_entry(ts->inactive.next, struct timer, inactive);
+    while ( !list_empty(&old_ts->inactive) )
+    {
+        t = list_entry(old_ts->inactive.next, struct timer, inactive);
         list_del(&t->inactive);
-        atomic_write16(&t->cpu, 0);
-        list_add(&t->inactive, &per_cpu(timers, 0).inactive);
-    }
-
-    spin_unlock(&ts->lock);
-    spin_unlock_irq(&per_cpu(timers, 0).lock);
+        atomic_write16(&t->cpu, new_cpu);
+        list_add(&t->inactive, &new_ts->inactive);
+    }
+
+    spin_unlock(&old_ts->lock);
+    spin_unlock_irq(&new_ts->lock);
+    local_irq_enable();
 
     if ( notify )
-        cpu_raise_softirq(0, TIMER_SOFTIRQ);
+        cpu_raise_softirq(new_cpu, TIMER_SOFTIRQ);
 }
 
 static struct timer *dummy_heap;

_______________________________________________
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] timer: Don't hardcode cpu0 in migrate_timers_from_cpu()., Xen patchbot-unstable <=