Skip to contentSkip to conversation

doh! NMCS patches attached.

Linux-ia64 john stultz 1 participant 1 message Feb 15, 2002 Library code

lore
Share & tools
lore
#0 lore raw

<smack>
-john

Index: linux24/include/asm-ia64/processor.h

include/asm-ia64/processor.h renamed from include/asm-ia64/processor.h:1.1.1.1 +2 -0
diff -u linux24/include/asm-ia64/processor.h:1.1.1.1 linux24/include/asm-ia64/processor.h:1.1.1.1.20.1
@@ -547,6 +547,8 @@
 extern void ia64_load_pm_regs (struct task_struct *task);
 #endif
 
+#define rep_nop() /*not an ia64 op*/
+
 #define ia64_fph_enable()	asm volatile (";; rsm psr.dfh;; srlz.d;;" ::: "memory");
 #define ia64_fph_disable()	asm volatile (";; ssm psr.dfh;; srlz.d;;" ::: "memory");
 

Index: linux24/include/linux/mcslock.h

include/linux/mcslock.h new file +158 -0

158 lines not on this page · raw message

Index: linux24/lib/Makefile

lib/Makefile renamed from lib/Makefile:1.1.1.1 +1 -1
diff -u linux24/lib/Makefile:1.1.1.1 linux24/lib/Makefile:1.1.1.1.18.1
@@ -10,7 +10,7 @@
 
 export-objs := cmdline.o dec_and_lock.o rwsem-spinlock.o rwsem.o
 
-obj-y := errno.o ctype.o string.o vsprintf.o brlock.o cmdline.o bust_spinlocks.o rbtree.o
+obj-y := errno.o ctype.o string.o vsprintf.o brlock.o cmdline.o bust_spinlocks.o rbtree.o mcslock.o
 
 obj-$(CONFIG_RWSEM_GENERIC_SPINLOCK) += rwsem-spinlock.o
 obj-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o

Index: linux24/lib/mcslock.c

lib/mcslock.c new file +31 -0
diff -u /dev/null linux24/lib/mcslock.c:1.1.4.1
@@ -0,0 +1,31 @@
+#include <linux/mcslock.h>
+
+/*non inlined versions of mcs lock*/
+void mcs_lock(mcslock_t* lock,  mcsnode_t* instance)
+{
+	__mcs_lock(lock, instance);
+}
+int  mcs_trylock(mcslock_t* lock, mcsnode_t* instance)
+{
+	return __mcs_trylock(lock, instance);
+}
+void mcs_unlock(mcslock_t* lock, mcsnode_t* instance)
+{
+	__mcs_unlock(lock, instance);
+}
+
+/*non inlined versions of nodeless mcs lock*/
+void nmcs_lock(nmcslock_t* lock)
+{
+	__nmcs_lock(lock);
+}
+
+int nmcs_trylock(nmcslock_t* lock)
+{
+	return __nmcs_trylock(lock);
+}
+
+void nmcs_unlock(nmcslock_t* lock)
+{
+	__nmcs_unlock(lock);
+}

Index: linux24/include/asm-i386/spinlock.h

include/asm-i386/spinlock.h renamed from include/asm-i386/spinlock.h:1.1.1.1 +15 -0
diff -u linux24/include/asm-i386/spinlock.h:1.1.1.1 linux24/include/asm-i386/spinlock.h:1.1.1.1.22.1
@@ -23,6 +23,8 @@
  * Your basic SMP spinlocks, allowing only a single CPU anywhere
  */
 
+#define USE_NMCS_LOCK
+#ifndef USE_NMCS_LOCK
 typedef struct {
 	volatile unsigned int lock;
 #if SPINLOCK_DEBUG
@@ -137,7 +139,20 @@
 		spin_lock_string
 		:"=m" (lock->lock) : : "memory");
 }
+#else /*!USE_NMCS_LOCK*/
+#include <linux/mcslock.h>
+#define spinlock_t nmcslock_t
+#define SPIN_LOCK_UNLOCKED NMCS_LOCK_UNLOCKED
+
+#define spin_lock_init(x)	nmcs_lock_init(x)	
+#define spin_is_locked(x)	nmcs_is_locked(x)
+#define spin_unlock_wait(x)	nmcs_unlock_wait(x)
+
+#define spin_lock(x)	nmcs_lock(x)
+#define spin_trylock(x)	nmcs_trylock(x) 
+#define spin_unlock(x)	nmcs_unlock(x) 
 
+#endif
 
 /*
  * Read-write spinlocks, allowing multiple readers

Index: linux24/include/asm-ia64/spinlock.h

include/asm-ia64/spinlock.h renamed from include/asm-ia64/spinlock.h:1.1.1.1 +15 -0
diff -u linux24/include/asm-ia64/spinlock.h:1.1.1.1 linux24/include/asm-ia64/spinlock.h:1.1.1.1.22.1
@@ -67,6 +67,8 @@
 
 #else /* !NEW_LOCK */
 
+#define USE_NMCS_LOCK
+#ifndef USE_NMCS_LOCK
 typedef struct {
 	volatile unsigned int lock;
 } spinlock_t;
@@ -99,7 +101,20 @@
 #define spin_unlock(x)		do { barrier(); ((spinlock_t *) x)->lock = 0; } while (0)
 #define spin_trylock(x)		(cmpxchg_acq(&(x)->lock, 0, 1) == 0)
 #define spin_unlock_wait(x)	do { barrier(); } while ((x)->lock)
+#else /*!USE_NMCS_LOCK*/
+#include <linux/mcslock.h>
+#define spinlock_t nmcslock_t
+#define SPIN_LOCK_UNLOCKED NMCS_LOCK_UNLOCKED
 
+#define spin_lock_init(x)	nmcs_lock_init(x)	
+#define spin_is_locked(x)	nmcs_is_locked(x)
+#define spin_unlock_wait(x)	nmcs_unlock_wait(x)
+
+#define spin_lock(x)	nmcs_lock(x)
+#define spin_trylock(x)	nmcs_trylock(x) 
+#define spin_unlock(x)	nmcs_unlock(x) 
+
+#endif
 #endif /* !NEW_LOCK */
 
 typedef struct {