[kdb] [PATCH 2] kdb-fixups-lockdep

Joe Korty joe.korty at ccur.com
Mon Oct 12 10:20:23 CDT 2009


Make kdb CONFIG_LOCKDEP friendly.

Use of a serial line console with kdb and lockdep enabled
generates lots of lockdep warnings on kdb/entry edit.

So fix the circular locking dependency between the
kdb_printf and the 8250's port->lock, by suppressing all
use of port->lock by the 8250 serial driver when kdb_printf
is active.

This means that the allowed locking direction is:
	port->lock ---> kdb_printf_lock

Signed-off-by: Joe Korty <joe.korty at ccur.com>

Index: 2.6.31.3-kdb/kdb/kdb_io.c
===================================================================
--- 2.6.31.3-kdb.orig/kdb/kdb_io.c	2009-10-12 11:05:01.000000000 -0400
+++ 2.6.31.3-kdb/kdb/kdb_io.c	2009-10-12 11:06:50.000000000 -0400
@@ -540,6 +540,7 @@
 	} else {
 		__acquire(kdb_printf_lock);
 	}
+	atomic_inc(&kdb_8250);
 
 	diag = kdbgetintenv("LINES", &linecount);
 	if (diag || linecount <= 1)
@@ -774,6 +775,7 @@
 	if (logging) {
 		console_loglevel = saved_loglevel;
 	}
+	atomic_dec(&kdb_8250);
 	if (KDB_STATE(PRINTF_LOCK) && got_printf_lock) {
 		got_printf_lock = 0;
 		spin_unlock_irqrestore(&kdb_printf_lock, flags);



More information about the kdb mailing list