Skip to contentSkip to conversation

UP spinlock debugging

PATCH New Manfred Spraul 1 participant 1 message Sep 30, 2001 Locking primitives

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 UP spinlock debugging

Hi Linus,

the attached patch adds support for spinlock debugging with uniprocessor kernels:

* new config option CONFIG_DEBUG_SPINLOCK_UP
* CONFIG_DEBUG_SPINLOCK only works on SMP, SMP added to config string
* support for directly including <asm/spinlock.h> removed from <linux/spinlock.h>
Doesn't work anyway, probably the '!defined(spin_lock_init)' was overlooked.
* DEBUG_SPINLOCKS==2 macros indented
* spin_lock saves the current owner into the spinlock structure, file name+line printed on deadlock.
* stricter spin_trylock and spin_is_locked.

Patch against 2.4.10, tested with 2.4.10 i386

Could you apply it to the next -pre kernel?

--
Manfred
<<<<<<<<<<<<<<
// Kernel Version:

//  VERSION = 2
//  PATCHLEVEL = 4
//  SUBLEVEL = 10
//  EXTRAVERSION =
arch/i386/config.in +6 -1
@@ -396,7 +396,12 @@
    bool '  Debug memory allocations' CONFIG_DEBUG_SLAB
    bool '  Memory mapped I/O debugging' CONFIG_DEBUG_IOVIRT
    bool '  Magic SysRq key' CONFIG_MAGIC_SYSRQ
-   bool '  Spinlock debugging' CONFIG_DEBUG_SPINLOCK
+   if [ "$CONFIG_SMP" = "y" ]; then
+      bool '  Spinlock debugging (SMP)' CONFIG_DEBUG_SPINLOCK
+   fi
+   if [ "$CONFIG_SMP" = "n" ]; then
+      bool '  Spinlock debugging (UP)' CONFIG_DEBUG_SPINLOCK_UP
+   fi
    bool '  Verbose BUG() reporting (adds 70K)' CONFIG_DEBUG_BUGVERBOSE
 fi
 
include/linux/spinlock.h +77 -13

107 lines not on this page · raw message

kernel/ksyms.c +3 -1
@@ -376,10 +376,12 @@
 EXPORT_SYMBOL(tq_timer);
 EXPORT_SYMBOL(tq_immediate);
 
-#ifdef CONFIG_SMP
+#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK_UP)
 /* Various random spinlocks we want to export */
 EXPORT_SYMBOL(tqueue_lock);
+#endif
 
+#ifdef CONFIG_SMP
 /* Big-Reader lock implementation */
 EXPORT_SYMBOL(__brlock_array);
 #ifndef __BRLOCK_USE_ATOMICS