Re: [RFC v2] kernel/printk.c - handling more than one CON_BOOT

From: Andrew Morton
Date: Wed Jul 01 2009 - 15:46:04 EST


On Tue, 30 Jun 2009 22:51:52 -0400
Robin Getz <rgetz@xxxxxxxxxxxxxxxxxxxx> wrote:

> From: Robin Getz <rgetz@xxxxxxxxxxxxxxxxxxxx>
>
> Today, register_console() assumes the following usage:
> - The first console to register with a flag set to CON_BOOT is the
> one and only bootconsole.
> - If another register_console() is called with an additional CON_BOOT,
> it is silently rejected.
> - As soon as a console without the CON_BOOT set calls registers
> the bootconsole is automatically unregistered.
> - Once there is a "real" console - register_console() will silently
> reject any consoles with it's CON_BOOT flag set.

hm. I never knew all that. Thanks for taking the time to explain all
this - it helps.

I think it would be useful if we had a description of the new design,
similar to your description of the "Today" behaviour above. Perhaps
as a comment over register_console()?

> In many systems (alpha, blackfin, microblaze, mips, powerpc, sh, & x86), there
> are early_printk implementations, which use the CON_BOOT which come out
> serial ports, vga, usb, & memory buffers. In many embedded systems, it would
> be nice to have two - in case the primary fails, you always have access to a
> backup memory buffer - but this requires at least two CON_BOOT consoles.
>
> This changeset allows multiple boot consoles, and changes the functionality
> to, be mostly the same as the above.
> - Any number CON_BOOT consoles of can be registered
> - A "real" console will unregister all the CON_BOOT consoles
> - Once a "real" console is registered, no more CON_BOOT consoles
> can be added (still silently rejected)

Is the "silent" rejection desirable? Perhaps that's a
programming/configuration error which the developer should be informed
of?


> diff -puN kernel/printk.c~kernel-printkc-handling-more-than-one-con_boot kernel/printk.c
> --- a/kernel/printk.c~kernel-printkc-handling-more-than-one-con_boot
> +++ a/kernel/printk.c
> @@ -37,6 +37,12 @@
> #include <asm/uaccess.h>
>
> /*
> + * for_each_console() allows you to iterate on each console
> + */
> +#define for_each_console(con) \
> + for (con = console_drivers; con != NULL; con = con->next)

hum. Fair enough.


The patch looks good to me.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/