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] x86 hpet: Avoid use of cpu_possible_map

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86 hpet: Avoid use of cpu_possible_map
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 May 2010 05:15:49 -0700
Delivery-date: Wed, 19 May 2010 05:18:35 -0700
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 1273911426 -3600
# Node ID b9d57c3c01b91d6a675e8d9053318601f8cb435d
# Parent  b59663d61e825b33fde3e58325e23b5839c302e1
x86 hpet: Avoid use of cpu_possible_map

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hpet.c |   51 ++++++++++++++-------------------------------------
 1 files changed, 14 insertions(+), 37 deletions(-)

diff -r b59663d61e82 -r b9d57c3c01b9 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Sat May 15 09:16:47 2010 +0100
+++ b/xen/arch/x86/hpet.c       Sat May 15 09:17:06 2010 +0100
@@ -428,16 +428,7 @@ static int hpet_fsb_cap_lookup(void)
         if ( hpet_assign_irq(ch) )
             continue;
 
-        /* set default irq affinity */
-        ch->cpu = num_chs_used;
-        per_cpu(cpu_bc_channel, ch->cpu) = ch;
-        irq_desc[ch->irq].handler->
-            set_affinity(ch->irq, cpumask_of_cpu(ch->cpu));
-
         num_chs_used++;
-
-        if ( num_chs_used == num_possible_cpus() )
-            break;
     }
 
     printk(XENLOG_INFO
@@ -455,6 +446,9 @@ static struct hpet_event_channel *hpet_g
     int i;
     int next;
     struct hpet_event_channel *ch;
+
+    if ( num_hpets_used == 0 )
+        return &legacy_hpet_event;
 
     spin_lock(&next_lock);
     next = next_channel = (next_channel + 1) % num_hpets_used;
@@ -479,8 +473,10 @@ static struct hpet_event_channel *hpet_g
     return ch;
 }
 
-static void hpet_attach_channel_share(int cpu, struct hpet_event_channel *ch)
-{
+static void hpet_attach_channel(int cpu, struct hpet_event_channel *ch)
+{
+    ASSERT(spin_is_locked(&ch->lock));
+
     per_cpu(cpu_bc_channel, cpu) = ch;
 
     /* try to be the channel owner again while holding the lock */
@@ -495,9 +491,10 @@ static void hpet_attach_channel_share(in
         set_affinity(ch->irq, cpumask_of_cpu(ch->cpu));
 }
 
-static void hpet_detach_channel_share(int cpu)
-{
-    struct hpet_event_channel *ch = per_cpu(cpu_bc_channel, cpu);
+static void hpet_detach_channel(int cpu, struct hpet_event_channel *ch)
+{
+    ASSERT(spin_is_locked(&ch->lock));
+    ASSERT(ch == per_cpu(cpu_bc_channel, cpu));
 
     per_cpu(cpu_bc_channel, cpu) = NULL;
 
@@ -516,9 +513,6 @@ static void hpet_detach_channel_share(in
     irq_desc[ch->irq].handler->
         set_affinity(ch->irq, cpumask_of_cpu(ch->cpu));
 }
-
-static void (*hpet_attach_channel)(int cpu, struct hpet_event_channel *ch);
-static void (*hpet_detach_channel)(int cpu);
 
 #include <asm/mc146818rtc.h>
 
@@ -587,12 +581,6 @@ void hpet_broadcast_init(void)
             spin_lock_init(&hpet_events[i].lock);
         }
 
-        if ( num_hpets_used < num_possible_cpus() )
-        {
-            hpet_attach_channel = hpet_attach_channel_share;
-            hpet_detach_channel = hpet_detach_channel_share;
-        }
-
         return;
     }
 
@@ -626,9 +614,6 @@ void hpet_broadcast_init(void)
     legacy_hpet_event.flags = 0;
     spin_lock_init(&legacy_hpet_event.lock);
 
-    for_each_possible_cpu(i)
-        per_cpu(cpu_bc_channel, i) = &legacy_hpet_event;
-
     if ( !force_hpet_broadcast )
         pv_rtc_handler = handle_rtc_once;
 }
@@ -667,16 +652,13 @@ void hpet_broadcast_enter(void)
 
     if ( !ch )
         ch = hpet_get_channel(cpu);
-    BUG_ON( !ch );
 
     ASSERT(!local_irq_is_enabled());
 
-    if ( hpet_attach_channel )
+    if ( ch != &legacy_hpet_event )
     {
         spin_lock(&ch->lock);
-
         hpet_attach_channel(cpu, ch);
-
         spin_unlock(&ch->lock);
     }
 
@@ -702,8 +684,6 @@ void hpet_broadcast_exit(void)
     if ( this_cpu(timer_deadline_start) == 0 )
         return;
 
-    BUG_ON( !ch );
-
     /* Reprogram the deadline; trigger timer work now if it has passed. */
     enable_APIC_timer();
     if ( !reprogram_timer(this_cpu(timer_deadline_start)) )
@@ -717,13 +697,10 @@ void hpet_broadcast_exit(void)
 
     spin_unlock_irq(&ch->lock);
 
-
-    if ( hpet_detach_channel )
+    if ( ch != &legacy_hpet_event )
     {
         spin_lock_irq(&ch->lock);
-
-        hpet_detach_channel(cpu);
-
+        hpet_detach_channel(cpu, ch);
         spin_unlock_irq(&ch->lock);
     }
 }

_______________________________________________
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] x86 hpet: Avoid use of cpu_possible_map, Xen patchbot-unstable <=