[RFC][PATCH 6/7] printk: Poke printk extra hard

From: Peter Zijlstra
Date: Wed Dec 21 2011 - 06:18:40 EST



Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
---
include/linux/sched.h | 2 ++
init/main.c | 1 +
kernel/sched/core.c | 18 ++++++++++++++++++
lib/Kconfig.debug | 12 ++++++++++++
4 files changed, 33 insertions(+)
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2742,6 +2742,8 @@ static inline unsigned long rlimit_max(u
return task_rlimit_max(current, limit);
}

+extern void printk_init(void);
+
#endif /* __KERNEL__ */

#endif
--- a/init/main.c
+++ b/init/main.c
@@ -591,6 +591,7 @@ asmlinkage void __init start_kernel(void
initrd_start = 0;
}
#endif
+ printk_init();
page_cgroup_init();
debug_objects_mem_init();
kmemleak_init();
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6953,6 +6953,24 @@ void __init sched_init(void)
scheduler_running = 1;
}

+#ifdef CONFIG_PRINTK_DEBUG
+void printk_init(void)
+{
+ struct rq *rq;
+ unsigned long flags;
+
+ local_irq_save(flags);
+ rq = this_rq();
+ raw_spin_lock(&rq->lock);
+ printk(KERN_DEBUG "printk: echo echo echo..\n");
+ raw_spin_unlock(&rq->lock);
+ local_irq_restore(flags);
+
+}
+#else
+void printk_init(void) { };
+#endif
+
#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
static inline int preempt_count_equals(int preempt_offset)
{
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -644,6 +644,18 @@ config DEBUG_LOCKDEP
additional runtime checks to debug itself, at the price
of more runtime overhead.

+config PRINTK_DEBUG
+ bool "Printk() wakeup debugging"
+ depends on PROVE_LOCKING
+ default n
+ help
+ This feature registers a boot time dependency between rq->lock and
+ printk(), this is useful to determine if your particular console
+ setup issues wakeups while writing to the console. This is interesting
+ to know since those that do are less reliable for debugging purposes.
+
+ Say N if you are unsure.
+
config TRACE_IRQFLAGS
bool
help


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