loglevel=pci:8,acpi:8,apic=8 support v5
Subsystems (5)
cover loglevel=pci:8,acpi:8,apic=8 support v5
KERN_PCI
KERN_ACPI
v4: fix some checkpatch error and warning
v5: add default with DEFINE_LOGLEVE_SETUP_DEF
KERN_APIC
usage:
in .h to have #define KERN_PCI "<pci>" in .c to have DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:"); then could use printk(KERN_DEBUG KERN_PCI fmt, ...); and command line loglevel=3,pci:8
you can add different printk to different files of one subsys if you like not just one susbsys one tag, and don't need to update kernel.h to add more tags
YH
PATCH 1/6 add DEFINE_LOGLEVEL_SETUP v6
so could make subsys easy to add loglevel and xxx_printk
v2: make it more genric, so subsys user only need to two line macro
v3: add back nameStr, so could find out iommu: and iommu_gart: and etc
v4: use printk intead of pci_printk
v5: fix checkpatch error and warning
v6: add DEFINE_LOGLEVEL_SETUP_DEF to take default
usage:
in .h to have
#define KERN_PCI "<pci>"
in .c to have
DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:");
then could use
printk(KERN_DEBUG KERN_PCI fmt, ...);
and command line
loglevel=pci:8
you can add different printk to different files of one subsys if you like
--- arch/x86/kernel/vmlinux_32.lds.S | 1 arch/x86/kernel/vmlinux_64.lds.S | 2 include/asm-generic/vmlinux.lds.h | 8 +++ include/linux/init.h | 22 ++++++++++ include/linux/kernel.h | 9 ++++ init/main.c | 77 +++++++++++++++++++++++++++++++++++++- kernel/printk.c | 28 +++++++++++-- 7 files changed, 142 insertions(+), 5 deletions(-)
arch/x86/kernel/vmlinux_32.lds.S +1 -0
@@ -145,6 +145,7 @@ SECTIONS *(.x86_cpu_dev.init) __x86_cpu_dev_end = .; } + LOGLEVEL_SETUP_INIT(8) DYN_ARRAY_INIT(8) SECURITY_INIT . = ALIGN(4);
arch/x86/kernel/vmlinux_64.lds.S +2 -0
@@ -174,6 +174,8 @@ SECTIONS } __x86_cpu_dev_end = .; + LOGLEVEL_SETUP_INIT(8) + DYN_ARRAY_INIT(8) SECURITY_INIT
include/asm-generic/vmlinux.lds.h +8 -0
@@ -222,6 +222,14 @@* All archs are supposed to use RO_DATA() */ #define RODATA RO_DATA(4096) +#define LOGLEVEL_SETUP_INIT (align) \ + . = ALIGN((align)); \ + .loglevel_setup.init : AT(ADDR(.loglevel_setup.init) - LOAD_OFFSET) { \ + VMLINUX_SYMBOL(__loglevel_setup_start) = .; \ + *(.loglevel_setup.init) \ + VMLINUX_SYMBOL(__loglevel_setup_end) = .; \ + } +#define DYN_ARRAY_INIT (align) \ . = ALIGN((align)); \ .dyn_array.init : AT(ADDR(.dyn_array.init) - LOAD_OFFSET) { \
include/linux/init.h +22 -0
@@ -251,6 +251,28 @@ struct obs_kernel_param {/* Relies on boot_command_line being set */ void __init parse_early_param (void ); +struct loglevel_setup { +char *name; +char *tag; +int level; +}; + +extern struct loglevel_setup *__loglevel_setup_start[], *__loglevel_setup_end[]; + +#define DEFINE_LOGLEVEL_SETUP_DEF (nameX, tagX, nameStr, levelX) \ + static struct loglevel_setup __loglevel_setup_##nameX __initdata = \ + { \ + .tag = tagX, \ + .name = nameStr, \ + .level = levelX, \ + }; \ + static struct loglevel_setup *__loglevel_setup_ptr_##nameX __used \ + __attribute__((__section__(".loglevel_setup.init"))) = \ + &__loglevel_setup_##nameX + +#define DEFINE_LOGLEVEL_SETUP (nameX, tagX, nameStr) \ + DEFINE_LOGLEVEL_SETUP_DEF(nameX, tagX, nameStr, 0) \ +struct dyn_array {void **name;unsigned long size;
include/linux/kernel.h +9 -0
@@ -104,6 +104,15 @@ extern int console_printk[];#define minimum_console_loglevel (console_printk[2])#define default_console_loglevel (console_printk[3]) +struct tag_console_loglevel { +char tag[32 ]; +char name[32 ]; +int level; +}; + +extern struct tag_console_loglevel tag_level[]; +extern int tag_level_nr; +struct completion ;struct pt_regs ;struct user ;
init/main.c +76 -1
85 lines not on this page · raw message
kernel/printk.c +24 -4
@@ -457,9 +457,9 @@ early_param("ignore_loglevel", ignore_lo* Write out chars from start to end - 1 inclusive */ static void _call_console_drivers (unsigned start, -unsigned end,int msg_log_level) +unsigned end,int msg_log_level,int level) { -if ((msg_log_level < console_loglevel || ignore_loglevel) && +if ((msg_log_level < level || ignore_loglevel) && console_drivers && start != end) {if ((start &LOG_BUF_MASK ) > (end &LOG_BUF_MASK )) {/* wrapped write */
@@ -481,21 +481,40 @@ static void call_console_drivers(unsigne {unsigned cur_index, start_print;static int msg_level =-1 ; +int level = console_loglevel;BUG_ON (((int )(start - end)) >0 ); cur_index = start; start_print = start;while (cur_index != end) { +int i; +if (msg_level <0 && ((end - cur_index) >2 ) &&LOG_BUF (cur_index +0 ) =='<' &&LOG_BUF (cur_index +1 ) >='0' &&LOG_BUF (cur_index +1 ) <='7' &&LOG_BUF (cur_index +2 ) =='>' ) { msg_level =LOG_BUF (cur_index +1 ) -'0' ; + level = console_loglevel; cur_index +=3 ; start_print = cur_index; } +/* handle tag here */ +for (i =0 ; i < tag_level_nr; i++) { +struct tag_console_loglevel *tl; +int len; + + tl = &tag_level[i]; + len =strlen (tl->tag); +if ((end - cur_index) > (len -1 ) && + !strncmp (&LOG_BUF (cur_index), tl->tag, len)) { + level = tl->level; + cur_index += len; + start_print = cur_index; +break ; + } + }while (cur_index != end) {char c =LOG_BUF (cur_index);
@@ -510,14 +529,15 @@ static void call_console_drivers(unsigne*/ msg_level = default_message_loglevel; } -_call_console_drivers (start_print, cur_index, msg_level); +_call_console_drivers (start_print, cur_index, + msg_level, level); msg_level =-1 ; start_print = cur_index;break ; } } } -_call_console_drivers (start_print, end, msg_level); +_call_console_drivers (start_print, end, msg_level, level); }static void emit_log_char (char c)
PATCH 2/6 pci: add KERN_PCI
In reply to Yinghai Luuse DEFINE_LOGLEVEL_SETUP to set loglevel for pci
--- drivers/pci/pci.c | 2 ++ include/linux/pci.h | 2 ++ 2 files changed, 4 insertions(+)
drivers/pci/pci.c +2 -0
@@ -1953,6 +1953,8 @@ static int __devinit pci_setup(char *str }early_param ("pci" , pci_setup); +DEFINE_LOGLEVEL_SETUP (pci,KERN_PCI ,"pci:" ); +device_initcall_sync (pci_init);EXPORT_SYMBOL (pci_reenable_device);
include/linux/pci.h +2 -0
@@ -55,6 +55,8 @@/* Include the ID list */ #include <linux/pci_ids.h> +#define KERN_PCI "<pci>" +/* pci_slot represents a physical slot */ struct pci_slot {struct pci_bus *bus;/* The bus this slot is on */
PATCH 3/6 pci: using printk(KERN_PCI v3
In reply to Yinghai Luv2: use printk(KERN_DEBUG KERN_PCI ...
v3: fix checkpatch error and warning
--- drivers/pci/probe.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
drivers/pci/probe.c +17 -11
@@ -304,7 +304,8 @@ static int __pci_read_base(struct pci_de }else { res->start = l64; res->end = l64 + sz64; -printk (KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n" , + printk(KERN_DEBUG KERN_PCI +"PCI: %s reg %x 64bit mmio: [%llx, %llx]\n" , pci_name(dev), pos, res->start, res->end); } }else {
@@ -315,9 +316,10 @@ static int __pci_read_base(struct pci_de res->start = l; res->end = l + sz; -printk (KERN_DEBUG "PCI: %s reg %x %s: [%llx, %llx]\n" ,pci_name (dev), - pos, (res->flags &IORESOURCE_IO ) ?"io port" :"32bit mmio" , - res->start, res->end); + printk(KERN_DEBUG KERN_PCI "PCI: %s reg %x %s: [%llx, %llx]\n", +pci_name (dev), pos, + (res->flags &IORESOURCE_IO ) ?"io port" :"32bit mmio" , + res->start, res->end); } out:
@@ -388,8 +390,9 @@ void __devinit pci_read_bridge_bases(str res->start = base;if (!res->end) res->end = limit +0xfff ; -printk (KERN_DEBUG "PCI: bridge %s io port: [%llx, %llx]\n" , -pci_name (dev), res->start, res->end); + printk(KERN_DEBUG KERN_PCI +"PCI: bridge %s io port: [%llx, %llx]\n" , + pci_name(dev), res->start, res->end); } res = child->resource[1 ];
@@ -401,8 +404,9 @@ void __devinit pci_read_bridge_bases(str res->flags = (mem_base_lo &PCI_MEMORY_RANGE_TYPE_MASK ) |IORESOURCE_MEM ; res->start = base; res->end = limit +0xfffff ; -printk (KERN_DEBUG "PCI: bridge %s 32bit mmio: [%llx, %llx]\n" , -pci_name (dev), res->start, res->end); + printk(KERN_DEBUG KERN_PCI +"PCI: bridge %s 32bit mmio: [%llx, %llx]\n" , + pci_name(dev), res->start, res->end); } res = child->resource[2 ];
@@ -438,9 +442,11 @@ void __devinit pci_read_bridge_bases(str res->flags = (mem_base_lo &PCI_MEMORY_RANGE_TYPE_MASK ) |IORESOURCE_MEM |IORESOURCE_PREFETCH ; res->start = base; res->end = limit +0xfffff ; -printk (KERN_DEBUG "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n" , -pci_name (dev), (res->flags &PCI_PREF_RANGE_TYPE_64 )?"64" :"32" , - res->start, res->end); + printk(KERN_DEBUG KERN_PCI +"PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n" , +pci_name (dev), + (res->flags &PCI_PREF_RANGE_TYPE_64 ) ?"64" :"32" , + res->start, res->end); } }
PATCH 4/6 acpi: add KERN_ACPI v3
In reply to Yinghai Luuse DEFINE_LOGLEVEL_SETUP to set loglevel for acpi
v2: use <acpi, "acpi:"> instead
v3: use KERN_ACPI
--- drivers/acpi/osl.c | 2 ++ include/linux/acpi.h | 1 + 2 files changed, 3 insertions(+)
drivers/acpi/osl.c +2 -0
@@ -75,6 +75,8 @@ EXPORT_SYMBOL(acpi_in_debugger);extern char line_buf[80 ];#endif /*ENABLE_DEBUGGER */ +DEFINE_LOGLEVEL_SETUP (acpi,KERN_ACPI ,"acpi:" ); +static unsigned int acpi_irq_irq;static acpi_osd_handler acpi_irq_handler;static void *acpi_irq_context;
include/linux/acpi.h +1 -0
@@ -43,6 +43,7 @@#include <asm/acpi.h> #include <linux/dmi.h> +#define KERN_ACPI "<acpi>"enum acpi_irq_model_id {ACPI_IRQ_MODEL_PIC =0 ,
PATCH 5/6 apci: dump slit with printk(KERN_ACPI...)
In reply to Yinghai Lu--- drivers/acpi/numa.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/acpi/numa.c +9 -0
@@ -150,6 +150,15 @@ static __init int slit_valid(struct acpi {int i, j;int d = slit->locality_count; + printk(KERN_DEBUG KERN_ACPI "ACPI: SLIT: nodes = %d\n", d); +for (i =0 ; i < d; i++) { + printk(KERN_DEBUG KERN_ACPI " "); +for (j =0 ; j < d; j++) { +u8 val = slit->entry[d*i + j]; + printk(KERN_CONT KERN_ACPI " %d", val); + } + printk(KERN_CONT KERN_ACPI "\n"); + }for (i =0 ; i < d; i++) {for (j =0 ; j < d; j++) {u8 val = slit->entry[d*i + j];
PATCH 6/6 x86: add KERN_APIC
In reply to Yinghai Luand kill apic_printk
using loglevel=apic:8 intead
--- Documentation/kernel-parameters.txt | 6 arch/x86/kernel/apic.c | 108 +++++------- arch/x86/kernel/io_apic.c | 235 +++++++++++++--------------- arch/x86/kernel/mpparse.c | 10 - arch/x86/kernel/smpboot.c | 11 - include/asm-x86/apic.h | 20 -- include/asm-x86/es7000/wakecpu.h | 6 include/asm-x86/mach-default/mach_wakecpu.h | 6 8 files changed, 178 insertions(+), 224 deletions(-)
Documentation/kernel-parameters.txt +0 -6
@@ -306,12 +306,6 @@ and is between 256 and 4096 characters. not play well with APC CPU idle - disable it if you have APC and your system crashes randomly. - apic= [APIC,i386] Advanced Programmable Interrupt Controller - Change the output verbosity whilst booting - Format: { quiet (default) | verbose | debug } - Change the amount of debugging information output - when initialising the APIC and IO-APIC components. - apm= [APM] Advanced Power Management See header of arch/x86/kernel/apm_32.c.
arch/x86/kernel/apic.c +49 -59
368 lines not on this page · raw message
arch/x86/kernel/io_apic.c +111 -124
638 lines not on this page · raw message
arch/x86/kernel/mpparse.c +5 -5
@@ -83,7 +83,7 @@ static void __init MP_bus_info(struct mpif (x86_quirks->mpc_oem_bus_info) x86_quirks->mpc_oem_bus_info (m, str);else -apic_printk (APIC_VERBOSE ,"Bus #%d is %s\n" , m->mpc_busid, str); +printk (APIC_VERBOSE "Bus #%d is %s\n" , m->mpc_busid, str);#if MAX_MP_BUSSES <256 if (m->mpc_busid >=MAX_MP_BUSSES ) {
@@ -154,7 +154,7 @@ static void __init MP_ioapic_info(structstatic void print_MP_intsrc_info (struct mpc_config_intsrc *m) { - apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x," + printk(APIC_VERBOSE "Int: type %d, pol %d, trig %d, bus %02x," " IRQ %02x, APIC ID %x, APIC INT %02x\n", m->mpc_irqtype, m->mpc_irqflag & 3, (m->mpc_irqflag >> 2) & 3, m->mpc_srcbus,
@@ -163,7 +163,7 @@ static void print_MP_intsrc_info(structstatic void __init print_mp_irq_info (struct mp_config_intsrc *mp_irq) { - apic_printk(APIC_VERBOSE, "Int: type %d, pol %d, trig %d, bus %02x," + printk(APIC_VERBOSE "Int: type %d, pol %d, trig %d, bus %02x," " IRQ %02x, APIC ID %x, APIC INT %02x\n", mp_irq->mp_irqtype, mp_irq->mp_irqflag & 3, (mp_irq->mp_irqflag >> 2) & 3, mp_irq->mp_srcbus,
@@ -235,7 +235,7 @@ static void __init MP_intsrc_info(structstatic void __init MP_lintsrc_info (struct mpc_config_lintsrc *m) { - apic_printk(APIC_VERBOSE, "Lint: type %d, pol %d, trig %d, bus %02x," + printk(APIC_VERBOSE "Lint: type %d, pol %d, trig %d, bus %02x," " IRQ %02x, APIC ID %x, APIC LINT %02x\n", m->mpc_irqtype, m->mpc_irqflag & 3, (m->mpc_irqflag >> 2) & 3, m->mpc_srcbusid,
@@ -697,7 +697,7 @@ static int __init smp_scan_config(unsignunsigned int *bp =phys_to_virt (base);struct intel_mp_floating *mpf; -apic_printk (APIC_VERBOSE ,"Scan SMP from %p for %ld bytes.\n" , +printk (APIC_VERBOSE "Scan SMP from %p for %ld bytes.\n" , bp, length);BUILD_BUG_ON (sizeof (*mpf) !=16 );
arch/x86/kernel/smpboot.c +6 -5
@@ -542,17 +542,18 @@ static inline void __inquire_remote_apicint timeout;u32 status; -printk (KERN_INFO "Inquiring remote APIC 0x%x...\n" , apicid); +printk (APIC_DEBUG "Inquiring remote APIC 0x%x...\n" , apicid);for (i =0 ; i <ARRAY_SIZE (regs); i++) { -printk (KERN_INFO "... APIC 0x%x %s: " , apicid, names[i]); +printk (APIC_DEBUG "... APIC 0x%x %s: " , + apicid, names[i]);/* * Wait for idle. */ status =safe_apic_wait_icr_idle ();if (status) -printk (KERN_CONT + printk(KERN_CONT KERN_APIC"a previous APIC delivery may have failed\n" );apic_icr_write (APIC_DM_REMRD | regs[i], apicid);
@@ -566,10 +567,10 @@ static inline void __inquire_remote_apicswitch (status) {case APIC_ICR_RR_VALID : status =apic_read (APIC_RRR ); -printk (KERN_CONT "%08x\n" , status); + printk(KERN_CONT KERN_APIC "%08x\n", status);break ;default : -printk (KERN_CONT "failed\n" ); + printk(KERN_CONT KERN_APIC "failed\n"); } } }
include/asm-x86/apic.h +5 -15
@@ -14,24 +14,14 @@#define ARCH_APICTIMER_STOPS_ON_C3 1 -/* -* Debugging macros -*/ -#define APIC_QUIET 0 -#define APIC_VERBOSE 1 -#define APIC_DEBUG 2 +#define KERN_APIC "<apic>"/* -* Define the default level of output to be very little -* This can be turned up by using apic=verbose for more -* information and apic=debug for _lots_ of information. -* apic_verbosity is defined in apic.c +* Debugging macros */ -#define apic_printk(v, s, a...) do { \ - if ((v) <= apic_verbosity) \ - printk(s, ##a); \ - } while (0) - +#define APIC_QUIET KERN_WARNING KERN_APIC +#define APIC_VERBOSE KERN_INFO KERN_APIC +#define APIC_DEBUG KERN_DEBUG KERN_APICextern void generic_apic_probe (void );
include/asm-x86/es7000/wakecpu.h +1 -5
@@ -50,10 +50,6 @@ static inline void restore_NMI_vector(un { } -#if APIC_DEBUG -#define inquire_remote_apic (apicid) __inquire_remote_apic(apicid) -#else -#define inquire_remote_apic (apicid) {} -#endif +#define inquire_remote_apic (apicid) __inquire_remote_apic(apicid)#endif /* __ASM_MACH_WAKECPU_H */
include/asm-x86/mach-default/mach_wakecpu.h +1 -5
@@ -33,10 +33,6 @@ static inline void restore_NMI_vector(un { } -#if APIC_DEBUG -#define inquire_remote_apic (apicid) __inquire_remote_apic(apicid) -#else -#define inquire_remote_apic (apicid) {} -#endif +#define inquire_remote_apic (apicid) __inquire_remote_apic(apicid)#endif /* ASM_X86__MACH_DEFAULT__MACH_WAKECPU_H */
Quoted 16 lines · Yinghai Lu
KERN_PCI
KERN_ACPI
v4: fix some checkpatch error and warning
v5: add default withDEFINE_LOGLEVE_SETUP_DEF
KERN_APICusage:
in .h to have #define KERN_PCI "<pci>" in .c to have DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:"); then could use printk(KERN_DEBUG KERN_PCI fmt, ...); and command line loglevel=3,pci:8
Quoted 2 lines
you can add different printk to different files of one subsys if you like not just one susbsys one tag, and don't need to update
kernel.hto add more tags
I think all of this is overdesigned and stupid.
People expecting that loglevels are exactly right so they can calm messages are like security-savvy people who expect all security relevant bugfixes carry CVE tag.
grep says there are 50757 printk calls, only 32129 of them carry KERN_ tag.
Oh, and new and improved logs:
[ 0.340326] pci 0000:00:01.0: PME# supported from D0 D3hot D3cold [ 0.340326] pci 0000:00:01.0: PME# disabled [ 0.340326] <pci>PCI: 0000:00:1a.0 reg 20 io port: [dc00, dc1f] [ 0.340413] <pci>PCI: 0000:00:1a.1 reg 20 io port: [e000, e01f] [ 0.340549] <pci>PCI: 0000:00:1a.7 reg 10 32bit mmio: [febffc00, febfffff] ^^^^^^^^^
How this can be an improvement for those who boot with ignore_loglevel, I don't know.
Quoted 31 lines · Alexey Dobriyan
Quoted 16 lines · Yinghai Lu
KERN_PCI
KERN_ACPI
v4: fix some checkpatch error and warning
v5: add default withDEFINE_LOGLEVE_SETUP_DEF
KERN_APICusage:
in .h to have #define KERN_PCI "<pci>" in .c to have DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:"); then could use printk(KERN_DEBUG KERN_PCI fmt, ...); and command line loglevel=3,pci:8Quoted 2 lines
you can add different printk to different files of one subsys if you like not just one susbsys one tag, and don't need to update
kernel.hto add more tagsI think all of this is overdesigned and stupid.
People expecting that loglevels are exactly right so they can calm messages are like security-savvy people who expect all security relevant bugfixes carry CVE tag.
grep says there are 50757 printk calls, only 32129 of them carry
KERN_tag.Oh, and new and improved logs:
Quoted 8 lines
[ 0.340326] pci 0000:00:01.0: PME# supported from D0 D3hot D3cold [ 0.340326] pci 0000:00:01.0: PME# disabled [ 0.340326] <pci>PCI: 0000:00:1a.0 reg 20 io port: [dc00, dc1f] [ 0.340413] <pci>PCI: 0000:00:1a.1 reg 20 io port: [e000, e01f] [ 0.340549] <pci>PCI: 0000:00:1a.7 reg 10 32bit mmio: [febffc00, febfffff] ^^^^^^^^^How this can be an improvement for those who boot with
ignore_loglevel, I don't know.
the subsystem tags should be cut out by dmesg by default, just like the normal <1> tags are cut out.
about your general point: it's valid observations. The idea would be to end this never ending unstable conflict of people adding printks for debug reasons versus people removing printks who'd like to have a nice looking bootup log.
Both point of views are correct in different usecases - and IMO the best solution is the consolidation hpa suggested and what Yinghai is working
towards: to replace all the current ad-hoc debug printouts (with different switchlets strewn all across the kernel) with an ASCII based generic printk facility and a generic boot line option.
people adding printks without any KERN_ tag is fine - this facility is only interesting to subsystems who'd like to make use of it. (core code, ec. - the items that have a disproportionate weight in terms of system stability, and which thus have a disproportionate need to stay debuggable and regression-free)
[ and we also need a dynamic facility to change the filters via debugfs
btw - it should be possible to modify these printk filters after bootup, runtime. Many subsystems have debug printks that make sense to enable/disable after the system has booted up. ]
and it's bad and a showstopper if the default output of 'dmesg' degrades, like your noticed - those are bugs in the concept and need to be fixed.
Ingo
Quoted 43 lines · Ingo Molnar
Quoted 31 lines · Alexey Dobriyan
Quoted 16 lines · Yinghai Lu
KERN_PCI
KERN_ACPI
v4: fix some checkpatch error and warning
v5: add default withDEFINE_LOGLEVE_SETUP_DEF
KERN_APICusage:
in .h to have #define KERN_PCI "<pci>" in .c to have DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:"); then could use printk(KERN_DEBUG KERN_PCI fmt, ...); and command line loglevel=3,pci:8Quoted 2 lines
you can add different printk to different files of one subsys if you like not just one susbsys one tag, and don't need to update
kernel.hto add more tagsI think all of this is overdesigned and stupid.
People expecting that loglevels are exactly right so they can calm messages are like security-savvy people who expect all security relevant bugfixes carry CVE tag.
grep says there are 50757 printk calls, only 32129 of them carry
KERN_tag.Oh, and new and improved logs:
Quoted 8 lines
[ 0.340326] pci 0000:00:01.0: PME# supported from D0 D3hot D3cold [ 0.340326] pci 0000:00:01.0: PME# disabled [ 0.340326] <pci>PCI: 0000:00:1a.0 reg 20 io port: [dc00, dc1f] [ 0.340413] <pci>PCI: 0000:00:1a.1 reg 20 io port: [e000, e01f] [ 0.340549] <pci>PCI: 0000:00:1a.7 reg 10 32bit mmio: [febffc00, febfffff] ^^^^^^^^^How this can be an improvement for those who boot with
ignore_loglevel, I don't know.
Quoted 2 lines
the subsystem tags should be cut out by dmesg by default, just like the normal <1> tags are cut out.
Or just leave ACPI:, PCI:. Tags are already in place in some sense.
Quoted 4 lines
about your general point: it's valid observations. The idea would be to end this never ending unstable conflict of people adding printks for debug reasons versus people removing printks who'd like to have a nice looking bootup log.
Simply nice looking log is irrational. I can understand if by default messages do not fit into printk buffer before userspace can save them. This is indeed harmful and loses information.
OTOH, all these loglevel games ultimately lead to missed messages (by design). I remember myself wasting time debugging wrong path simply because box wasn't booted with ignore_loglevel and critical debugging printk wasn't on serial console, but only in dmesg.
So, in some cases useless information will not be shown, but in some absolutely critical information will not be shown.
Quoted 7 lines
Both point of views are correct in different usecases - and IMO the best solution is the consolidation hpa suggested and what Yinghai is working
towards: to replace all the current ad-hoc debug printouts (with different switchlets strewn all across the kernel) with an ASCII based generic printk facility and a generic boot line option.people adding printks without any
KERN_tag is fine -
According to checkpatch.pl, it isn't.
Quoted 13 lines
this facility is only interesting to subsystems who'd like to make use of it. (core code, ec. - the items that have a disproportionate weight in terms of system stability, and which thus have a disproportionate need to stay debuggable and regression-free)
[ and we also need a dynamic facility to change the filters via debugfs
btw - it should be possible to modify these printk filters after bootup, runtime. Many subsystems have debug printks that make sense to enable/disable after the system has booted up. ]and it's bad and a showstopper if the default output of 'dmesg' degrades, like your noticed - those are bugs in the concept and need to be fixed.
Quoted 58 lines · Alexey Dobriyan
Quoted 43 lines · Ingo Molnar
Quoted 31 lines · Alexey Dobriyan
Quoted 16 lines · Yinghai Lu
KERN_PCI
KERN_ACPI
v4: fix some checkpatch error and warning
v5: add default withDEFINE_LOGLEVE_SETUP_DEF
KERN_APICusage:
in .h to have #define KERN_PCI "<pci>" in .c to have DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:"); then could use printk(KERN_DEBUG KERN_PCI fmt, ...); and command line loglevel=3,pci:8Quoted 2 lines
you can add different printk to different files of one subsys if you like not just one susbsys one tag, and don't need to update
kernel.hto add more tagsI think all of this is overdesigned and stupid.
People expecting that loglevels are exactly right so they can calm messages are like security-savvy people who expect all security relevant bugfixes carry CVE tag.
grep says there are 50757 printk calls, only 32129 of them carry
KERN_tag.Oh, and new and improved logs:
Quoted 8 lines
[ 0.340326] pci 0000:00:01.0: PME# supported from D0 D3hot D3cold [ 0.340326] pci 0000:00:01.0: PME# disabled [ 0.340326] <pci>PCI: 0000:00:1a.0 reg 20 io port: [dc00, dc1f] [ 0.340413] <pci>PCI: 0000:00:1a.1 reg 20 io port: [e000, e01f] [ 0.340549] <pci>PCI: 0000:00:1a.7 reg 10 32bit mmio: [febffc00, febfffff] ^^^^^^^^^How this can be an improvement for those who boot with
ignore_loglevel, I don't know.Quoted 2 lines
the subsystem tags should be cut out by dmesg by default, just like the normal <1> tags are cut out.
Or just leave ACPI:, PCI:. Tags are already in place in some sense.
Quoted 4 lines
about your general point: it's valid observations. The idea would be to end this never ending unstable conflict of people adding printks for debug reasons versus people removing printks who'd like to have a nice looking bootup log.
Simply nice looking log is irrational. I can understand if by default messages do not fit into printk buffer before userspace can save them. This is indeed harmful and loses information.
Quoted 7 lines
OTOH, all these loglevel games ultimately lead to missed messages (by design). I remember myself wasting time debugging wrong path simply because box wasn't booted with
ignore_logleveland critical debugging printk wasn't on serial console, but only in dmesg.So, in some cases useless information will not be shown, but in some absolutely critical information will not be shown.
yes, i had that happen too, and i am quite sure that the most sensible way out is to provide a _single_ point for users to enable 'all things debug'. I.e. a "loglevel=debug" (or loglevel=all) boot parameter.
Instead of the current list of zillions of ad-hoc switchlets that are scattered all around the kernel. Tell me, within 10 seconds, which one of these are the correct options and which ones are typos:
lapic
lapic=verbose
apic=debug
ignore-loglevel
initcalldebug
early_printk=vga
ignoreloglevel
debug
verbose
ignore_loglevel
initcall_debug
apic=verbose
initcall=debug
earlyprintk=vga
(i'm willing to bet a good beer that you probably have not found the right solution in time :-)
People dont really want to individually enable pci or apic or smp debugging or whatnot - when it's about boot debugging they (and we) just want something really verbose. (_Sometimes_ we want more accurate filters for runtime debugging, especially if something can produce a log of continuing printks during userspace bootup - but that is an afterthought IMO.)
with such a facility in place we could just hide all non-essential messages by default, and have the perpetual possibility to get a verbose bootup without users having to rebuild their (often distro-built) kernel.
The only ongoing work would be to occasionally convert a stray informational printk that seemed to be useful during early development to a subsystem printk that hides it by default. The printk is not actually _lost_ and is utmost trivial to activate it again, should the need arise - which loss is why the "get rid of printks" patches are opposed most of the time.
So i think we'll hit multiple birds with the same stone.
Ingo
Quoted 41 lines · Ingo Molnar
Quoted 29 lines · Alexey Dobriyan
Quoted 16 lines · Yinghai Lu
KERN_PCI
KERN_ACPI
v4: fix some checkpatch error and warning
v5: add default withDEFINE_LOGLEVE_SETUP_DEF
KERN_APICusage:
in .h to have
#defineKERN_PCI"<pci>"
in .c to have
DEFINE_LOGLEVEL_SETUP(pci, KERN_PCI, "pci:");
then could use
printk(KERN_DEBUG KERN_PCI fmt, ...);
and command line
loglevel=3,pci:8Quoted 2 lines
you can add different printk to different files of one subsys if you like not just one susbsys one tag, and don't need to update
kernel.hto add more tagsI think all of this is overdesigned and stupid.
People expecting that loglevels are exactly right so they can calm messages are like security-savvy people who expect all security relevant bugfixes carry CVE tag.
grep says there are 50757 printk calls, only 32129 of them carry
KERN_tag.Quoted 8 lines
Oh, and new and improved logs:
[ 0.340326] pci 0000:00:01.0: PME# supported from D0 D3hot D3cold [ 0.340326] pci 0000:00:01.0: PME# disabled [ 0.340326] <pci>PCI: 0000:00:1a.0 reg 20 io port: [dc00, dc1f] [ 0.340413] <pci>PCI: 0000:00:1a.1 reg 20 io port: [e000, e01f] [ 0.340549] <pci>PCI: 0000:00:1a.7 reg 10 32bit mmio: [febffc00, febfffff] ^^^^^^^^^
Quoted 3 lines
and it's bad and a showstopper if the default output of 'dmesg' degrades, like your noticed - those are bugs in the concept and need to be fixed.
v6 should fix the problem, to support several seperate loglevel.
YH
H. Peter Anvin
reviewerQuoted 3 lines · Ingo Molnar
the subsystem tags should be cut out by dmesg by default, just like the normal <1> tags are cut out.
[...]
Quoted 3 lines
and it's bad and a showstopper if the default output of 'dmesg' degrades, like your noticed - those are bugs in the concept and need to be fixed.
It's probably worth pointing out that we had similar transition pains when we introduced the loglevel tags. If you used an old dmesg/klogd you got the loglevel tags; we cleaned them up.
-hpa
Quoted 7 lines · H. Peter Anvin
Quoted 4 lines · Ingo Molnar
the subsystem tags should be cut out by dmesg by default, just like the normal <1> tags are cut out.
[...]
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
and it's bad and a showstopper if the default output of 'dmesg' degrades, like your noticed - those are bugs in the concept and need to be fixed.
It's probably worth pointing out that we had similar transition pains when we introduced the loglevel tags. If you used an old dmesg/klogd you got the loglevel tags; we cleaned them up.
want to expand loglevel tags to two digi bits, hope the dmesg/klogd could handle it.
YH
H. Peter Anvin
reviewerQuoted 8 lines · Yinghai Lu
Quoted 4 lines
Quoted 1 line
It's probably worth pointing out that we had similar transition pains when we introduced the loglevel tags. If you used an old dmesg/klogd you got the loglevel tags; we cleaned them up.
want to expand loglevel tags to two digi bits, hope the dmesg/klogd could handle it.
I doubt they'd be written to handle that already.
-hpa
Quoted 8 lines · H. Peter Anvin
Quoted 7 lines · Yinghai Lu
Quoted 6 lines
Quoted 1 line
It's probably worth pointing out that we had similar transition pains when
we introduced the loglevel tags. If you used an old dmesg/klogd you got the
loglevel tags; we cleaned them up.
Quoted 6 lines
Quoted 3 lines
want to expand loglevel tags to two digi bits, hope the dmesg/klogd could handle it.
I doubt they'd be written to handle that already.
dmesg util in opensuse 10.3 does support two digi bits loglevel tags.
YH