ia64/xen-unstable

changeset 12958:228c34916020

[POWERPC][XEN] support for recursive spinlocks
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Hollis Blanchard <hollisb@us.ibm.com>
date Fri Dec 01 16:57:03 2006 -0600 (2006-12-01)
parents 176c7264715c
children 88aab6f585d3
files xen/include/asm-powerpc/spinlock.h
line diff
     1.1 --- a/xen/include/asm-powerpc/spinlock.h	Fri Nov 10 16:45:25 2006 -0600
     1.2 +++ b/xen/include/asm-powerpc/spinlock.h	Fri Dec 01 16:57:03 2006 -0600
     1.3 @@ -70,13 +70,10 @@ cas_u32(volatile u32 *ptr, u32 oval, u32
     1.4      return tmp;
     1.5  }
     1.6  
     1.7 -typedef union {
     1.8 +typedef struct {
     1.9      volatile u32 lock;
    1.10 -    struct {
    1.11 -        s8 recurse_cpu;
    1.12 -        u8 recurse_cnt;
    1.13 -        s16 lock;
    1.14 -    } fields;
    1.15 +	u16 recurse_cpu;
    1.16 +	u16 recurse_cnt;
    1.17  } spinlock_t;
    1.18  
    1.19  #define __UNLOCKED (0U)
    1.20 @@ -181,17 +178,17 @@ static inline void _raw_read_unlock(rwlo
    1.21  static inline void _raw_spin_unlock_recursive(spinlock_t *lock)
    1.22  {
    1.23      int cpu = smp_processor_id();
    1.24 -    if (likely(lock->fields.recurse_cpu != cpu)) {
    1.25 +    if (likely(lock->recurse_cpu != cpu)) {
    1.26          spin_lock(lock);
    1.27 -        lock->fields.recurse_cpu = cpu;
    1.28 +        lock->recurse_cpu = cpu;
    1.29      }
    1.30 -    lock->fields.recurse_cnt++;
    1.31 +    lock->recurse_cnt++;
    1.32  }
    1.33  
    1.34  static inline void _raw_spin_unlock_recursive(spinlock_t *lock)
    1.35  {
    1.36 -    if (likely(--lock->fields.recurse_cnt == 0)) {
    1.37 -        lock->fields.recurse_cpu = -1;
    1.38 +    if (likely(--lock->recurse_cnt == 0)) {
    1.39 +        lock->recurse_cpu = -1;
    1.40          spin_unlock(lock);
    1.41      }
    1.42  }
    1.43 @@ -200,19 +197,19 @@ static inline void _raw_spin_unlock_recu
    1.44  #define _raw_spin_lock_recursive(_lock)            \
    1.45      do {                                           \
    1.46          int cpu = smp_processor_id();              \
    1.47 -        if ( likely((_lock)->fields.recurse_cpu != cpu) ) \
    1.48 +        if ( likely((_lock)->recurse_cpu != cpu) ) \
    1.49          {                                          \
    1.50              spin_lock(_lock);                      \
    1.51 -            (_lock)->fields.recurse_cpu = cpu;            \
    1.52 +            (_lock)->recurse_cpu = cpu;            \
    1.53          }                                          \
    1.54 -        (_lock)->fields.recurse_cnt++;                    \
    1.55 +        (_lock)->recurse_cnt++;                    \
    1.56      } while ( 0 )
    1.57  
    1.58  #define _raw_spin_unlock_recursive(_lock)          \
    1.59      do {                                           \
    1.60 -        if ( likely(--(_lock)->fields.recurse_cnt == 0) ) \
    1.61 +        if ( likely(--(_lock)->recurse_cnt == 0) ) \
    1.62          {                                          \
    1.63 -            (_lock)->fields.recurse_cpu = -1;             \
    1.64 +            (_lock)->recurse_cpu = -1;             \
    1.65              spin_unlock(_lock);                    \
    1.66          }                                          \
    1.67      } while ( 0 )