Skip to contentSkip to conversation

m68k/mvme147: Don't unregister boot console needlessly

PATCH Superseded Finn Thain 2 participants 4 messages Mar 27, 2025 – Mar 31, 2025 m68k architecture

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Finn Thain

author
#0 lore raw

PATCH 1/1 m68k/mvme147: Don't unregister boot console needlessly

When MACH_IS_MVME147, the boot console calls mvme147_scc_write() to generate console output. That will continue to work even after debug_cons_nputs() becomes unavailable so there's no need to unregister the boot console.

Cc Daniel Palmer <[email protected]>
Fixes 077b33b9e283 ("m68k: mvme147: Reinstate early console")
---
 arch/m68k/kernel/early_printk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/kernel/early_printk.c +1 -1
index f11ef9f1f56f..2fb22d8395b5 100644
@@ -60,7 +60,7 @@ early_param("earlyprintk", setup_early_printk);
 
 static int __init unregister_early_console(void)
 {
-	if (!early_console || MACH_IS_MVME16x)
+	if (!early_console || MACH_IS_MVME147 || MACH_IS_MVME16x)
 		return 0;
 
 	return unregister_console(early_console);
Signature · 1 line
2.45.3
#1 lore raw

Hi Finn,

Quoted 8 lines · Finn Thain

When MACH_IS_MVME147, the boot console calls mvme147_scc_write() to generate console output. That will continue to work even after debug_cons_nputs() becomes unavailable so there's no need to unregister the boot console.

Cc Daniel Palmer <[email protected]>
Fixes 077b33b9e283 ("m68k: mvme147: Reinstate early console")

Thanks for your patch!

arch/m68k/kernel/early_printk.c early_param("earlyprintk", setup_early_printk); · line 66

Quoted 11 lines
arch/m68k/kernel/early_printk.c +1 -1
@@ -60,7 +60,7 @@ early_param("earlyprintk", setup_early_printk);
 
 static int __init unregister_early_console(void)
 {
-       if (!early_console || MACH_IS_MVME16x)
+       if (!early_console || MACH_IS_MVME147 || MACH_IS_MVME16x)
                return 0;
 
        return unregister_console(early_console);

Perhaps the whole function and the late_initcall() can just be removed?

When the real console kicks in, it usually replaces the early console (unless "keep_bootcon" is specified on the kernel command line, which causes all kernel messages to be printed to both the early and normal console (and thus may cause duplication, if they are the same device)).

Or does that apply only to earlycon early consoles, and not to earlyprintk?

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author
#2 lore raw
Quoted 10 lines · Geert Uytterhoeven
Quoted 10 lines
arch/m68k/kernel/early_printk.c +1 -1
@@ -60,7 +60,7 @@ early_param("earlyprintk", setup_early_printk);
 
 static int __init unregister_early_console(void)
 {
-       if (!early_console || MACH_IS_MVME16x)
+       if (!early_console || MACH_IS_MVME147 || MACH_IS_MVME16x)
                return 0;
 
Quoted 4 lines

arch/m68k/kernel/early_printk.c early_param("earlyprintk", setup_early_printk); · line 66

Quoted 1 line
arch/m68k/kernel/early_printk.c +0 -0
        return unregister_console(early_console);

Perhaps the whole function and the late_initcall() can just be removed?

A comment in arch/m68k/kernel/early_printk.c gives the reason why that code exists: debug_cons_nputs() lives in .init.text. Platforms like MVME which don't use that function to implement earlyprintk don't have to worry about this.

I suppose MACH_IS_FOO is not a great way to encode that requirement. But it don't think it has to be self-documenting. It does have to be consistent with the conditionals in head.S.

#3 lore raw

Hi Finn,

Quoted 16 lines · Finn Thain
Quoted 10 lines · Geert Uytterhoeven
Quoted 10 lines
arch/m68k/kernel/early_printk.c +1 -1
@@ -60,7 +60,7 @@ early_param("earlyprintk", setup_early_printk);
 
 static int __init unregister_early_console(void)
 {
-       if (!early_console || MACH_IS_MVME16x)
+       if (!early_console || MACH_IS_MVME147 || MACH_IS_MVME16x)
                return 0;
 
Quoted 4 lines

arch/m68k/kernel/early_printk.c early_param("earlyprintk", setup_early_printk); · line 66

Quoted 1 line
arch/m68k/kernel/early_printk.c +0 -0
        return unregister_console(early_console);

Perhaps the whole function and the late_initcall() can just be removed?

Quoted 4 lines

A comment in arch/m68k/kernel/early_printk.c gives the reason why that code exists: debug_cons_nputs() lives in .init.text. Platforms like MVME which don't use that function to implement earlyprintk don't have to worry about this.

Thanks, I had forgotten about that...

Quoted 3 lines

I suppose MACH_IS_FOO is not a great way to encode that requirement. But it don't think it has to be self-documenting. It does have to be consistent with the conditionals in head.S.

Alternatively, check if early_console_instance.write() lies within __init_begin..init_end?
That doesn't work with the current setup, as .write() always points to the common debug_cons_write(). But it can be made to work by setting up .write() with the proper function pointer in setup_early_printk(), getting rid of repeated MACH_IS_*() checks in the process.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds