All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] console: prevent registered consoles from dumping old kernel message over again
@ 2011-01-12  6:48 Feng Tang
  2011-01-12 11:14 ` Alan Cox
  2011-01-20  0:11 ` Andrew Morton
  0 siblings, 2 replies; 8+ messages in thread
From: Feng Tang @ 2011-01-12  6:48 UTC (permalink / raw)
  To: linux-kernel, gregkh, alan, akpm; +Cc: Feng Tang

For a platform with many consoles like:
 "console=tty1 console=ttyMFD2 console=ttyS0 earlyprintk=mrst"

Each time when the non "selected_console" (tty1 and ttyMFD2 here) get
registered, the existing kernel message will be printed out on registered
consoles again, the "mrst" early console will get some same message for
3 times, and "tty1" will get some for twice.

So try to temporarily disable registered console's printing when dump the
existing kernel messages to the new console.

Signed-off-by: Feng Tang <feng.tang@intel.com>
---
 kernel/printk.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index f64b899..ba7186b 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1245,6 +1245,7 @@ void register_console(struct console *newcon)
 	int i;
 	unsigned long flags;
 	struct console *bcon = NULL;
+	struct console *con;
 
 	/*
 	 * before we register a new CON_BOOT console, make sure we don't
@@ -1357,8 +1358,20 @@ void register_console(struct console *newcon)
 		spin_lock_irqsave(&logbuf_lock, flags);
 		con_start = log_start;
 		spin_unlock_irqrestore(&logbuf_lock, flags);
+
+		/*
+		 * Disable the existing consoles temporarily to prevent it from
+		 * printing out kernel log again.
+		 */
+		for_each_console(con)
+			if (con != newcon)
+				con->flags &= ~CON_ENABLED;
 	}
 	release_console_sem();
+
+	for_each_console(con)
+		con->flags |= CON_ENABLED;
+
 	console_sysfs_notify();
 
 	/*
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-01-20  2:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-12  6:48 [PATCH] console: prevent registered consoles from dumping old kernel message over again Feng Tang
2011-01-12 11:14 ` Alan Cox
2011-01-12 14:51   ` Feng Tang
2011-01-12 14:50     ` Alan Cox
2011-01-20  0:11 ` Andrew Morton
2011-01-20  1:44   ` Feng Tang
2011-01-20  1:51     ` Andrew Morton
2011-01-20  2:31       ` Feng Tang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.