lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1314967293.1301.13.camel@twins>
Date:	Fri, 02 Sep 2011 14:41:33 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>
Subject: [RFC][PATCH -rt] spinlock: frob debug bits

Not sure this is actually worth it, but since I wrote it I thought I
might as well send it out. Didn't actually need it. Once I frobbed the
printk stuff to work again there were plenty error to point out what
gone wrong.

---
Subject: spinlock: frob debug bits
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Date: Fri Sep 02 14:29:30 CEST 2011

gets more debug on a spinlock lockup, but also destroys all lock
debugging.. you win some, you loose some..

Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Link: http://lkml.kernel.org/n/tip-3h4nzmhbik02u9xp9logjrv4@git.kernel.org
---
 lib/spinlock_debug.c |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

Index: linux-2.6/lib/spinlock_debug.c
===================================================================
--- linux-2.6.orig/lib/spinlock_debug.c
+++ linux-2.6/lib/spinlock_debug.c
@@ -54,7 +54,7 @@ static void spin_bug(raw_spinlock_t *loc
 {
 	struct task_struct *owner = NULL;
 
-	if (!debug_locks_off())
+	if (unlikely(!debug_locks))
 		return;
 
 	if (lock->owner && lock->owner != SPINLOCK_OWNER_INIT)
@@ -69,6 +69,11 @@ static void spin_bug(raw_spinlock_t *loc
 		owner ? task_pid_nr(owner) : -1,
 		lock->owner_cpu);
 	dump_stack();
+	debug_show_all_locks();
+#ifdef CONFIG_SMP
+	trigger_all_cpu_backtrace();
+#endif
+	debug_locks_off();
 }
 
 #define SPIN_BUG_ON(cond, lock, msg) if (unlikely(cond)) spin_bug(lock, msg)
@@ -112,17 +117,7 @@ static void __spin_lock_debug(raw_spinlo
 			__delay(1);
 		}
 		/* lockup suspected: */
-		if (print_once) {
-			print_once = 0;
-			printk(KERN_EMERG "BUG: spinlock lockup on CPU#%d, "
-					"%s/%d, %p\n",
-				raw_smp_processor_id(), current->comm,
-				task_pid_nr(current), lock);
-			dump_stack();
-#ifdef CONFIG_SMP
-			trigger_all_cpu_backtrace();
-#endif
-		}
+		SPIN_BUG_ON(1, lock, "timeout");
 	}
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ