public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: linux-arch@vger.kernel.org
Subject: Re: [RFC][PATCH 3/3] Convert console list to list_head
Date: Mon, 14 Jun 2004 15:02:04 +0100	[thread overview]
Message-ID: <20040614140204.GC20511@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <20040614134623.E14403@flint.arm.linux.org.uk>

On Mon, Jun 14, 2004 at 01:46:23PM +0100, Russell King wrote:
> arch/parisc/kernel/pdc_cons.c:  while ((console = console_drivers) != NULL)
> arch/parisc/kernel/pdc_cons.c:          unregister_console(console_drivers);
> arch/parisc/kernel/traps.c:     if (!console_drivers)
> arch/parisc/kernel/traps.c:     if (!console_drivers)
> 
>   PARISC seems to like to unregister all consoles, and then re-
>   registers its own console driver.  IOW, it assumes it can safely
>   override the state of the console subsystem independent of whatever
>   drivers may be registered.

This gets into one of the ugliest bits of the parisc patch that I haven't
figured out how to do cleanly yet.  We have a firmware console (called
PDC console) that may be printing to screen or serial.  The device
that's being addressed might be on a PCI bus, so we can't print to it
while we're walking the PCI busses.  We also can't use it after boot, or
it'll fight with the serial driver.  So we have the following patch in our
tree:

diff -urN --exclude-from=/tmp/dont19263.10184 ../.#prev/linux-2.6/include/linux/console.h linux-2.6/include/linux/console.h
--- ../.#prev/linux-2.6/include/linux/console.h	Sun May 23 18:03:34 2004
+++ linux-2.6/include/linux/console.h	Sun May 23 18:00:46 2004
@@ -80,6 +80,7 @@
 #define CON_PRINTBUFFER	(1)
 #define CON_CONSDEV	(2) /* Last on the command line */
 #define CON_ENABLED	(4)
+#define CON_BOOT	(8)
 
 struct console
 {
diff -urN --exclude-from=/tmp/dont19263.10184 ../.#prev/linux-2.6/kernel/printk.c linux-2.6/kernel/printk.c
--- ../.#prev/linux-2.6/kernel/printk.c	Sun May 23 18:03:36 2004
+++ linux-2.6/kernel/printk.c	Mon May 10 09:40:38 2004
@@ -91,8 +91,8 @@
  * must be masked before subscripting
  */
 static unsigned long log_start;	/* Index into log_buf: next char to be read by syslog() */
-static unsigned long con_start;	/* Index into log_buf: next char to be sent to consoles */
-static unsigned long log_end;	/* Index into log_buf: most-recently-written-char + 1 */
+unsigned long con_start;	/* Index into log_buf: next char to be sent to consoles */
+unsigned long log_end;	/* Index into log_buf: most-recently-written-char + 1 */
 static unsigned long logged_chars; /* Number of chars produced since last read+clear operation */
 
 /*
@@ -716,6 +716,11 @@
 
 	if (!(console->flags & CON_ENABLED))
 		return;
+
+	if (console_drivers && (console_drivers->flags & CON_BOOT)) {
+		unregister_console(console_drivers);
+		console->flags &= ~CON_PRINTBUFFER;
+	}
 
 	/*
 	 *	Put this console in the list - keep the

ie we can add a console flagged as CON_BOOT.  When the next console is
added, it deletes the one flagged as CON_BOOT and doesn't print the buffer
(on the grounds we've already seen it).

The piece of code you've stumbled across is in pdc_console_restart().
This is only called in an emergency -- the machine is going down, and
we want to try our absolute hardest to get the panic message to the
user's console.

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

  reply	other threads:[~2004-06-14 14:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-14 12:45 [PATCH 1/3] Provide console_device() Russell King
2004-06-14 12:45 ` [PATCH 1/3] Provide console_suspend() and console_resume() Russell King
2004-06-14 12:46   ` [RFC][PATCH 3/3] Convert console list to list_head Russell King
2004-06-14 14:02     ` Matthew Wilcox [this message]
2004-06-15  0:20       ` David S. Miller
2004-06-14 17:46     ` David Mosberger

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=20040614140204.GC20511@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=linux-arch@vger.kernel.org \
    /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