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: allocate CPU masks dynamically

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86/hpet: allocate CPU masks dynamically
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Tue, 25 Oct 2011 01:55:15 +0100
Delivery-date: Mon, 24 Oct 2011 17:55:59 -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 Jan Beulich <jbeulich@xxxxxxxx>
# Date 1319183087 -7200
# Node ID 1c8789852eafea3a40664283ef19096e09a4cc43
# Parent  8269826353d8b9e5bb6248f22e85f6d4280ad9c9
x86/hpet: allocate CPU masks dynamically

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 8269826353d8 -r 1c8789852eaf xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Fri Oct 21 09:44:03 2011 +0200
+++ b/xen/arch/x86/hpet.c       Fri Oct 21 09:44:47 2011 +0200
@@ -33,7 +33,7 @@
     unsigned long mult;
     int           shift;
     s_time_t      next_event;
-    cpumask_t     cpumask;
+    cpumask_var_t cpumask;
     spinlock_t    lock;
     void          (*event_handler)(struct hpet_event_channel *);
 
@@ -182,14 +182,14 @@
     now = NOW();
 
     /* find all expired events */
-    for_each_cpu_mask(cpu, ch->cpumask)
+    for_each_cpu_mask(cpu, *ch->cpumask)
     {
         s_time_t deadline;
 
         rmb();
         deadline = per_cpu(timer_deadline, cpu);
         rmb();
-        if ( !cpumask_test_cpu(cpu, &ch->cpumask) )
+        if ( !cpumask_test_cpu(cpu, ch->cpumask) )
             continue;
 
         if ( deadline <= now )
@@ -377,6 +377,16 @@
         if ( !(cfg & HPET_TN_FSB_CAP) )
             continue;
 
+        if ( !zalloc_cpumask_var(&ch->cpumask) )
+        {
+            if ( !num_hpets_used )
+            {
+                xfree(hpet_events);
+                hpet_events = NULL;
+            }
+            break;
+        }
+
         ch->flags = 0;
         ch->idx = i;
 
@@ -449,14 +459,14 @@
     if ( cpu != ch->cpu )
         return;
 
-    if ( cpus_empty(ch->cpumask) )
+    if ( cpumask_empty(ch->cpumask) )
     {
         ch->cpu = -1;
         clear_bit(HPET_EVT_USED_BIT, &ch->flags);
         return;
     }
 
-    ch->cpu = first_cpu(ch->cpumask);
+    ch->cpu = cpumask_first(ch->cpumask);
     hpet_msi_set_affinity(irq_to_desc(ch->irq), cpumask_of(ch->cpu));
 }
 
@@ -502,7 +512,14 @@
             return;
 
         if ( !hpet_events )
+        {
             hpet_events = xzalloc(struct hpet_event_channel);
+            if ( hpet_events && !zalloc_cpumask_var(&hpet_events->cpumask) )
+            {
+                xfree(hpet_events);
+                hpet_events = NULL;
+            }
+        }
         if ( !hpet_events )
             return;
         hpet_events->irq = -1;
@@ -635,7 +652,7 @@
 
     /* Disable LAPIC timer interrupts. */
     disable_APIC_timer();
-    cpu_set(cpu, ch->cpumask);
+    cpumask_set_cpu(cpu, ch->cpumask);
 
     spin_lock(&ch->lock);
     /* reprogram if current cpu expire time is nearer */
@@ -660,7 +677,7 @@
     if ( !reprogram_timer(per_cpu(timer_deadline, cpu)) )
         raise_softirq(TIMER_SOFTIRQ);
 
-    cpu_clear(cpu, ch->cpumask);
+    cpumask_clear_cpu(cpu, ch->cpumask);
 
     if ( !(ch->flags & HPET_EVT_LEGACY) )
     {

_______________________________________________
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: allocate CPU masks dynamically, Xen patchbot-unstable <=