[parisc-linux-cvs] linux tausq
Randolph Chung
Randolph Chung <randolph@tausq.org>
Fri, 15 Nov 2002 22:48:49 -0800
> -pa5
> CONFIG_DEBUG_SPINLOCK support
todo: implement debug support for the reader/writer locks too...
Index: Makefile
===================================================================
RCS file: /var/cvs/linux/Makefile,v
retrieving revision 1.364
diff -u -p -r1.364 Makefile
--- Makefile 16 Nov 2002 06:16:52 -0000 1.364
+++ Makefile 16 Nov 2002 06:39:20 -0000
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 20
-EXTRAVERSION = -rc1-pa4
+EXTRAVERSION = -rc1-pa5
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
Index: arch/parisc/config.in
===================================================================
RCS file: /var/cvs/linux/arch/parisc/config.in,v
retrieving revision 1.41
diff -u -p -r1.41 config.in
--- arch/parisc/config.in 13 Nov 2002 15:14:08 -0000 1.41
+++ arch/parisc/config.in 16 Nov 2002 06:39:20 -0000
@@ -194,6 +194,7 @@ comment 'Kernel hacking'
#bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+bool 'Debug spinlocks' CONFIG_DEBUG_SPINLOCK
endmenu
source lib/Config.in
Index: arch/parisc/kernel/parisc_ksyms.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/parisc_ksyms.c,v
retrieving revision 1.41
diff -u -p -r1.41 parisc_ksyms.c
--- arch/parisc/kernel/parisc_ksyms.c 7 Jul 2002 06:23:38 -0000 1.41
+++ arch/parisc/kernel/parisc_ksyms.c 16 Nov 2002 06:39:20 -0000
@@ -232,3 +232,11 @@ extern void $$dyncall(void);
EXPORT_SYMBOL_NOVERS($$dyncall);
#endif
+#include <asm/spinlock.h>
+#ifdef CONFIG_SMP
+#ifdef CONFIG_DEBUG_SPINLOCK
+EXPORT_SYMBOL(spin_lock);
+EXPORT_SYMBOL(spin_unlock);
+EXPORT_SYMBOL(spin_trylock);
+#endif
+#endif
Index: arch/parisc/lib/Makefile
===================================================================
RCS file: /var/cvs/linux/arch/parisc/lib/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- arch/parisc/lib/Makefile 4 Jun 2002 16:09:48 -0000 1.10
+++ arch/parisc/lib/Makefile 16 Nov 2002 06:39:20 -0000
@@ -6,4 +6,6 @@
L_TARGET = lib.a
obj-y := lusercopy.o bitops.o checksum.o io.o memset.o
+obj-$(CONFIG_SMP) += locks.o
+
include $(TOPDIR)/Rules.make
Index: include/asm-parisc/spinlock_t.h
===================================================================
RCS file: /var/cvs/linux/include/asm-parisc/spinlock_t.h,v
retrieving revision 1.1
diff -u -p -r1.1 spinlock_t.h
--- include/asm-parisc/spinlock_t.h 13 Sep 2002 21:43:37 -0000 1.1
+++ include/asm-parisc/spinlock_t.h 16 Nov 2002 06:39:20 -0000
@@ -18,11 +18,15 @@
typedef struct {
volatile unsigned int __attribute__((aligned(16))) lock;
+#ifdef CONFIG_DEBUG_SPINLOCK
+ volatile unsigned long owner_pc;
+ volatile unsigned long owner_cpu;
+#endif
} spinlock_t;
+#ifndef CONFIG_DEBUG_SPINLOCK
#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1 }
-
/* Define 6 spinlock primitives that don't depend on anything else. */
#define spin_lock_init(x) do { (x)->lock = 1; } while(0)
@@ -36,5 +40,20 @@ typedef struct {
while (__ldcw (&(x)->lock) == 0) \
while ((x)->lock == 0) ; \
} while (0)
+
+#else
+
+#define SPIN_LOCK_UNLOCKED (spinlock_t) { 1, 0, 0 }
+
+/* Define 6 spinlock primitives that don't depend on anything else. */
+
+#define spin_lock_init(x) do { (x)->lock = 1; (x)->owner_cpu = 0; (x)->owner_pc = 0; } while(0)
+#define spin_is_locked(x) ((x)->lock == 0)
+void spin_lock(spinlock_t *lock);
+int spin_trylock(spinlock_t *lock);
+void spin_unlock(spinlock_t *lock);
+#define spin_unlock_wait(x) do { barrier(); } while(((volatile spinlock_t *)(x))->lock == 0)
+
+#endif
#endif /* __PARISC_SPINLOCK_T_H */