introduce boot_printk()
PATCH 1/1 introduce boot_printk()
could be enabled via "boot=verbose" to get more debug info
will use it to convert some printk(KERN_DEBUG ...)
--- include/linux/kernel.h | 19 +++++++++++++++++++ kernel/printk.c | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+)
include/linux/kernel.h +19 -0
@@ -344,6 +344,25 @@ static inline char *pack_hex_byte(char *#endif /* +* Debugging macros +*/ +#define BOOT_QUIET 0 +#define BOOT_VERBOSE 1 +#define BOOT_SPEW 2 + +extern int boot_verbosity; +/* +* Define the default level of output to be very little +* This can be turned up by using boot=verbose for more +* information and boot=spew for _lots_ of information. +* boot_verbosity is defined in printk.c +*/ +#define boot_printk(v, s, a...) do { \ + if ((v) <= boot_verbosity) \ + printk(s, ##a); \ + } while (0) + +/* * Display an IP address in readable format. */
kernel/printk.c +21 -0
@@ -604,6 +604,27 @@ asmlinkage int printk(const char *fmt, .return r; } +int boot_verbosity; + +static int __init boot_set_verbosity (char *arg) +{ +if (!arg) +return -EINVAL ; + +if (strcmp ("spew" , arg) ==0 ) + boot_verbosity =BOOT_SPEW ; +else if (strcmp ("verbose" , arg) ==0 ) + boot_verbosity =BOOT_VERBOSE ; +else { +printk (KERN_WARNING "boot Verbosity level %s not recognised" +" use boot=verbose or boot=spew\n" , arg); +return -EINVAL ; + } + +return 0 ; +} +early_param ("boot" , boot_set_verbosity); +/* cpu currently holding logbuf_lock */ static volatile unsigned int printk_cpu =UINT_MAX ;
Quoted 5 lines · Yinghai Lu
could be enabled via "boot=verbose" to get more debug info
will use it to convert some
printk(KERN_DEBUG ...)Signed-off-by Yinghai Lu <[email protected]>
boot= is a bit too generic name, I guess...
Pavel
Quoted 72 lines
--- include/linux/kernel.h | 19 +++++++++++++++++++ kernel/printk.c | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+)Index:
linux-2.6/include/linux/kernel.h
===================================================================include/linux/kernel.h +19
-0@@ -344,6 +344,25 @@ static inline char *pack_hex_byte(char *#endif /* +* Debugging macros +*/ +#define BOOT_QUIET 0 +#define BOOT_VERBOSE 1 +#define BOOT_SPEW 2 + +extern int boot_verbosity; +/* +* Define the default level of output to be very little +* This can be turned up by using boot=verbose for more +* information and boot=spew for _lots_ of information. +* boot_verbosity is defined in printk.c +*/ +#define boot_printk(v, s, a...) do { \ + if ((v) <= boot_verbosity) \ + printk(s, ##a); \ + } while (0) + +/* * Display an IP address in readable format. */ Index:
linux-2.6/kernel/printk.c
===================================================================kernel/printk.c +21
-1@@ -604,6 +604,27 @@ asmlinkage int printk(const char *fmt, .return r; } +int boot_verbosity; + +static int __init boot_set_verbosity (char *arg) +{ +if (!arg) +return -EINVAL ; + +if (strcmp ("spew" , arg) ==0 ) + boot_verbosity =BOOT_SPEW ; +else if (strcmp ("verbose" , arg) ==0 ) + boot_verbosity =BOOT_VERBOSE ; +else { +printk (KERN_WARNING "boot Verbosity level %s not recognised" +" use boot=verbose or boot=spew\n" , arg); +return -EINVAL ; + } + +return 0 ; +} +early_param ("boot" , boot_set_verbosity); +/* cpu currently holding logbuf_lock */ static volatile unsigned int printk_cpu =UINT_MAX ; --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 8 lines · Pavel Machek
Quoted 5 lines · Yinghai Lu
could be enabled via "boot=verbose" to get more debug info
will use it to convert some
printk(KERN_DEBUG ...)Signed-off-by Yinghai Lu <[email protected]>boot= is a bit too generic name, I guess...
Ingo suggest to use x86=verbose
but some users are in driver/acpi etc
YH
Quoted 52 lines · On Mon, 15 Sep 2008 01:05:16 -0700 Yinghai Lu wrote:
could be enabled via "boot=verbose" to get more debug info
will use it to convert some
printk(KERN_DEBUG ...)Signed-off-by Yinghai Lu <[email protected]>--- include/linux/kernel.h | 19 +++++++++++++++++++ kernel/printk.c | 21 +++++++++++++++++++++ 2 files changed, 40 insertions(+)Index:
linux-2.6/include/linux/kernel.h
===================================================================include/linux/kernel.h +19
-0@@ -344,6 +344,25 @@ static inline char *pack_hex_byte(char *#endif /* +* Debugging macros +*/ +#define BOOT_QUIET 0 +#define BOOT_VERBOSE 1 +#define BOOT_SPEW 2 + +extern int boot_verbosity; +/* +* Define the default level of output to be very little +* This can be turned up by using boot=verbose for more +* information and boot=spew for _lots_ of information. +* boot_verbosity is defined in printk.c +*/ +#define boot_printk(v, s, a...) do { \ + if ((v) <= boot_verbosity) \ + printk(s, ##a); \ + } while (0) + +/* * Display an IP address in readable format. */ Index:
linux-2.6/kernel/printk.c
===================================================================kernel/printk.c +3
-0@@ -604,6 +604,27 @@ asmlinkage int printk(const char *fmt, .return r; } +int boot_verbosity; + +static int __init boot_set_verbosity (char *arg)
kernel/printk.c asmlinkage int printk(const char *fmt, . · line 619
Quoted 10 lines
kernel/printk.c +10
-0+{ +if (!arg) +return -EINVAL ; + +if (strcmp ("spew" , arg) ==0 ) + boot_verbosity =BOOT_SPEW ; +else if (strcmp ("verbose" , arg) ==0 ) + boot_verbosity =BOOT_VERBOSE ; +else { + printk(KERN_WARNING "boot Verbosity level %s not recognised"
ised; "
and please add an entry to Documentation/kernel-parameters.txt for this.
kernel/printk.c asmlinkage int printk(const char *fmt, . · line 629
Quoted 10 lines
kernel/printk.c +8
-0+ " use boot=verbose or boot=spew\n", arg); +return -EINVAL ; + } + +return 0 ; +} +early_param ("boot" , boot_set_verbosity); +/* cpu currently holding logbuf_lock */ static volatile unsigned int printk_cpu =UINT_MAX ;
---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
Quoted 3 lines · Yinghai Lu
could be enabled via "boot=verbose" to get more debug info
will use it to convert some
printk(KERN_DEBUG ...)
This seems odd, why not just use KERN_DEBUG?
-hpa
Quoted 8 lines · H. Peter Anvin
Quoted 4 lines · Yinghai Lu
could be enabled via "boot=verbose" to get more debug info
will use it to convert some
printk(KERN_DEBUG ...)This seems odd, why not just use
KERN_DEBUG?
some guys complained that it is even too verbose with KERN_DEBUG
YH
Quoted 3 lines · Yinghai Lu
some guys complained that it is even too verbose with
KERN_DEBUG
I can understand the desire to enable filtering on a subsystem-by-subsystem basis, but I think rather than doing a subsystem-specific hack we should do something that any subsystem can use.
Perhaps we could extend the current <level> hack to include a subsystem, something like:
<7><x86>Your blort driver seems to be befudged, trying blarfing.
... and something like "loglevel=x86:7,acpi:3,..."
-hpa
Quoted 9 lines · H. Peter Anvin
Quoted 3 lines · Yinghai Lu
some guys complained that it is even too verbose with
KERN_DEBUGI can understand the desire to enable filtering on a subsystem-by-subsystem basis, but I think rather than doing a subsystem-specific hack we should do something that any subsystem can use.
Quoted 7 lines
Perhaps we could extend the current <level> hack to include a subsystem, something like:
<7><x86>Your blort driver seems to be befudged, trying blarfing.
... and something like "loglevel=x86:7,acpi:3,..."
sounds good.
every subsystem will havex86_printkacpi_printkpci_printk
YH
Quoted 15 lines · Yinghai Lu
Quoted 14 lines · H. Peter Anvin
Quoted 3 lines · Yinghai Lu
some guys complained that it is even too verbose with
KERN_DEBUGI can understand the desire to enable filtering on a subsystem-by-subsystem basis, but I think rather than doing a subsystem-specific hack we should do something that any subsystem can use.
Perhaps we could extend the current <level> hack to include a subsystem, something like:
<7><x86>Your blort driver seems to be befudged, trying blarfing.
Quoted 8 lines
Quoted 2 lines
... and something like "loglevel=x86:7,acpi:3,..."
sounds good.
every subsystem will have
x86_printkacpi_printkpci_printk
doesn't sound like an easily extensible interface, better would be extending printk with a KERN_subsys tag like proposed.
Perhaps Jason has better ideas - iirc he worked on something similar.
Quoted 9 lines · Peter Zijlstra
Quoted 5 lines
every subsystem will have
x86_printkacpi_printkpci_printkdoesn't sound like an easily extensible interface, better would be extending printk with a
KERN_subsystag like proposed.
That would be my thinking too.
-hpa
Quoted 7 lines · H. Peter Anvin
Quoted 6 lines · Peter Zijlstra
Quoted 5 lines
every subsystem will have
x86_printkacpi_printkpci_printk
Quoted 5 lines
Quoted 3 lines
doesn't sound like an easily extensible interface, better would be extending printk with a
KERN_subsystag like proposed.That would be my thinking too.
will be printk(KERN_PCI, KERN_DEBUG ".....") ?
and it will be ...KERN_PCI will be int?
YH
Quoted 13 lines · Yinghai Lu
Quoted 11 lines · H. Peter Anvin
Quoted 9 lines · Peter Zijlstra
Quoted 5 lines
every subsystem will have
x86_printkacpi_printkpci_printkdoesn't sound like an easily extensible interface, better would be extending printk with a
KERN_subsystag like proposed.
Quoted 6 lines
Quoted 2 lines
That would be my thinking too.
will be
printk(KERN_PCI, KERN_DEBUG ".....")?
and it will be ...KERN_PCI will be int?
#define X86_DEBUG KERN_DEBUG SUBSYS_X86
...
printk(X86_DEBUG "woozle failed the wibble\n);
JQuoted 7 lines · H. Peter Anvin
Quoted 6 lines · Peter Zijlstra
Quoted 5 lines
every subsystem will have
x86_printkacpi_printkpci_printk
Quoted 5 lines
Quoted 3 lines
doesn't sound like an easily extensible interface, better would be extending printk with a
KERN_subsystag like proposed.That would be my thinking too.
it seem using pci_printk or acpi_printk.. could be more flexible.
otherwise will need to keep update linux/kernel.h to add so call subsys tags...
use only need to
have DEFINE_LOGLEVEL_SETUP(xxx) in c and have DECLARE_LOGLEVEL(xxx) in .h then just use xxx_printk
YH
Quoted 14 lines · Yinghai Lu
Quoted 7 lines · H. Peter Anvin
Quoted 6 lines · Peter Zijlstra
Quoted 5 lines
every subsystem will have
x86_printkacpi_printkpci_printkQuoted 5 lines
Quoted 3 lines
doesn't sound like an easily extensible interface, better would be extending printk with a
KERN_subsystag like proposed.That would be my thinking too.
Quoted 9 lines
it seem using
pci_printkoracpi_printk.. could be more flexible.otherwise will need to keep update
linux/kernel.hto add so call subsys tags...use only need to
haveDEFINE_LOGLEVEL_SETUP(xxx)in c and haveDECLARE_LOGLEVEL(xxx)in .h then just usexxx_printk
and in real subsys could have as many the xxx_printk that user want...
YH
Quoted 10 lines · Yinghai Lu
it seem using
pci_printkoracpi_printk.. could be more flexible.otherwise will need to keep update
linux/kernel.hto add so call subsys tags...use only need to
haveDEFINE_LOGLEVEL_SETUP(xxx)in c and haveDECLARE_LOGLEVEL(xxx)in .h then just usexxx_printk
Uh? You can add the subsys tags elsewhere if you prefer too.
However, there are a few important differences to keep in mind. Tags get logged in the dmesg buffer even if not printed to the kernel, whereas a jump-based architecture will not just suppress the output, but even the formatting of the output. Either is a good thing for certain things, and a bad thing for other things.
I personally think the kind of things discussed belong in the category of "always put in the dmesg buffer", and like the idea of subsystem-tagging them.
-hpa
Quoted 21 lines · H. Peter Anvin
Quoted 11 lines · Yinghai Lu
it seem using
pci_printkoracpi_printk.. could be more flexible.otherwise will need to keep update
linux/kernel.hto add so call subsys tags...use only need to
haveDEFINE_LOGLEVEL_SETUP(xxx)in c and haveDECLARE_LOGLEVEL(xxx)in .h then just usexxx_printkUh? You can add the subsys tags elsewhere if you prefer too.
However, there are a few important differences to keep in mind. Tags get logged in the dmesg buffer even if not printed to the kernel, whereas a jump-based architecture will not just suppress the output, but even the formatting of the output. Either is a good thing for certain things, and a bad thing for other things.
Quoted 4 lines
I personally think the kind of things discussed belong in the category of "always put in the dmesg buffer", and like the idea of subsystem-tagging them.
you still can usepci_printk(v, KERN_PCI KERN_DEBUG "...\n");
if vprintk is expanded to handle KERN_PCI and other tags... or even you could usepci_printk(v, KERN_ACPI KERN_DEBUG "...\n");
YH
Quoted 8 lines · Yinghai Lu
you still can use
pci_printk(v, KERN_PCI KERN_DEBUG "...\n");if vprintk is expanded to handle
KERN_PCIand other tags... or even you could usepci_printk(v, KERN_ACPI KERN_DEBUG "...\n");
And the point of this, other than sheer verbosity?
-hpa
Quoted 11 lines · H. Peter Anvin
Quoted 8 lines · Yinghai Lu
you still can use
pci_printk(v, KERN_PCI KERN_DEBUG "...\n");if vprintk is expanded to handle
KERN_PCIand other tags... or even you could usepci_printk(v, KERN_ACPI KERN_DEBUG "...\n");And the point of this, other than sheer verbosity?
let every file or componet of subsystem could control the print out via loglevel=pci_any_name:7
YH
Quoted 5 lines · Yinghai Lu
Quoted 4 lines · H. Peter Anvin
Quoted 3 lines · Yinghai Lu
you still can use
pci_printk(v, KERN_PCI KERN_DEBUG "...\n");
Quoted 9 lines
Quoted 5 lines
Quoted 4 lines
if vprintk is expanded to handle
KERN_PCIand other tags... or even you could usepci_printk(v, KERN_ACPI KERN_DEBUG "...\n");And the point of this, other than sheer verbosity?
let every file or componet of subsystem could control the print out via loglevel=pci_any_name:7
pci_printk(v, KERN_ACPI KERN_DEBUG "...\n");
^^^^ ^^^^^^^^^
Not only do you have duplication, here, but inconsistency...
-hpa
Quoted 15 lines · H. Peter Anvin
Quoted 14 lines · Yinghai Lu
Quoted 11 lines · H. Peter Anvin
Quoted 8 lines · Yinghai Lu
you still can use
pci_printk(v, KERN_PCI KERN_DEBUG "...\n");if vprintk is expanded to handle
KERN_PCIand other tags... or even you could usepci_printk(v, KERN_ACPI KERN_DEBUG "...\n");And the point of this, other than sheer verbosity?
Quoted 8 lines
Quoted 3 lines
let every file or componet of subsystem could control the print out via loglevel=pci_any_name:7
pci_printk(v, KERN_ACPI KERN_DEBUG "...\n");
^^^^ ^^^^^^^^^Not only do you have duplication, here, but inconsistency...
how aboutpci_printk(v, KERN_DEBUG "...\n");
will put
<pci> <7> ...\n
in dmesg bug,
and let vprintk get rid of <pci> like <7>
is that what you want?
YH
Quoted 6 lines · Yinghai Lu
Quoted 2 lines
Not only do you have duplication, here, but inconsistency...
how about
pci_printk(v, KERN_DEBUG "...\n");
Quoted 8 lines
will put
<pci> <7> ...\n
in dmesg bug,and let vprintk get rid of <pci> like <7>
is that what you want?
First of all, what is the "v" here, and why not just have printk(KERN_PCI KERN_DEBUG "...\n");
... and we can do #define PCI_DEBUG KERN_PCI KERN_DEBUG even.
We do have a need for special macros when we're doing device-specific prefixes, of course. If that is what your "v" is meant to be, then there was an implicit topic shift in the discussion thread.
-hpa
Quoted 16 lines · H. Peter Anvin
Quoted 6 lines · Yinghai Lu
Quoted 2 lines
Not only do you have duplication, here, but inconsistency...
how about
pci_printk(v, KERN_DEBUG "...\n");Quoted 8 lines
will put
<pci> <7> ...\n
in dmesg bug,and let vprintk get rid of <pci> like <7>
is that what you want?
Quoted 8 lines
First of all, what is the "v" here, and why not just have
printk(KERN_PCI KERN_DEBUG "...\n");... and we can do #define
PCI_DEBUGKERN_PCIKERN_DEBUGeven.We do have a need for special macros when we're doing device-specific prefixes, of course. If that is what your "v" is meant to be, then there was an implicit topic shift in the discussion thread.
will try.
YH