2004-09-10 02:50:09

by Zwane Mwaikambo

[permalink] [raw]
Subject: [PATCH] Fix i386 SPINLOCK_MAGIC debugging

Using a label isn't sufficent anymore for determining the location of the
failed lock. Use __builtin_return_address instead.

Signed-off-by: Zwane Mwaikambo <[email protected]>

--- linux-2.6-bk/include/asm-i386/spinlock.h.orig 2004-09-09 11:16:43.206108976 -0400
+++ linux-2.6-bk/include/asm-i386/spinlock.h 2004-09-09 11:18:18.131678096 -0400
@@ -128,10 +128,8 @@ static inline int _raw_spin_trylock(spin
static inline void _raw_spin_lock(spinlock_t *lock)
{
#ifdef CONFIG_DEBUG_SPINLOCK
- __label__ here;
-here:
if (unlikely(lock->magic != SPINLOCK_MAGIC)) {
- printk("eip: %p\n", &&here);
+ printk("eip: %p\n", __builtin_return_address(0));
BUG();
}
#endif
@@ -143,10 +141,8 @@ here:
static inline void _raw_spin_lock_flags (spinlock_t *lock, unsigned long flags)
{
#ifdef CONFIG_DEBUG_SPINLOCK
- __label__ here;
-here:
if (unlikely(lock->magic != SPINLOCK_MAGIC)) {
- printk("eip: %p\n", &&here);
+ printk("eip: %p\n", __builtin_return_address(0));
BUG();
}
#endif


2004-09-10 03:03:42

by Zwane Mwaikambo

[permalink] [raw]
Subject: [PATCH] Fix x86_64 SPINLOCK_MAGIC debugging

Using a label isn't sufficent anymore for determining the location of the
failed lock. Use __builtin_return_address instead.

Signed-off-by: Zwane Mwaikambo <[email protected]>

--- linux-2.6-bk/include/asm-x86_64/spinlock.h.orig 2004-09-09 22:58:46.389411752 -0400
+++ linux-2.6-bk/include/asm-x86_64/spinlock.h 2004-09-09 23:00:31.513430472 -0400
@@ -113,10 +113,8 @@ static inline int _raw_spin_trylock(spin
static inline void _raw_spin_lock(spinlock_t *lock)
{
#ifdef CONFIG_DEBUG_SPINLOCK
- __label__ here;
-here:
if (lock->magic != SPINLOCK_MAGIC) {
-printk("eip: %p\n", &&here);
+ printk("eip: %p\n", __builtin_return_address(0));
BUG();
}
#endif