Prev: [PATCH 3/8] PM: suspend_block: Abort task freezing if a suspend_blocker is active.
Next: [PATCH tip/core/urgent 06/10] sched: Fix an RCU warning in print_task()
From: Randy Dunlap on 30 Apr 2010 18:50 On Sat, 01 May 2010 00:03:00 +0200 Samo Pogacnik wrote: > Hi, > diff --git a_linux-2.6.33.3/drivers/char/Kconfig b_linux-2.6.33.3/drivers/char/Kconfig > index e023682..b5d0909 100644 > --- a_linux-2.6.33.3/drivers/char/Kconfig > +++ b_linux-2.6.33.3/drivers/char/Kconfig > @@ -66,6 +66,23 @@ config VT_CONSOLE > > If unsure, say Y. > > +config VT_CONSOLE_DETOUR > + bool "Support for VT console detour via printk" > + depends on VT_CONSOLE > + default n > + ---help--- > + If you do say Y here, the support for writing console messages via If you say Y here, > + printk is included into VT console code. > + > + The feature is usefull to catch all console log. In order to use this useful log messages. > + feature, you should specify kernel command line option "detour" or write a > + positive number into /proc/sys/kernel/console_detour. You can disable > + the feature on-line by writing zero into the proc file. By writing a > + negative value into the proc file, the feature is disabled permanently > + (until next boot). > + > + If unsure, say N. > + > config HW_CONSOLE > bool > depends on VT && !S390 && !UML > diff --git a_linux-2.6.33.3/drivers/serial/Kconfig b_linux-2.6.33.3/drivers/serial/Kconfig > index 9ff47db..20acfab 100644 > --- a_linux-2.6.33.3/drivers/serial/Kconfig > +++ b_linux-2.6.33.3/drivers/serial/Kconfig > @@ -1031,6 +1031,23 @@ config SERIAL_CORE > config SERIAL_CORE_CONSOLE > bool > > +config SERIAL_CORE_CONSOLE_DETOUR > + bool "Support for serial console detour via printk" > + depends on SERIAL_CORE_CONSOLE > + default n > + ---help--- > + If you do say Y here, the support for writing console messages via If you say Y here, > + printk is included into serial console code. > + > + The feature is usefull to catch all console log. In order to use this useful log messages. > + feature, you should specify kernel command line option "detour" or write a > + positive number into /proc/sys/kernel/console_detour. You can disable > + the feature on-line by writing zero into the proc file. By writing a > + negative value into the proc file, the feature is disabled permanently > + (until next boot). > + > + If unsure, say N. > + The kernel command line option needs to be added to Documentation/kernel-parameters.txt also, please. > config CONSOLE_POLL > bool > > diff --git a_linux-2.6.33.3/include/linux/console.h b_linux-2.6.33.3/include/linux/console.h > index dcca533..bc88030 100644 > --- a_linux-2.6.33.3/include/linux/console.h > +++ b_linux-2.6.33.3/include/linux/console.h > @@ -108,6 +108,12 @@ struct console { > struct console *next; > }; > > +extern int console_detour; > +extern void console_printk_detour(const unsigned char *, int); Please include parameter names in function prototype(s). > + > +struct ctl_table; > +int detour_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); ditto > + > extern int console_set_on_cmdline; > > extern int add_preferred_console(char *name, int idx, char *options); Looks interesting/useful to me. Thanks. --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Samo Pogacnik on 1 May 2010 04:40 Dne 30.04.2010 (pet) ob 15:45 -0700 je Randy Dunlap zapisal(a): > On Sat, 01 May 2010 00:03:00 +0200 Samo Pogacnik wrote: > > > Hi, > > > diff --git a_linux-2.6.33.3/drivers/char/Kconfig b_linux-2.6.33.3/drivers/char/Kconfig > > index e023682..b5d0909 100644 > > --- a_linux-2.6.33.3/drivers/char/Kconfig > > +++ b_linux-2.6.33.3/drivers/char/Kconfig > > @@ -66,6 +66,23 @@ config VT_CONSOLE > > > > If unsure, say Y. > > > > +config VT_CONSOLE_DETOUR > > + bool "Support for VT console detour via printk" > > + depends on VT_CONSOLE > > + default n > > + ---help--- > > + If you do say Y here, the support for writing console messages via > > If you say Y here, > > > + printk is included into VT console code. > > + > > + The feature is usefull to catch all console log. In order to use this > > useful log messages. > > > + feature, you should specify kernel command line option "detour" or write a > > + positive number into /proc/sys/kernel/console_detour. You can disable > > + the feature on-line by writing zero into the proc file. By writing a > > + negative value into the proc file, the feature is disabled permanently > > + (until next boot). > > + > > + If unsure, say N. > > + > > config HW_CONSOLE > > bool > > depends on VT && !S390 && !UML > > > diff --git a_linux-2.6.33.3/drivers/serial/Kconfig b_linux-2.6.33.3/drivers/serial/Kconfig > > index 9ff47db..20acfab 100644 > > --- a_linux-2.6.33.3/drivers/serial/Kconfig > > +++ b_linux-2.6.33.3/drivers/serial/Kconfig > > @@ -1031,6 +1031,23 @@ config SERIAL_CORE > > config SERIAL_CORE_CONSOLE > > bool > > > > +config SERIAL_CORE_CONSOLE_DETOUR > > + bool "Support for serial console detour via printk" > > + depends on SERIAL_CORE_CONSOLE > > + default n > > + ---help--- > > + If you do say Y here, the support for writing console messages via > > If you say Y here, > > > + printk is included into serial console code. > > + > > + The feature is usefull to catch all console log. In order to use this > > useful log messages. > > > + feature, you should specify kernel command line option "detour" or write a > > + positive number into /proc/sys/kernel/console_detour. You can disable > > + the feature on-line by writing zero into the proc file. By writing a > > + negative value into the proc file, the feature is disabled permanently > > + (until next boot). > > + > > + If unsure, say N. > > + > > The kernel command line option needs to be added to Documentation/kernel-parameters.txt > also, please. > > > config CONSOLE_POLL > > bool > > > > diff --git a_linux-2.6.33.3/include/linux/console.h b_linux-2.6.33.3/include/linux/console.h > > index dcca533..bc88030 100644 > > --- a_linux-2.6.33.3/include/linux/console.h > > +++ b_linux-2.6.33.3/include/linux/console.h > > @@ -108,6 +108,12 @@ struct console { > > struct console *next; > > }; > > > > +extern int console_detour; > > +extern void console_printk_detour(const unsigned char *, int); > > Please include parameter names in function prototype(s). > > > + > > +struct ctl_table; > > +int detour_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *); > > ditto > > > + > > extern int console_set_on_cmdline; > > > > extern int add_preferred_console(char *name, int idx, char *options); > > > Looks interesting/useful to me. Thanks. > > --- > ~Randy > *** Remember to use Documentation/SubmitChecklist when testing your code *** Good morning, Thank you for the corrections and hints. i'll catchup with an update as soon as i can. regards, Samo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Geert Uytterhoeven on 1 May 2010 05:10 On Sat, May 1, 2010 at 00:03, Samo Pogacnik <samo_pogacnik(a)t-2.net> wrote: > while i was searching for effective logging of complete console output > produced by the kernel and user phase of the boot process, it turned out > that only kernel messages imho get systematically cached and stored into > log files (if needed). All userspace processes are on their own to use > syslog, which is fine, but there are also many console messages > reporting the boot status via init scripts, .... I came across the > bootlogd daemo, which handles the job of redirecting console output into > a log file, but i find it problematic to use especialy, when using > initial ram disk image. > > So in short i came up with an idea to transform console writes into > printks at appropriate code place of some console drivers (the patch > includes code for VT console and SERIAL_CORE console drivers). Printks > eventually reach console device avoiding the patched part of the console > drivers. What about catching /dev/console instead of VT console, SERIAL_CORE console, ...? Then it works with whatever console= parameter you specify. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert(a)linux-m68k.org 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Alan Cox on 1 May 2010 07:00 > while i was searching for effective logging of complete console output > produced by the kernel and user phase of the boot process, it turned out > that only kernel messages imho get systematically cached and stored into > log files (if needed). All userspace processes are on their own to use > syslog, which is fine, but there are also many console messages > reporting the boot status via init scripts, .... I came across the > bootlogd daemo, which handles the job of redirecting console output into > a log file, but i find it problematic to use especialy, when using > initial ram disk image. So you want to patch the kernel because you can't work out how to do this in userspace ? The distributions seem to have no problem doing this in user space that I can see. It doesn't seem to be a hard user space problem, and there are a ton of things you want to do with this sort of stuff (like network logging) that you can't do in kernel space. > --- a_linux-2.6.33.3/drivers/char/vt.c > +++ b_linux-2.6.33.3/drivers/char/vt.c > @@ -2696,6 +2696,16 @@ static int con_write(struct tty_struct *tty, const unsigned char *buf, int count > { > int retval; > > +#ifdef CONFIG_VT_CONSOLE_DETOUR > + if (console_detour) { > + int idx = vt_console_driver.index - 1; > + > + if ((idx >= 0) && (idx == tty->index)) { > + console_printk_detour(buf, count); > + return count; > + } > + } > +#endif This requires you go around hacking up each device which is not a good idea and becomes rapidly unmaintainable. I suspect what you actually need for such logging might be to write a very simple tty driver whose write method is implemented as printk. That works in the general case and doesn't require hacking up the code everywhere else. However given your init stuff can trivially use openpty to set up a logged console I am not sure I see the point in doing this in kernel in the first place. Alan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Samo Pogacnik on 1 May 2010 12:40
Dne 01.05.2010 (sob) ob 11:00 +0200 je Geert Uytterhoeven zapisal(a): > On Sat, May 1, 2010 at 00:03, Samo Pogacnik <samo_pogacnik(a)t-2.net> wrote: > > while i was searching for effective logging of complete console output > > produced by the kernel and user phase of the boot process, it turned out > > that only kernel messages imho get systematically cached and stored into > > log files (if needed). All userspace processes are on their own to use > > syslog, which is fine, but there are also many console messages > > reporting the boot status via init scripts, .... I came across the > > bootlogd daemo, which handles the job of redirecting console output into > > a log file, but i find it problematic to use especialy, when using > > initial ram disk image. > > > > So in short i came up with an idea to transform console writes into > > printks at appropriate code place of some console drivers (the patch > > includes code for VT console and SERIAL_CORE console drivers). Printks > > eventually reach console device avoiding the patched part of the console > > drivers. > > What about catching /dev/console instead of VT console, SERIAL_CORE > console, ...? > Then it works with whatever console= parameter you specify. Could not agree more, but that was as close as i was able to detect the common code and provide something that actually works. Maybe this is already enough to cover all boot consoles? > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert(a)linux-m68k.org > > 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 regards, Samo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |