ia64/xen-unstable

changeset 18704:876618c33914

Define spin_barrier_irq() for IRQ-safe spinlocks, and use it for virq_lock.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Oct 22 15:06:01 2008 +0100 (2008-10-22)
parents 6f74549ac4c5
children ad39300ca063
files xen/common/event_channel.c xen/common/spinlock.c xen/include/xen/spinlock.h
line diff
     1.1 --- a/xen/common/event_channel.c	Wed Oct 22 12:08:16 2008 +0100
     1.2 +++ b/xen/common/event_channel.c	Wed Oct 22 15:06:01 2008 +0100
     1.3 @@ -386,7 +386,7 @@ static long __evtchn_close(struct domain
     1.4              if ( v->virq_to_evtchn[chn1->u.virq] != port1 )
     1.5                  continue;
     1.6              v->virq_to_evtchn[chn1->u.virq] = 0;
     1.7 -            spin_barrier(&v->virq_lock);
     1.8 +            spin_barrier_irq(&v->virq_lock);
     1.9          }
    1.10          break;
    1.11  
     2.1 --- a/xen/common/spinlock.c	Wed Oct 22 12:08:16 2008 +0100
     2.2 +++ b/xen/common/spinlock.c	Wed Oct 22 15:06:01 2008 +0100
     2.3 @@ -54,6 +54,14 @@ void _spin_barrier(spinlock_t *lock)
     2.4      mb();
     2.5  }
     2.6  
     2.7 +void _spin_barrier_irq(spinlock_t *lock)
     2.8 +{
     2.9 +    unsigned long flags;
    2.10 +    local_irq_save(flags);
    2.11 +    _spin_barrier(lock);
    2.12 +    local_irq_restore(flags);
    2.13 +}
    2.14 +
    2.15  void _spin_lock_recursive(spinlock_t *lock)
    2.16  {
    2.17      int cpu = smp_processor_id();
     3.1 --- a/xen/include/xen/spinlock.h	Wed Oct 22 12:08:16 2008 +0100
     3.2 +++ b/xen/include/xen/spinlock.h	Wed Oct 22 15:06:01 2008 +0100
     3.3 @@ -34,6 +34,7 @@ void _spin_unlock_irqrestore(spinlock_t 
     3.4  int _spin_is_locked(spinlock_t *lock);
     3.5  int _spin_trylock(spinlock_t *lock);
     3.6  void _spin_barrier(spinlock_t *lock);
     3.7 +void _spin_barrier_irq(spinlock_t *lock);
     3.8  
     3.9  void _spin_lock_recursive(spinlock_t *lock);
    3.10  void _spin_unlock_recursive(spinlock_t *lock);
    3.11 @@ -67,6 +68,7 @@ void _write_unlock_irqrestore(rwlock_t *
    3.12  
    3.13  /* Ensure a lock is quiescent between two critical operations. */
    3.14  #define spin_barrier(l)               _spin_barrier(l)
    3.15 +#define spin_barrier_irq(l)           _spin_barrier_irq(l)
    3.16  
    3.17  /*
    3.18   * spin_[un]lock_recursive(): Use these forms when the lock can (safely!) be