[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Define spin_barrier_irq() for IRQ-safe spinlocks, and use it for virq_lock.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1224684361 -3600
# Node ID 876618c33914861f3abce927001b0ffc98a203a9
# Parent  6f74549ac4c5b9a83187994e6c7b149961b176da
Define spin_barrier_irq() for IRQ-safe spinlocks, and use it for virq_lock.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/event_channel.c |    2 +-
 xen/common/spinlock.c      |    8 ++++++++
 xen/include/xen/spinlock.h |    2 ++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff -r 6f74549ac4c5 -r 876618c33914 xen/common/event_channel.c
--- a/xen/common/event_channel.c        Wed Oct 22 12:08:16 2008 +0100
+++ b/xen/common/event_channel.c        Wed Oct 22 15:06:01 2008 +0100
@@ -386,7 +386,7 @@ static long __evtchn_close(struct domain
             if ( v->virq_to_evtchn[chn1->u.virq] != port1 )
                 continue;
             v->virq_to_evtchn[chn1->u.virq] = 0;
-            spin_barrier(&v->virq_lock);
+            spin_barrier_irq(&v->virq_lock);
         }
         break;
 
diff -r 6f74549ac4c5 -r 876618c33914 xen/common/spinlock.c
--- a/xen/common/spinlock.c     Wed Oct 22 12:08:16 2008 +0100
+++ b/xen/common/spinlock.c     Wed Oct 22 15:06:01 2008 +0100
@@ -52,6 +52,14 @@ void _spin_barrier(spinlock_t *lock)
 {
     do { mb(); } while ( _raw_spin_is_locked(&lock->raw) );
     mb();
+}
+
+void _spin_barrier_irq(spinlock_t *lock)
+{
+    unsigned long flags;
+    local_irq_save(flags);
+    _spin_barrier(lock);
+    local_irq_restore(flags);
 }
 
 void _spin_lock_recursive(spinlock_t *lock)
diff -r 6f74549ac4c5 -r 876618c33914 xen/include/xen/spinlock.h
--- a/xen/include/xen/spinlock.h        Wed Oct 22 12:08:16 2008 +0100
+++ b/xen/include/xen/spinlock.h        Wed Oct 22 15:06:01 2008 +0100
@@ -34,6 +34,7 @@ int _spin_is_locked(spinlock_t *lock);
 int _spin_is_locked(spinlock_t *lock);
 int _spin_trylock(spinlock_t *lock);
 void _spin_barrier(spinlock_t *lock);
+void _spin_barrier_irq(spinlock_t *lock);
 
 void _spin_lock_recursive(spinlock_t *lock);
 void _spin_unlock_recursive(spinlock_t *lock);
@@ -67,6 +68,7 @@ void _write_unlock_irqrestore(rwlock_t *
 
 /* Ensure a lock is quiescent between two critical operations. */
 #define spin_barrier(l)               _spin_barrier(l)
+#define spin_barrier_irq(l)           _spin_barrier_irq(l)
 
 /*
  * spin_[un]lock_recursive(): Use these forms when the lock can (safely!) be

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.