Skip to contentSkip to conversation

Early printk recent changes.

PATCH New Franck Bui-Huu 3 participants 9 messages Mar 27, 2007 – Mar 28, 2007 MIPS

lore
Share & tools
lore
#0 lore raw

Hi,

I'm wondering how arch/mips/kernel/early_printk.c is supposed to be used.

I've already an early console that needs some setup before registering it. In the current context I can't do that anymore. Of course I can do it once in prom_putchar() but quite frankly I do not see the real point to make this common for all platforms.

Moreover I used to call setup_early_printk() sooner in my prom setup code.

BTW, it seems some '__init' and '__init_data' are missing...

Signature · 1 line
              Franck
#1 lore raw

Hi,

Quoted 8 lines

I'm wondering how arch/mips/kernel/early_printk.c is supposed to be used.

I've already an early console that needs some setup before registering it. In the current context I can't do that anymore. Of course I can do it once in prom_putchar() but quite frankly I do not see the real point to make this common for all platforms.

Moreover I used to call setup_early_printk() sooner in my prom setup code.

I suppose you do not have to use it. I cannot be satisfied with the
implementation for the use by the DECstation either, so I am going to revive the old code as soon as I upgrade my setup. ;-) Feel free to use the old version of arch/mips/dec/prom/console.c as a template.

Don't fix what isn't broken...

Maciej

#2 lore raw
Quoted 3 lines · Maciej W. Rozycki

Don't fix what isn't broken...

Well with such advice, Linux would have been stuck to version 0.4 ;)

Signature · 1 line
              Franck
#3 lore raw
Quoted 4 lines · Franck Bui-Huu
Quoted 2 lines

Don't fix what isn't broken...

Well with such advice, Linux would have been stuck to version 0.4 ;)

Fortunately, there is a feature called "common sense" and it has
prevented a halt from happening. Also I wouldn't be brave enough to claim any particular version of Linux, nor any other piece of software, is perfect, though, admittedly, the level of imperfection varies highly across different versions and pieces.

In this case I gather this was a bulk change and some platforms have
benefited and the DECstation has lost. You seem to have problems as well. These issues can be dealt with somehow and they do not mean the change was bad as a whole.

Maciej

#4 lore raw
Quoted 5 lines · Maciej W. Rozycki
Quoted 3 lines · Franck Bui-Huu
Quoted 2 lines

Don't fix what isn't broken...

Quoted 8 lines
Quoted 1 line

Well with such advice, Linux would have been stuck to version 0.4 ;)

Fortunately, there is a feature called "common sense" and it has
prevented a halt from happening. Also I wouldn't be brave enough to claim any particular version of Linux, nor any other piece of software, is perfect, though, admittedly, the level of imperfection varies highly across different versions and pieces.

you did notice the smiley, didn't you ?

Quoted 4 lines

In this case I gather this was a bulk change and some platforms have
benefited and the DECstation has lost. You seem to have problems as well. These issues can be dealt with somehow and they do not mean the change was bad as a whole.

I think that's the reason why I started this thread: To see if this change is good and really woth...

Making a new file 'early_printk' to gather 3 tiny functions. In the other way we lose the possibilty to register the console earlier, and we need to make some hacks to configure the console if it needs to be.

I understand that such change is needed by x86 arch but for mips I'm skeptical.

Signature · 1 line
              Franck
#5 lore raw
Quoted 8 lines · Franck Bui-Huu
Quoted 4 lines

In this case I gather this was a bulk change and some platforms have benefited and the DECstation has lost. You seem to have problems as well. These issues can be dealt with somehow and they do not mean the change was bad as a whole.

I think that's the reason why I started this thread: To see if this change is good and really woth...

Quoted 6 lines

Making a new file 'early_printk' to gather 3 tiny functions. In the other way we lose the possibilty to register the console earlier, and we need to make some hacks to configure the console if it needs to be.

I understand that such change is needed by x86 arch but for mips I'm skeptical.

I decieded to rush the whole early printk thing since we had several copies of early printk in the MIPS code already. Add plenty of variations of prom_putchar / prom_printf. We certainly now have less loose ends in the code than before. And since we're always in the trade of better mouse trap I certainly won't object if submits has one :-)

Ralf

#6 lore raw
Quoted 3 lines · Ralf Baechle

loose ends in the code than before. And since we're always in the trade of better mouse trap I certainly won't object if submits has one :-)

since you agree to consider them, I'll do that shortly.

Signature · 1 line
              Franck
#7 lore raw

PATCH 1/2 early_printk: use init section

In reply to Ralf Baechle

From: Franck Bui-Huu <[email protected]>

---
 arch/mips/kernel/early_printk.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/mips/kernel/early_printk.c +3 -2
index 304efdc..57ba73a 100644
@@ -12,7 +12,8 @@
 
 extern void prom_putchar(char);
 
-static void early_console_write(struct console *con, const char *s, unsigned n)
+static void __init
+early_console_write(struct console *con, const char *s, unsigned n)
 {
 	while (n-- && *s) {
 		if (*s == '\n')
@@ -22,7 +23,7 @@ static void early_console_write(struct console *con, const char *s, unsigned n)
 	}
 }
 
-static struct console early_console = {
+static struct console early_console __initdata = {
 	.name	= "early",
 	.write	= early_console_write,
 	.flags	= CON_PRINTBUFFER | CON_BOOT,
Signature · 1 line
1.5.1.rc1.27.g1d848
#8 lore raw

PATCH 2/2 early_printk: allow the early console to run earlier

From: Franck Bui-Huu <[email protected]>

---
 arch/mips/kernel/early_printk.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/mips/kernel/early_printk.c +6 -0
index 57ba73a..f68f82f 100644
@@ -30,8 +30,14 @@ static struct console early_console __initdata = {
 	.index	= -1
 };
 
+static int early_console_initialized __initdata;
+
 void __init setup_early_printk(void)
 {
+	if (early_console_initialized)
+		return;
+	early_console_initialized = 1;
+
 	register_console(&early_console);
 }
 
Signature · 1 line
1.5.1.rc1.27.g1d848