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-devel

[Xen-devel] [patch] define and use cpu_test_and_clear() and some type ch

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch] define and use cpu_test_and_clear() and some type checking fixes
From: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Date: Wed, 19 Apr 2006 11:55:34 -0400
Delivery-date: Wed, 19 Apr 2006 08:56:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
This patch defines a test_and_clear bitop for cpumask_t pointers.
Also fixes "wrong pointer type" for type specific bitops by using &foo [0] instead of &foo.
NOTE: hard tabs are not my own :)

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
--

diff -r b3ca881c903b xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h Wed Apr 19 10:26:37 2006 -0400
+++ b/xen/include/xen/cpumask.h Wed Apr 19 11:45:07 2006 -0400
@@ -111,6 +111,12 @@ static inline int __cpu_test_and_set(int
static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
{
        return test_and_set_bit(cpu, addr->bits);
+}
+
+#define cpu_test_and_clear(cpu, cpumask) __cpu_test_and_clear((cpu), &(cpumask))
+static inline int __cpu_test_and_clear(int cpu, cpumask_t *addr)
+{
+       return test_and_clear_bit(cpu, addr->bits);
}
#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), & (src2), NR_CPUS)
diff -r b3ca881c903b xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c        Wed Apr 19 10:26:37 2006 -0400
+++ b/xen/arch/x86/irq.c        Wed Apr 19 11:45:07 2006 -0400
@@ -198,7 +198,7 @@ static void __do_IRQ_guest(int vector)
     {
         d = action->guest[i];
         if ( (action->ack_type != ACKTYPE_NONE) &&
-             !test_and_set_bit(irq, &d->pirq_mask) )
+             !test_and_set_bit(irq, &d->pirq_mask[0]) )
             action->in_flight++;
         send_guest_pirq(d, irq);
     }
@@ -235,7 +235,7 @@ static void __set_eoi_ready(irq_desc_t *
     if ( !(desc->status & IRQ_GUEST) ||
          (action->in_flight != 0) ||
-         !test_and_clear_bit(cpu, &action->cpu_eoi_map) )
+         !cpu_test_and_clear(cpu, action->cpu_eoi_map) )
         return;
     sp = pending_eoi_sp(cpu);
@@ -285,7 +285,7 @@ static void flush_all_pending_eoi(void *
         ASSERT(action->ack_type == ACKTYPE_EOI);
         ASSERT(desc->status & IRQ_GUEST);
         for ( i = 0; i < action->nr_guests; i++ )
- clear_bit(vector_to_irq(vector), &action->guest[i]- >pirq_mask); + clear_bit(vector_to_irq(vector), &action->guest[i]- >pirq_mask[0]);
         action->in_flight = 0;
         spin_unlock(&desc->lock);
     }
@@ -311,7 +311,7 @@ int pirq_guest_unmask(struct domain *d)
         spin_lock_irq(&desc->lock);
         if ( !test_bit(d->pirq_to_evtchn[pirq], &s->evtchn_mask[0]) &&
-             test_and_clear_bit(pirq, &d->pirq_mask) )
+             test_and_clear_bit(pirq, &d->pirq_mask[0]) )
         {
             ASSERT(action->ack_type != ACKTYPE_NONE);
             if ( --action->in_flight == 0 )
@@ -322,7 +322,7 @@ int pirq_guest_unmask(struct domain *d)
             }
         }
-        if ( __test_and_clear_bit(cpu, &cpu_eoi_map) )
+        if ( cpu_test_and_clear(cpu, cpu_eoi_map) )
         {
             __set_eoi_ready(desc);
             spin_unlock(&desc->lock);
@@ -493,13 +493,13 @@ int pirq_guest_unbind(struct domain *d,
     switch ( action->ack_type )
     {
     case ACKTYPE_UNMASK:
-        if ( test_and_clear_bit(irq, &d->pirq_mask) &&
+        if ( test_and_clear_bit(irq, &d->pirq_mask[0]) &&
              (--action->in_flight == 0) )
             desc->handler->end(vector);
         break;
     case ACKTYPE_EOI:
         /* NB. If #guests == 0 then we clear the eoi_map later on. */
-        if ( test_and_clear_bit(irq, &d->pirq_mask) &&
+        if ( test_and_clear_bit(irq, &d->pirq_mask[0]) &&
              (--action->in_flight == 0) &&
              (action->nr_guests != 0) )
         {
@@ -511,7 +511,7 @@ int pirq_guest_unbind(struct domain *d,
         break;
     }
-    BUG_ON(test_bit(irq, &d->pirq_mask));
+    BUG_ON(test_bit(irq, &d->pirq_mask[0]));
     if ( action->nr_guests != 0 )
         goto out;


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [patch] define and use cpu_test_and_clear() and some type checking fixes, Jimi Xenidis <=