public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [PATCH] early console registration
Date: Mon, 14 Jun 2004 22:27:21 +0000	[thread overview]
Message-ID: <200406141627.21540.bjorn.helgaas@hp.com> (raw)
In-Reply-To: <200405141425.59867.jbarnes@engr.sgi.com>

On Thursday 03 June 2004 3:49 pm, Jesse Barnes wrote:
> Allow consoles to be registered early if they support doing output very early 
> in the boot process.  Consoles that allow this are subject to the limitations 
> outlined in the comments for the early_console_setup routine.

(See original mail with patch here:
    http://www.gelato.unsw.edu.au/linux-ia64/0406/9894.html)

I'm still a little uneasy about setting cpu_online for CPU 0 so early.
What if somebody comes along in the future and assumes the original
semantics for cpu_online(0)?

As another possibility, the following is a little more intrusive to
printk.c, but also a little more explicit about what we're doing
(untested).

=== drivers/char/sn_serial.c 1.14 vs edited ==--- 1.14/drivers/char/sn_serial.c	2004-05-11 09:25:13 -06:00
+++ edited/drivers/char/sn_serial.c	2004-06-14 16:24:05 -06:00
@@ -1007,6 +1007,7 @@
 
 static struct console sal_console = {
 	.name = "ttyS",
+	.flags = CON_EARLY,
 	.write = sn_sal_console_write,
 	.device = sn_sal_console_device,
 	.setup = sn_sal_console_setup,
=== include/linux/console.h 1.13 vs edited ==--- 1.13/include/linux/console.h	2004-05-14 20:00:12 -06:00
+++ edited/include/linux/console.h	2004-06-14 12:42:16 -06:00
@@ -80,6 +80,7 @@
 #define CON_PRINTBUFFER	(1)
 #define CON_CONSDEV	(2) /* Last on the command line */
 #define CON_ENABLED	(4)
+#define CON_EARLY	(8) /* Works before CPU is online */
 
 struct console
 {
=== kernel/printk.c 1.38 vs edited ==--- 1.38/kernel/printk.c	2004-05-25 03:53:03 -06:00
+++ edited/kernel/printk.c	2004-06-14 16:12:17 -06:00
@@ -113,6 +113,9 @@
 /* Flag: console code may call schedule() */
 static int console_may_schedule;
 
+/* Early consoles work before CPU is online */
+static int early_console_registered;
+
 /*
  *	Setup a list of consoles. Called from init/main.c
  */
@@ -384,7 +387,8 @@
 	struct console *con;
 
 	for (con = console_drivers; con; con = con->next) {
-		if ((con->flags & CON_ENABLED) && con->write)
+		if ((con->flags & CON_ENABLED) && con->write &&
+		    (cpu_online(smp_processor_id()) || con->flags & CON_EARLY))
 			con->write(con, &LOG_BUF(start), end - start);
 	}
 }
@@ -544,7 +548,8 @@
 	}
 
 	if (!cpu_online(smp_processor_id()) &&
-	    system_state != SYSTEM_RUNNING) {
+	    system_state != SYSTEM_RUNNING &&
+	    !early_console_registered) {
 		/*
 		 * Some console drivers may assume that per-cpu resources have
 		 * been allocated.  So don't allow them to be called by this
@@ -733,6 +738,8 @@
 
 	if (!(console->flags & CON_ENABLED))
 		return;
+
+	early_console_registered |= console->flags & CON_EARLY;
 
 	/*
 	 *	Put this console in the list - keep the

  parent reply	other threads:[~2004-06-14 22:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-14 21:25 [PATCH] early console registration Jesse Barnes
2004-05-20  1:17 ` David Mosberger
2004-05-20 13:03 ` Jesse Barnes
2004-05-20 15:18 ` Bjorn Helgaas
2004-05-20 15:26 ` Jesse Barnes
2004-06-03 21:49 ` Jesse Barnes
2004-06-14 22:27 ` Bjorn Helgaas [this message]
2004-06-15 13:12 ` Jesse Barnes
2004-06-16 20:22 ` Bjorn Helgaas
2004-06-16 20:40 ` Jesse Barnes
2004-06-22 17:54 ` Jesse Barnes

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=200406141627.21540.bjorn.helgaas@hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=linux-ia64@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