mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	"Ted Ts'o" <tytso@mit.edu>, Greg KH <greg@kroah.com>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	akpm@linux-foundation.org
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [RFC][PATCH 6/7] printk: Poke printk extra hard
Date: Wed, 21 Dec 2011 11:57:45 +0100	[thread overview]
Message-ID: <20111221111143.620776435@chello.nl> (raw)
In-Reply-To: <20111221105739.798864333@chello.nl>

[-- Attachment #1: printk-debug.patch --]
[-- Type: text/plain, Size: 1902 bytes --]


Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
 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



  parent reply	other threads:[~2011-12-21 11:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 10:57 [RFC][PATCH 0/7] improve printk reliability Peter Zijlstra
2011-12-21 10:57 ` [RFC][PATCH 1/7] arch, early_printk: Consolidate early_printk() implementations Peter Zijlstra
2011-12-21 17:01   ` Mike Frysinger
2011-12-21 17:03   ` Peter Zijlstra
2011-12-21 19:23   ` David Miller
2011-12-21 10:57 ` [RFC][PATCH 2/7] lockdep: Provide early_printk() support Peter Zijlstra
2011-12-21 10:57 ` [RFC][PATCH 3/7] printk, lockdep: Remove lockdep_off() usage Peter Zijlstra
2011-12-21 10:57 ` [RFC][PATCH 4/7] printk: Rework printk recursion Peter Zijlstra
2011-12-21 10:57 ` [RFC][PATCH 5/7] semaphore: Pull wakeup out from under sem->lock Peter Zijlstra
2011-12-21 10:57 ` Peter Zijlstra [this message]
2011-12-22  1:17   ` [RFC][PATCH 6/7] printk: Poke printk extra hard Linus Torvalds
2011-12-22  7:02     ` Ingo Molnar
2011-12-22  8:43       ` Peter Zijlstra
2011-12-22  9:03         ` Ingo Molnar
2011-12-22  9:14           ` Peter Zijlstra
2011-12-22 10:15             ` Ingo Molnar
2011-12-22 10:19               ` Peter Zijlstra
2011-12-21 10:57 ` [RFC][PATCH 7/7] serial, 8250: Mostly avoid wakeups from under port->lock Peter Zijlstra
2011-12-21 16:03   ` Alan Cox
2011-12-21 16:22     ` Peter Zijlstra
2011-12-21 16:30       ` Peter Zijlstra
2011-12-21 18:51       ` Alan Cox
2011-12-21 11:23 ` [RFC][PATCH 0/7] improve printk reliability Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111221111143.620776435@chello.nl \
    --to=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome