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

[Xen-changelog] [xen-unstable] [POWERPC][XEN] support for recursive spinlocks



# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID 228c34916020645d020cf39bfe5c502f9dd15650
# Parent  176c7264715ca51611801ebdd57a9dd6a09416c4
[POWERPC][XEN] support for recursive spinlocks
Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 xen/include/asm-powerpc/spinlock.h |   31 ++++++++++++++-----------------
 1 files changed, 14 insertions(+), 17 deletions(-)

diff -r 176c7264715c -r 228c34916020 xen/include/asm-powerpc/spinlock.h
--- a/xen/include/asm-powerpc/spinlock.h        Fri Nov 10 16:45:25 2006 -0600
+++ b/xen/include/asm-powerpc/spinlock.h        Fri Dec 01 16:57:03 2006 -0600
@@ -70,13 +70,10 @@ cas_u32(volatile u32 *ptr, u32 oval, u32
     return tmp;
 }
 
-typedef union {
+typedef struct {
     volatile u32 lock;
-    struct {
-        s8 recurse_cpu;
-        u8 recurse_cnt;
-        s16 lock;
-    } fields;
+       u16 recurse_cpu;
+       u16 recurse_cnt;
 } spinlock_t;
 
 #define __UNLOCKED (0U)
@@ -181,17 +178,17 @@ static inline void _raw_spin_unlock_recu
 static inline void _raw_spin_unlock_recursive(spinlock_t *lock)
 {
     int cpu = smp_processor_id();
-    if (likely(lock->fields.recurse_cpu != cpu)) {
+    if (likely(lock->recurse_cpu != cpu)) {
         spin_lock(lock);
-        lock->fields.recurse_cpu = cpu;
-    }
-    lock->fields.recurse_cnt++;
+        lock->recurse_cpu = cpu;
+    }
+    lock->recurse_cnt++;
 }
 
 static inline void _raw_spin_unlock_recursive(spinlock_t *lock)
 {
-    if (likely(--lock->fields.recurse_cnt == 0)) {
-        lock->fields.recurse_cpu = -1;
+    if (likely(--lock->recurse_cnt == 0)) {
+        lock->recurse_cpu = -1;
         spin_unlock(lock);
     }
 }
@@ -200,19 +197,19 @@ static inline void _raw_spin_unlock_recu
 #define _raw_spin_lock_recursive(_lock)            \
     do {                                           \
         int cpu = smp_processor_id();              \
-        if ( likely((_lock)->fields.recurse_cpu != cpu) ) \
+        if ( likely((_lock)->recurse_cpu != cpu) ) \
         {                                          \
             spin_lock(_lock);                      \
-            (_lock)->fields.recurse_cpu = cpu;            \
+            (_lock)->recurse_cpu = cpu;            \
         }                                          \
-        (_lock)->fields.recurse_cnt++;                    \
+        (_lock)->recurse_cnt++;                    \
     } while ( 0 )
 
 #define _raw_spin_unlock_recursive(_lock)          \
     do {                                           \
-        if ( likely(--(_lock)->fields.recurse_cnt == 0) ) \
+        if ( likely(--(_lock)->recurse_cnt == 0) ) \
         {                                          \
-            (_lock)->fields.recurse_cpu = -1;             \
+            (_lock)->recurse_cpu = -1;             \
             spin_unlock(_lock);                    \
         }                                          \
     } while ( 0 )

_______________________________________________
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®.