printk: allow setting DEFAULT_MESSAGE_LEVEL via Kconfig
Subsystems (12)
PATCH 1/1 printk: allow setting DEFAULT_MESSAGE_LEVEL via Kconfig
We've been burned by regressions/bugs which we later realized could have been triaged quicker if only we'd paid closer attention to dmesg. To make it easier to audit dmesg, we'd like to make DEFAULT_MESSAGE_LEVEL Kconfig-settable. That way we can set it to KERN_NOTICE and audit any messages <= KERN_WARNING.
--- kernel/printk.c | 2 +- lib/Kconfig.debug | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-)
kernel/printk.c +1 -1
@@ -59,7 +59,7 @@ void asmlinkage __attribute__((weak)) early_printk(const char *fmt, ...)#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)/* printk's without a loglevel use this.. */ -#define DEFAULT_MESSAGE_LOGLEVEL 4/* KERN_WARNING */ +#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL/* We show everything that is MORE important than this.. */ #define MINIMUM_CONSOLE_LOGLEVEL 1/* Minimum loglevel we let people use */
lib/Kconfig.debug +12 -0
@@ -9,6 +9,18 @@ config PRINTK_TIME operations. This is useful for identifying long delays in kernel startup. +config DEFAULT_MESSAGE_LOGLEVEL + int "Default message log level (1-7)" + range 1 7 + depends on PRINTK + default "4" + help + Default log level for printk statements with no specified priority. + + This was hard-coded to KERN_WARNING since at least 2.6.10 but folks + that are auditing their logs closely may want to set it to a lower + priority. + config ENABLE_WARN_DEPRECATED bool "Enable __deprecated logic" default y
Signature · 1 line
1.7.3.1
Quoted 3 lines · Mandeep Singh Baines
To make it easier to audit dmesg, we'd like to make
DEFAULT_MESSAGE_LEVELKconfig-settable. That way we can set it toKERN_NOTICEand audit any messages <=KERN_WARNING.
Seems sensible, but mightn't it be better to make sure that all printks use a specific KERN_<level> rather than check that printks without a KERN_<level> are emitted at a selectable level?
Quoted 10 lines · Joe Perches
Quoted 3 lines · Mandeep Singh Baines
To make it easier to audit dmesg, we'd like to make
DEFAULT_MESSAGE_LEVELKconfig-settable. That way we can set it toKERN_NOTICEand audit any messages <=KERN_WARNING.Seems sensible, but mightn't it be better to make sure that all printks use a specific KERN_<level> rather than check that printks without a KERN_<level> are emitted at a selectable level?
Can we do both? I was planning sending cleanup patches as well but expected that process to take a while. The simplest thing would to set all these to KERN_WARNING but that's not correct and leaves me back where I started. The correct thing would be to set each printk to an appropriate level. Determining appropriate level will take some discussion (so a long term project).
Quoted 1 line
Quoted 10 lines · Mandeep Singh Baines
Quoted 8 lines · Joe Perches
Quoted 3 lines · Mandeep Singh Baines
To make it easier to audit dmesg, we'd like to make
DEFAULT_MESSAGE_LEVELKconfig-settable. That way we can set it toKERN_NOTICEand audit any messages <=KERN_WARNING.Seems sensible, but mightn't it be better to make sure that all printks use a specific KERN_<level> rather than check that printks without a KERN_<level> are emitted at a selectable level?
Can we do both?
As far as I'm concerned, yes.
Quoted 2 lines
I was planning sending cleanup patches as well but expected that process to take a while.
True.
Perhaps you could do printk()->pr_<level> (dev_<level>/netdev_>level>) conversions as appropriate as well.
Quoted 3 lines
The correct thing would be to set each printk to an appropriate level. Determining appropriate level will take some discussion (so a long term project).
My EDC/ECD is: a long time from now. Maybe.
Quoted 6 lines · Mandeep Singh Baines
We've been burned by regressions/bugs which we later realized could have been triaged quicker if only we'd paid closer attention to dmesg. To make it easier to audit dmesg, we'd like to make
DEFAULT_MESSAGE_LEVELKconfig-settable. That way we can set it toKERN_NOTICEand audit any messages <=KERN_WARNING.
Why? We already have "loglevel=" kernel parameter.
Andrew Morton
maintainerQuoted 38 lines · On Tue, 25 Jan 2011 15:57:00 -0800 Mandeep Singh Baines <[email protected]>…
We've been burned by regressions/bugs which we later realized could have been triaged quicker if only we'd paid closer attention to dmesg. To make it easier to audit dmesg, we'd like to make
DEFAULT_MESSAGE_LEVELKconfig-settable. That way we can set it toKERN_NOTICEand audit any messages <=KERN_WARNING.Signed-off-by Mandeep Singh Baines <[email protected]>--- kernel/printk.c | 2 +- lib/Kconfig.debug | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-)kernel/printk.c +1
-1@@ -59,7 +59,7 @@ void asmlinkage __attribute__((weak)) early_printk(const char *fmt, ...)#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)/* printk's without a loglevel use this.. */ -#define DEFAULT_MESSAGE_LOGLEVEL 4/* KERN_WARNING */ +#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL/* We show everything that is MORE important than this.. */ #define MINIMUM_CONSOLE_LOGLEVEL 1/* Minimum loglevel we let people use */ lib/Kconfig.debug +5
-0@@ -9,6 +9,18 @@ config PRINTK_TIME operations. This is useful for identifying long delays in kernel startup. +config DEFAULT_MESSAGE_LOGLEVEL + int "Default message log level (1-7)" + range 1 7 + depends on PRINTK + default "4"
lib/Kconfig.debug config PRINTK_TIME · line 26
Quoted 10 lines
lib/Kconfig.debug +7
-0+ help + Default log level for printk statements with no specified priority. + + This was hard-coded to KERN_WARNING since at least 2.6.10 but folks + that are auditing their logs closely may want to set it to a lower + priority. + config ENABLE_WARN_DEPRECATED bool "Enable __deprecated logic" default y
I'm a bit surprised that this wasn't already tunable at boot-time and/or at runtime.
I think it's generally superior to be able to tune this sort of thing via kernel boot parameters and/or /proc knobs, rather than requiring a recompile. That might be a problem in this specific case, if we have printks which are occurring before __setup() parsing has completed.
Poeple often complain that they want things settable in Kconfig because for some reason it's all too hard to set the kernel boot command line. Next time someone says this I'll suggest that they fix the problem permanently by implementing a CONFIG_CMDLINE string, which gets inserted into the kernel boot command line at compile time ;)
Quoted 46 lines · On Wed, 26 Jan 2011 14:49:10 -0800 Andrew Morton wrote:
Quoted 43 lines · On Tue, 25 Jan 2011 15:57:00 -0800 Mandeep Singh Baines <[email protected]>…
We've been burned by regressions/bugs which we later realized could have been triaged quicker if only we'd paid closer attention to dmesg. To make it easier to audit dmesg, we'd like to make
DEFAULT_MESSAGE_LEVELKconfig-settable. That way we can set it toKERN_NOTICEand audit any messages <=KERN_WARNING.Signed-off-by Mandeep Singh Baines <[email protected]>--- kernel/printk.c | 2 +- lib/Kconfig.debug | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-)kernel/printk.c +1
-1@@ -59,7 +59,7 @@ void asmlinkage __attribute__((weak)) early_printk(const char *fmt, ...)#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)/* printk's without a loglevel use this.. */ -#define DEFAULT_MESSAGE_LOGLEVEL 4/* KERN_WARNING */ +#define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL/* We show everything that is MORE important than this.. */ #define MINIMUM_CONSOLE_LOGLEVEL 1/* Minimum loglevel we let people use */ lib/Kconfig.debug +10
-0@@ -9,6 +9,18 @@ config PRINTK_TIME operations. This is useful for identifying long delays in kernel startup. +config DEFAULT_MESSAGE_LOGLEVEL + int "Default message log level (1-7)" + range 1 7 + depends on PRINTK + default "4" + help + Default log level for printk statements with no specified priority. + + This was hard-coded to KERN_WARNING since at least 2.6.10 but folks + that are auditing their logs closely may want to set it to a lower
Quoted 8 lines
lib/Kconfig.debug config PRINTK_TIME · line 26
Quoted 5 lines
lib/Kconfig.debug +2
-0+ priority. + config ENABLE_WARN_DEPRECATED bool "Enable __deprecated logic" default yI'm a bit surprised that this wasn't already tunable at boot-time and/or at runtime.
As WANG Cong replied:
Why? We already have "loglevel=" kernel parameter.
Quoted 11 lines
I think it's generally superior to be able to tune this sort of thing via kernel boot parameters and/or /proc knobs, rather than requiring a recompile. That might be a problem in this specific case, if we have printks which are occurring before
__setup()parsing has completed.Poeple often complain that they want things settable in
Kconfigbecause for some reason it's all too hard to set the kernel boot command line. Next time someone says this I'll suggest that they fix the problem permanently by implementing aCONFIG_CMDLINEstring, which gets inserted into the kernel boot command line at compile time ;)
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
Quoted 12 lines · WANG Cong
Quoted 6 lines · Mandeep Singh Baines
We've been burned by regressions/bugs which we later realized could have been triaged quicker if only we'd paid closer attention to dmesg. To make it easier to audit dmesg, we'd like to make
DEFAULT_MESSAGE_LEVELKconfig-settable. That way we can set it toKERN_NOTICEand audit any messages <=KERN_WARNING.Why? We already have "loglevel=" kernel parameter.
loglevel allows you to control which messages go to the console.
DEFAULT_MESSAGE_LEVEL selects the default message levels for printk()s which don't specify a message level.
Most printks()s without a message level aren't really warnings and just create noise
if you're trying to look closely at all warnings. Some of this is just old code but new
printk()s without a message level do get committed from time to time.
Quoted 6 lines
--
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/
Andrew Morton
maintainerQuoted 7 lines · On Wed, 26 Jan 2011 14:57:03 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 2 lines
I'm a bit surprised that this wasn't already tunable at boot-time and/or at runtime.
As WANG Cong replied:
Why? We already have "loglevel=" kernel parameter.
That's different.
Mandeep's patch addresses printks which didn't have a facility level. Longer-term, all these should be fixed, so they have an explicit facility level. I suppose that short-term it would make sense to prefer to blurt these messages onto the console rather than hiding them. Because they might be important. And if they weren't important, they will then irritate enough people to get themselves fixed.
cover Set printk priority level
In reply to Mandeep Singh BainesWe've been burned by regressions/bugs which we later realized could have been triaged quicker if only we'd paid closer attention to dmesg.
This patch series fixes printk()s which appear in the logs of the device I'm currently working on. I'd love to fix all such printks but there are hundreds of files and thousands of LOC affected:
$ find . -name \*.c | xargs fgrep -c "printk(\"" | wc -l 16237 $ find . -name \*.c | xargs fgrep "printk(\"" | wc -l 20745
[PATCH 1/6] mm/page_alloc: use appropriate printk priority level [PATCH 2/6] arch/x86: use appropriate printk priority level [PATCH 3/6] PM: use appropriate printk priority level [PATCH 4/6] TTY: use appropriate printk priority level [PATCH 5/6] fs: use appropriate printk priority level [PATCH 6/6] taskstats: use appropriate printk priority level
cover Set printk priority level
In reply to Mandeep Singh BainesWe've been burned by regressions/bugs which we later realized could have been triaged quicker if only we'd paid closer attention to dmesg.
This patch series fixes printk()s which appear in the logs of the device I'm currently working on. I'd love to fix all such printks but there are hundreds of files and thousands of LOC affected:
$ find . -name \*.c | xargs fgrep -c "printk(\"" | wc -l 16237 $ find . -name \*.c | xargs fgrep "printk(\"" | wc -l 20745
[PATCH 1/6] mm/page_alloc: use appropriate printk priority level [PATCH 2/6] arch/x86: use appropriate printk priority level [PATCH 3/6] PM: use appropriate printk priority level [PATCH 4/6] TTY: use appropriate printk priority level [PATCH 5/6] fs: use appropriate printk priority level [PATCH 6/6] taskstats: use appropriate printk priority level
PATCH 1/6 mm/page_alloc: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- mm/page_alloc.c | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-)
mm/page_alloc.c +15 -12
@@ -3129,14 +3129,14 @@ void build_all_zonelists(void *data)else page_group_by_mobility_disabled =0 ; -printk ("Built %i zonelists in %s order, mobility grouping %s. " -"Total pages: %ld\n" , +printk (KERN_INFO "Built %i zonelists in %s order, mobility grouping %s." +" Total pages: %ld\n" , nr_online_nodes, zonelist_order_name[current_zonelist_order], page_group_by_mobility_disabled ?"off" :"on" , vm_total_pages);#ifdef CONFIG_NUMA -printk ("Policy zone: %s\n" , zone_names[policy_zone]); +printk (KERN_INFO "Policy zone: %s\n" , zone_names[policy_zone]);#endif }
@@ -4700,33 +4700,36 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)find_zone_movable_pfns_for_nodes (zone_movable_pfn);/* Print out the zone ranges */ -printk ("Zone PFN ranges:\n" ); +printk (KERN_INFO "Zone PFN ranges:\n" );for (i =0 ; i <MAX_NR_ZONES ; i++) {if (i ==ZONE_MOVABLE )continue ; -printk (" %-8s " , zone_names[i]); +printk (KERN_INFO " %-8s " , zone_names[i]);if (arch_zone_lowest_possible_pfn[i] == arch_zone_highest_possible_pfn[i])printk ("empty\n" );else -printk ("%0#10lx -> %0#10lx\n" , +printk (KERN_INFO "%0#10lx -> %0#10lx\n" , arch_zone_lowest_possible_pfn[i], arch_zone_highest_possible_pfn[i]); }/* Print out the PFNs ZONE_MOVABLE begins at in each node */ -printk ("Movable zone start PFN for each node\n" ); +printk (KERN_INFO "Movable zone start PFN for each node\n" );for (i =0 ; i <MAX_NUMNODES ; i++) {if (zone_movable_pfn[i]) -printk (" Node %d: %lu\n" , i, zone_movable_pfn[i]); +printk (KERN_INFO " Node %d: %lu\n" , i, + zone_movable_pfn[i]); }/* Print out the early_node_map[] */ -printk ("early_node_map[%d] active PFN ranges\n" , nr_nodemap_entries); +printk (KERN_INFO "early_node_map[%d] active PFN ranges\n" , + nr_nodemap_entries);for (i =0 ; i < nr_nodemap_entries; i++) -printk (" %3d: %0#10lx -> %0#10lx\n" , early_node_map[i].nid, - early_node_map[i].start_pfn, - early_node_map[i].end_pfn); +printk (KERN_INFO " %3d: %0#10lx -> %0#10lx\n" , + early_node_map[i].nid, + early_node_map[i].start_pfn, + early_node_map[i].end_pfn);/* Initialise every node */ mminit_verify_pageflags_layout ();
Signature · 8 lines
1.7.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/6 mm/page_alloc: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- mm/page_alloc.c | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-)
mm/page_alloc.c +15 -12
@@ -3129,14 +3129,14 @@ void build_all_zonelists(void *data)else page_group_by_mobility_disabled =0 ; -printk ("Built %i zonelists in %s order, mobility grouping %s. " -"Total pages: %ld\n" , +printk (KERN_INFO "Built %i zonelists in %s order, mobility grouping %s." +" Total pages: %ld\n" , nr_online_nodes, zonelist_order_name[current_zonelist_order], page_group_by_mobility_disabled ?"off" :"on" , vm_total_pages);#ifdef CONFIG_NUMA -printk ("Policy zone: %s\n" , zone_names[policy_zone]); +printk (KERN_INFO "Policy zone: %s\n" , zone_names[policy_zone]);#endif }
@@ -4700,33 +4700,36 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)find_zone_movable_pfns_for_nodes (zone_movable_pfn);/* Print out the zone ranges */ -printk ("Zone PFN ranges:\n" ); +printk (KERN_INFO "Zone PFN ranges:\n" );for (i =0 ; i <MAX_NR_ZONES ; i++) {if (i ==ZONE_MOVABLE )continue ; -printk (" %-8s " , zone_names[i]); +printk (KERN_INFO " %-8s " , zone_names[i]);if (arch_zone_lowest_possible_pfn[i] == arch_zone_highest_possible_pfn[i])printk ("empty\n" );else -printk ("%0#10lx -> %0#10lx\n" , +printk (KERN_INFO "%0#10lx -> %0#10lx\n" , arch_zone_lowest_possible_pfn[i], arch_zone_highest_possible_pfn[i]); }/* Print out the PFNs ZONE_MOVABLE begins at in each node */ -printk ("Movable zone start PFN for each node\n" ); +printk (KERN_INFO "Movable zone start PFN for each node\n" );for (i =0 ; i <MAX_NUMNODES ; i++) {if (zone_movable_pfn[i]) -printk (" Node %d: %lu\n" , i, zone_movable_pfn[i]); +printk (KERN_INFO " Node %d: %lu\n" , i, + zone_movable_pfn[i]); }/* Print out the early_node_map[] */ -printk ("early_node_map[%d] active PFN ranges\n" , nr_nodemap_entries); +printk (KERN_INFO "early_node_map[%d] active PFN ranges\n" , + nr_nodemap_entries);for (i =0 ; i < nr_nodemap_entries; i++) -printk (" %3d: %0#10lx -> %0#10lx\n" , early_node_map[i].nid, - early_node_map[i].start_pfn, - early_node_map[i].end_pfn); +printk (KERN_INFO " %3d: %0#10lx -> %0#10lx\n" , + early_node_map[i].nid, + early_node_map[i].start_pfn, + early_node_map[i].end_pfn);/* Initialise every node */ mminit_verify_pageflags_layout ();
Signature · 1 line
1.7.3.1
PATCH 2/6 arch/x86: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- arch/x86/kernel/tsc.c | 9 +++++---- arch/x86/platform/efi/efi.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-)
arch/x86/kernel/tsc.c +5 -4
@@ -373,7 +373,7 @@ static unsigned long quick_pit_calibrate(void) goto success; } } -printk ("Fast TSC calibration failed\n" ); +printk (KERN_WARNING "Fast TSC calibration failed\n" );return 0 ; success:
@@ -395,7 +395,7 @@ success: delta += (long )(d2 - d1)/2 ; delta *=PIT_TICK_RATE ;do_div (delta, i*256 *1000 ); -printk ("Fast TSC calibration using PIT\n" ); +printk (KERN_INFO "Fast TSC calibration using PIT\n" );return delta; }
@@ -518,7 +518,8 @@ unsigned long native_calibrate_tsc(void)/* We don't have an alternative source, disable TSC */ if (!hpet && !ref1 && !ref2) { -printk ("TSC: No reference (HPET/PMTIMER) available\n" ); +printk (KERN_WARNING +"TSC: No reference (HPET/PMTIMER) available\n" );return 0 ; }
@@ -1002,7 +1003,7 @@ void __init tsc_init(void)return ; } -printk ("Detected %lu.%03lu MHz processor.\n" , +printk (KERN_INFO "Detected %lu.%03lu MHz processor.\n" , (unsigned long )cpu_khz /1000 , (unsigned long )cpu_khz %1000 );
arch/x86/platform/efi/efi.c +1 -1
@@ -376,7 +376,7 @@ void __init efi_init(void)if (config_tables ==NULL )printk (KERN_ERR "Could not map EFI Configuration Table!\n" ); -printk (KERN_INFO ); +printk (KERN_INFO " " );for (i =0 ; i < efi.systab->nr_tables; i++) {if (!efi_guidcmp (config_tables[i].guid,MPS_TABLE_GUID )) { efi.mps = config_tables[i].table;
Signature · 8 lines
1.7.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/6 arch/x86: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- arch/x86/kernel/tsc.c | 9 +++++---- arch/x86/platform/efi/efi.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-)
arch/x86/kernel/tsc.c +5 -4
@@ -373,7 +373,7 @@ static unsigned long quick_pit_calibrate(void) goto success; } } -printk ("Fast TSC calibration failed\n" ); +printk (KERN_WARNING "Fast TSC calibration failed\n" );return 0 ; success:
@@ -395,7 +395,7 @@ success: delta += (long )(d2 - d1)/2 ; delta *=PIT_TICK_RATE ;do_div (delta, i*256 *1000 ); -printk ("Fast TSC calibration using PIT\n" ); +printk (KERN_INFO "Fast TSC calibration using PIT\n" );return delta; }
@@ -518,7 +518,8 @@ unsigned long native_calibrate_tsc(void)/* We don't have an alternative source, disable TSC */ if (!hpet && !ref1 && !ref2) { -printk ("TSC: No reference (HPET/PMTIMER) available\n" ); +printk (KERN_WARNING +"TSC: No reference (HPET/PMTIMER) available\n" );return 0 ; }
@@ -1002,7 +1003,7 @@ void __init tsc_init(void)return ; } -printk ("Detected %lu.%03lu MHz processor.\n" , +printk (KERN_INFO "Detected %lu.%03lu MHz processor.\n" , (unsigned long )cpu_khz /1000 , (unsigned long )cpu_khz %1000 );
arch/x86/platform/efi/efi.c +1 -1
@@ -376,7 +376,7 @@ void __init efi_init(void)if (config_tables ==NULL )printk (KERN_ERR "Could not map EFI Configuration Table!\n" ); -printk (KERN_INFO ); +printk (KERN_INFO " " );for (i =0 ; i < efi.systab->nr_tables; i++) {if (!efi_guidcmp (config_tables[i].guid,MPS_TABLE_GUID )) { efi.mps = config_tables[i].table;
Signature · 1 line
1.7.3.1
PATCH 3/6 PM: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
Changed these messages to pr_info. But might be more appropriate as pr_debug.
--- drivers/base/power/trace.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/base/power/trace.c +3 -3
@@ -112,7 +112,7 @@ static unsigned int read_magic_time(void)unsigned int val;get_rtc_time (&time); -printk ("Time: %2d:%02d:%02d Date: %02d/%02d/%02d\n" , +pr_info ("Time: %2d:%02d:%02d Date: %02d/%02d/%02d\n" , time.tm_hour, time.tm_min, time.tm_sec, time.tm_mon +1 , time.tm_mday, time.tm_year %100 ); val = time.tm_year;/* 100 years */
@@ -179,7 +179,7 @@ static int show_file_hash(unsigned int value)unsigned int hash =hash_string (lineno, file,FILEHASH );if (hash != value)continue ; -printk (" hash matches %s:%u\n" , file, lineno); +pr_info (" hash matches %s:%u\n" , file, lineno); match++; }return match;
@@ -255,7 +255,7 @@ static int late_resume_init(void) val = val /FILEHASH ; dev = val/* % DEVHASH */ ; -printk (" Magic number: %d:%d:%d\n" , user, file, dev); +pr_info (" Magic number: %d:%d:%d\n" , user, file, dev);show_file_hash (file);show_dev_hash (dev);return 0 ;
Signature · 8 lines
1.7.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/6 PM: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
Changed these messages to pr_info. But might be more appropriate as pr_debug.
--- drivers/base/power/trace.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/base/power/trace.c +3 -3
@@ -112,7 +112,7 @@ static unsigned int read_magic_time(void)unsigned int val;get_rtc_time (&time); -printk ("Time: %2d:%02d:%02d Date: %02d/%02d/%02d\n" , +pr_info ("Time: %2d:%02d:%02d Date: %02d/%02d/%02d\n" , time.tm_hour, time.tm_min, time.tm_sec, time.tm_mon +1 , time.tm_mday, time.tm_year %100 ); val = time.tm_year;/* 100 years */
@@ -179,7 +179,7 @@ static int show_file_hash(unsigned int value)unsigned int hash =hash_string (lineno, file,FILEHASH );if (hash != value)continue ; -printk (" hash matches %s:%u\n" , file, lineno); +pr_info (" hash matches %s:%u\n" , file, lineno); match++; }return match;
@@ -255,7 +255,7 @@ static int late_resume_init(void) val = val /FILEHASH ; dev = val/* % DEVHASH */ ; -printk (" Magic number: %d:%d:%d\n" , user, file, dev); +pr_info (" Magic number: %d:%d:%d\n" , user, file, dev);show_file_hash (file);show_dev_hash (dev);return 0 ;
Signature · 1 line
1.7.3.1
PATCH 4/6 TTY: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- drivers/tty/vt/vt.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/tty/vt/vt.c +5 -4
@@ -2158,7 +2158,7 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co currcons = vc->vc_num;if (!vc_cons_allocated (currcons)) {/* could this happen? */ -printk_once ("con_write: tty %d not allocated\n" , currcons+1 ); +printk_once (KERN_WARNING "con_write: tty %d not allocated\n" , currcons+1 );release_console_sem ();return 0 ; }
@@ -2940,7 +2940,7 @@ static int __init con_init(void)gotoxy (vc, vc->vc_x, vc->vc_y);csi_J (vc,0 );update_screen (vc); -printk ("Console: %s %s %dx%d" , +pr_info ("Console: %s %s %dx%d" , vc->vc_can_do_color ?"colour" :"mono" , display_desc, vc->vc_cols, vc->vc_rows); printable =1 ;
@@ -3103,7 +3103,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last,clear_buffer_attributes (vc); } -printk ("Console: switching " ); +pr_info ("Console: switching " );if (!deflt)printk ("consoles %d-%d " , first+1 , last+1 );if (j >=0 ) {
@@ -3804,7 +3804,8 @@ void do_unblank_screen(int leaving_gfx)return ;if (!vc_cons_allocated (fg_console)) {/* impossible */ -printk ("unblank_screen: tty %d not allocated ??\n" , fg_console+1 ); +pr_warning ("unblank_screen: tty %d not allocated ??\n" , + fg_console+1 );return ; } vc = vc_cons[fg_console].d;
Signature · 8 lines
1.7.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/6 TTY: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- drivers/tty/vt/vt.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/tty/vt/vt.c +5 -4
@@ -2158,7 +2158,7 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co currcons = vc->vc_num;if (!vc_cons_allocated (currcons)) {/* could this happen? */ -printk_once ("con_write: tty %d not allocated\n" , currcons+1 ); +printk_once (KERN_WARNING "con_write: tty %d not allocated\n" , currcons+1 );release_console_sem ();return 0 ; }
@@ -2940,7 +2940,7 @@ static int __init con_init(void)gotoxy (vc, vc->vc_x, vc->vc_y);csi_J (vc,0 );update_screen (vc); -printk ("Console: %s %s %dx%d" , +pr_info ("Console: %s %s %dx%d" , vc->vc_can_do_color ?"colour" :"mono" , display_desc, vc->vc_cols, vc->vc_rows); printable =1 ;
@@ -3103,7 +3103,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last,clear_buffer_attributes (vc); } -printk ("Console: switching " ); +pr_info ("Console: switching " );if (!deflt)printk ("consoles %d-%d " , first+1 , last+1 );if (j >=0 ) {
@@ -3804,7 +3804,8 @@ void do_unblank_screen(int leaving_gfx)return ;if (!vc_cons_allocated (fg_console)) {/* impossible */ -printk ("unblank_screen: tty %d not allocated ??\n" , fg_console+1 ); +pr_warning ("unblank_screen: tty %d not allocated ??\n" , + fg_console+1 );return ; } vc = vc_cons[fg_console].d;
Signature · 1 line
1.7.3.1
PATCH 5/6 fs: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- fs/bio.c | 2 +- fs/namespace.c | 2 +- init/do_mounts.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-)
fs/bio.c +1 -1
@@ -111,7 +111,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size)if (!slab) goto out_unlock; -printk ("bio: create slab <%s> at %d\n" , bslab->name, entry); +printk (KERN_INFO "bio: create slab <%s> at %d\n" , bslab->name, entry); bslab->slab = slab; bslab->slab_ref =1 ; bslab->slab_size = sz;
fs/namespace.c +1 -1
@@ -2594,7 +2594,7 @@ void __init mnt_init(void)if (!mount_hashtable)panic ("Failed to allocate mount hash table\n" ); -printk ("Mount-cache hash table entries: %lu\n" ,HASH_SIZE ); +printk (KERN_INFO "Mount-cache hash table entries: %lu\n" ,HASH_SIZE );for (u =0 ; u <HASH_SIZE ; u++)INIT_LIST_HEAD (&mount_hashtable[u]);
init/do_mounts.c +2 -1
@@ -293,7 +293,8 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data)sys_chdir ((const char __user __force *)"/root" );ROOT_DEV = current->fs->pwd.mnt->mnt_sb->s_dev; -printk ("VFS: Mounted root (%s filesystem)%s on device %u:%u.\n" , +printk (KERN_INFO +"VFS: Mounted root (%s filesystem)%s on device %u:%u.\n" , current->fs->pwd.mnt->mnt_sb->s_type->name, current->fs->pwd.mnt->mnt_sb->s_flags &MS_RDONLY ?" readonly" :"" ,MAJOR (ROOT_DEV ),MINOR (ROOT_DEV ));
Signature · 8 lines
1.7.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 5/6 fs: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- fs/bio.c | 2 +- fs/namespace.c | 2 +- init/do_mounts.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-)
fs/bio.c +1 -1
@@ -111,7 +111,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size)if (!slab) goto out_unlock; -printk ("bio: create slab <%s> at %d\n" , bslab->name, entry); +printk (KERN_INFO "bio: create slab <%s> at %d\n" , bslab->name, entry); bslab->slab = slab; bslab->slab_ref =1 ; bslab->slab_size = sz;
fs/namespace.c +1 -1
@@ -2594,7 +2594,7 @@ void __init mnt_init(void)if (!mount_hashtable)panic ("Failed to allocate mount hash table\n" ); -printk ("Mount-cache hash table entries: %lu\n" ,HASH_SIZE ); +printk (KERN_INFO "Mount-cache hash table entries: %lu\n" ,HASH_SIZE );for (u =0 ; u <HASH_SIZE ; u++)INIT_LIST_HEAD (&mount_hashtable[u]);
init/do_mounts.c +2 -1
@@ -293,7 +293,8 @@ static int __init do_mount_root(char *name, char *fs, int flags, void *data)sys_chdir ((const char __user __force *)"/root" );ROOT_DEV = current->fs->pwd.mnt->mnt_sb->s_dev; -printk ("VFS: Mounted root (%s filesystem)%s on device %u:%u.\n" , +printk (KERN_INFO +"VFS: Mounted root (%s filesystem)%s on device %u:%u.\n" , current->fs->pwd.mnt->mnt_sb->s_type->name, current->fs->pwd.mnt->mnt_sb->s_flags &MS_RDONLY ?" readonly" :"" ,MAJOR (ROOT_DEV ),MINOR (ROOT_DEV ));
Signature · 1 line
1.7.3.1
PATCH 6/6 taskstats: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- kernel/taskstats.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/taskstats.c +1 -1
@@ -685,7 +685,7 @@ static int __init taskstats_init(void) goto err_cgroup_ops; family_registered =1 ; -printk ("registered taskstats version %d\n" ,TASKSTATS_GENL_VERSION ); +pr_info ("registered taskstats version %d\n" ,TASKSTATS_GENL_VERSION );return 0 ; err_cgroup_ops:genl_unregister_ops (&family, &taskstats_ops);
Signature · 8 lines
1.7.3.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 6/6 taskstats: use appropriate printk priority level
In reply to Mandeep Singh Bainesprintk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- kernel/taskstats.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/taskstats.c +1 -1
@@ -685,7 +685,7 @@ static int __init taskstats_init(void) goto err_cgroup_ops; family_registered =1 ; -printk ("registered taskstats version %d\n" ,TASKSTATS_GENL_VERSION ); +pr_info ("registered taskstats version %d\n" ,TASKSTATS_GENL_VERSION );return 0 ; err_cgroup_ops:genl_unregister_ops (&family, &taskstats_ops);
Signature · 1 line
1.7.3.1
Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level
In reply to Mandeep Singh BainesQuoted 12 lines · Mandeep Singh Baines
printk()s without a priority level default to
KERN_WARNING. To reduce noise atKERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.Signed-off-by Mandeep Singh Baines <[email protected]>---
mm/page_alloc.c +0
-0@@ -4700,33 +4700,36 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)find_zone_movable_pfns_for_nodes (zone_movable_pfn);/* Print out the zone ranges */
mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4710
Quoted 10 lines
mm/page_alloc.c +2
-2-printk ("Zone PFN ranges:\n" ); +printk (KERN_INFO "Zone PFN ranges:\n" );for (i =0 ; i <MAX_NR_ZONES ; i++) {if (i ==ZONE_MOVABLE )continue ; -printk (" %-8s " , zone_names[i]); +printk (KERN_INFO " %-8s " , zone_names[i]);if (arch_zone_lowest_possible_pfn[i] == arch_zone_highest_possible_pfn[i])printk ("empty\n" );
Should be printk(KERN_CONT ... (or pr_cont).
mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4714
Quoted 5 lines
mm/page_alloc.c +1
-1else -printk ("%0#10lx -> %0#10lx\n" , +printk (KERN_INFO "%0#10lx -> %0#10lx\n" , arch_zone_lowest_possible_pfn[i], arch_zone_highest_possible_pfn[i]);
The printk above doesn't have a trailing newline so this should be printk(KERN_CONT ...
There are a couple of other places in this patch series that also need to be fixed in a similar manner.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level
In reply to Mandeep Singh BainesQuoted 12 lines · Mandeep Singh Baines
printk()s without a priority level default to
KERN_WARNING. To reduce noise atKERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.Signed-off-by Mandeep Singh Baines <[email protected]>---
mm/page_alloc.c +0
-0@@ -4700,33 +4700,36 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)find_zone_movable_pfns_for_nodes (zone_movable_pfn);/* Print out the zone ranges */
mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4710
Quoted 10 lines
mm/page_alloc.c +2
-2-printk ("Zone PFN ranges:\n" ); +printk (KERN_INFO "Zone PFN ranges:\n" );for (i =0 ; i <MAX_NR_ZONES ; i++) {if (i ==ZONE_MOVABLE )continue ; -printk (" %-8s " , zone_names[i]); +printk (KERN_INFO " %-8s " , zone_names[i]);if (arch_zone_lowest_possible_pfn[i] == arch_zone_highest_possible_pfn[i])printk ("empty\n" );
Should be printk(KERN_CONT ... (or pr_cont).
mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4714
Quoted 5 lines
mm/page_alloc.c +1
-1else -printk ("%0#10lx -> %0#10lx\n" , +printk (KERN_INFO "%0#10lx -> %0#10lx\n" , arch_zone_lowest_possible_pfn[i], arch_zone_highest_possible_pfn[i]);
The printk above doesn't have a trailing newline so this should be printk(KERN_CONT ...
There are a couple of other places in this patch series that also need to be fixed in a similar manner.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level
In reply to Ryan MallonQuoted 35 lines · Ryan Mallon
Quoted 12 lines · Mandeep Singh Baines
printk()s without a priority level default to
KERN_WARNING. To reduce noise atKERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.Signed-off-by Mandeep Singh Baines <[email protected]>---
mm/page_alloc.c +0
-0@@ -4700,33 +4700,36 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)find_zone_movable_pfns_for_nodes (zone_movable_pfn);/* Print out the zone ranges */ mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4710
Quoted 10 lines
mm/page_alloc.c +2
-2-printk ("Zone PFN ranges:\n" ); +printk (KERN_INFO "Zone PFN ranges:\n" );for (i =0 ; i <MAX_NR_ZONES ; i++) {if (i ==ZONE_MOVABLE )continue ; -printk (" %-8s " , zone_names[i]); +printk (KERN_INFO " %-8s " , zone_names[i]);if (arch_zone_lowest_possible_pfn[i] == arch_zone_highest_possible_pfn[i])printk ("empty\n" );Should be printk(KERN_CONT ... (or
pr_cont).mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4714
Quoted 5 lines
mm/page_alloc.c +1
-1else -printk ("%0#10lx -> %0#10lx\n" , +printk (KERN_INFO "%0#10lx -> %0#10lx\n" , arch_zone_lowest_possible_pfn[i], arch_zone_highest_possible_pfn[i]);The printk above doesn't have a trailing newline so this should be printk(KERN_CONT ...
Quoted 3 lines
There are a couple of other places in this patch series that also need to be fixed in a similar manner.
D'oh. Good catch;)
The KERN_INFO here was unintentional. I had intended to leave it out. The code I was looking at as a reference was just omitting KERN_ for continuations. But I take it that the convention is to use KERN_CONT. I'll fixup the patch series to use that.
I tried to use pr_ wherever the file was already using it or where I was changing all printk()s. For files with many printk()s I just continued using printk() to keep the patch small and also to avoid mixing printk with pr_. However, if it is preferrable, I'm happy to replace all printk()s with pr_ in the files I touch in the series.
Quoted 10 lines
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level
In reply to Ryan MallonQuoted 35 lines · Ryan Mallon
Quoted 12 lines · Mandeep Singh Baines
printk()s without a priority level default to
KERN_WARNING. To reduce noise atKERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.Signed-off-by Mandeep Singh Baines <[email protected]>---
mm/page_alloc.c +0
-0@@ -4700,33 +4700,36 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)find_zone_movable_pfns_for_nodes (zone_movable_pfn);/* Print out the zone ranges */ mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4710
Quoted 10 lines
mm/page_alloc.c +2
-2-printk ("Zone PFN ranges:\n" ); +printk (KERN_INFO "Zone PFN ranges:\n" );for (i =0 ; i <MAX_NR_ZONES ; i++) {if (i ==ZONE_MOVABLE )continue ; -printk (" %-8s " , zone_names[i]); +printk (KERN_INFO " %-8s " , zone_names[i]);if (arch_zone_lowest_possible_pfn[i] == arch_zone_highest_possible_pfn[i])printk ("empty\n" );Should be printk(KERN_CONT ... (or
pr_cont).mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4714
Quoted 5 lines
mm/page_alloc.c +1
-1else -printk ("%0#10lx -> %0#10lx\n" , +printk (KERN_INFO "%0#10lx -> %0#10lx\n" , arch_zone_lowest_possible_pfn[i], arch_zone_highest_possible_pfn[i]);The printk above doesn't have a trailing newline so this should be printk(KERN_CONT ...
Quoted 3 lines
There are a couple of other places in this patch series that also need to be fixed in a similar manner.
D'oh. Good catch;)
The KERN_INFO here was unintentional. I had intended to leave it out. The code I was looking at as a reference was just omitting KERN_ for continuations. But I take it that the convention is to use KERN_CONT. I'll fixup the patch series to use that.
I tried to use pr_ wherever the file was already using it or where I was changing all printk()s. For files with many printk()s I just continued using printk() to keep the patch small and also to avoid mixing printk with pr_. However, if it is preferrable, I'm happy to replace all printk()s with pr_ in the files I touch in the series.
Quoted 10 lines
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Quoted 12 lines · Mandeep Baines
Quoted 10 lines · WANG Cong
Quoted 7 lines · Mandeep Singh Baines
We've been burned by regressions/bugs which we later realized could have been triaged quicker if only we'd paid closer attention to dmesg. To make it easier to audit dmesg, we'd like to make
DEFAULT_MESSAGE_LEVELKconfig-settable. That way we can set it toKERN_NOTICEand audit any messages <=KERN_WARNING.
Quoted 7 lines
Quoted 3 lines
Why? We already have "loglevel=" kernel parameter.
loglevel allows you to control which messages go to the console.
DEFAULT_MESSAGE_LEVELselects the default message levels for printk()s which don't specify a message level.
I think you should fix them instead.
Quoted 7 lines
Most printks()s without a message level aren't really warnings and just create noise
if you're trying to look closely at all warnings. Some of this is just old code but new
printk()s without a message level do get committed from time to time.
IIRC, checkpatch.pl will complain about this.
Re: [PATCH v1 0/6] Set printk priority level
In reply to Mandeep Singh BainesQuoted 10 lines · Mandeep Singh Baines
We've been burned by regressions/bugs which we later realized could have been triaged quicker if only we'd paid closer attention to dmesg.
This patch series fixes printk()s which appear in the logs of the device I'm currently working on. I'd love to fix all such printks but there are hundreds of files and thousands of LOC affected:
$ find . -name \*.c | xargs fgrep -c "printk(\"" | wc -l 16237 $ find . -name \*.c | xargs fgrep "printk(\"" | wc -l 20745
Yes, this is the right approach, every printk should have a specified level.
Thanks.
Quoted 11 lines · Andrew Morton
Quoted 7 lines · On Wed, 26 Jan 2011 14:57:03 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 2 lines
I'm a bit surprised that this wasn't already tunable at boot-time and/or at runtime.
As WANG Cong replied:
Why? We already have "loglevel=" kernel parameter.
Quoted 8 lines
That's different.
Mandeep's patch addresses printks which didn't have a facility level. Longer-term, all these should be fixed, so they have an explicit facility level. I suppose that short-term it would make sense to prefer to blurt these messages onto the console rather than hiding them. Because they might be important. And if they weren't important, they will then irritate enough people to get themselves fixed.
Yeah, agreed. Actually checkpatch.pl will complain if a patch contains a printk without KERN_*, this somewhat stops us having more printk's without KERN_*.
Thanks.
Quoted 7 lines · Andrew Morton
Quoted 4 lines · On Wed, 26 Jan 2011 14:57:03 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 2 lines
I'm a bit surprised that this wasn't already tunable at boot-time and/or at runtime.
Quoted 7 lines
Quoted 3 lines
As WANG Cong replied:
Why? We already have "loglevel=" kernel parameter.
That's different.
Mandeep's patch addresses printks which didn't have a facility level.
For those, we have ignore_loglevel kernel parameter.
Quoted 10 lines · Alexey Dobriyan
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Wed, 26 Jan 2011 14:57:03 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 2 lines
I'm a bit surprised that this wasn't already tunable at boot-time and/or at runtime.
As WANG Cong replied:
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Why? We already have "loglevel=" kernel parameter.
That's different.
Mandeep's patch addresses printks which didn't have a facility level.
For those, we have
ignore_loglevelkernel parameter.
That's a little different. ignore_loglevel will print ALL kernel messages to the console. What we would like to do is look at all messages that are KERN_WARNING (and higher in priority) very closely. Bugs lie there;) Problem is that DEFAULT_MESSAGE_LEVEL is KERN_WARNING so there is too much noise at KERN_WARNING. So we'd like to be able to set DEFAULT_MESSAGE_LEVEL (default_message_loglevel) to something lower in, priority, at boot or earlier. You can set it via /proc/sys/kernel/printk (takes an int_vec) but that's too late. A ton of stuff has already been logged by the time we're able to change a sysctl.
Our plan is to whitelist any KERN_WARNING messages we know are OK and flag any new KERN_WARNING messages. We're hoping this will help us cut down on regressions. We've been burned in the past where we caused a regression which tooks weeks to locate and triage only to later learn that there was a new KERN_WARNING that if we hadn't ignored would have caught the bug much much earlier.
Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level
In reply to Mandeep Singh BainesQuoted 40 lines · Mandeep Singh Baines
Quoted 35 lines · Ryan Mallon
Quoted 12 lines · Mandeep Singh Baines
printk()s without a priority level default to
KERN_WARNING. To reduce noise atKERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.Signed-off-by Mandeep Singh Baines <[email protected]>---
mm/page_alloc.c +0
-0@@ -4700,33 +4700,36 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)find_zone_movable_pfns_for_nodes (zone_movable_pfn);/* Print out the zone ranges */ mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4710
Quoted 10 lines
mm/page_alloc.c +2
-2-printk ("Zone PFN ranges:\n" ); +printk (KERN_INFO "Zone PFN ranges:\n" );for (i =0 ; i <MAX_NR_ZONES ; i++) {if (i ==ZONE_MOVABLE )continue ; -printk (" %-8s " , zone_names[i]); +printk (KERN_INFO " %-8s " , zone_names[i]);if (arch_zone_lowest_possible_pfn[i] == arch_zone_highest_possible_pfn[i])printk ("empty\n" );Should be printk(KERN_CONT ... (or
pr_cont).mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4714
Quoted 5 lines
mm/page_alloc.c +1
-1else -printk ("%0#10lx -> %0#10lx\n" , +printk (KERN_INFO "%0#10lx -> %0#10lx\n" , arch_zone_lowest_possible_pfn[i], arch_zone_highest_possible_pfn[i]);The printk above doesn't have a trailing newline so this should be printk(KERN_CONT ...
Quoted 3 lines
There are a couple of other places in this patch series that also need to be fixed in a similar manner.
Quoted 6 lines
D'oh. Good catch;)
The
KERN_INFOhere was unintentional. I had intended to leave it out. The code I was looking at as a reference was just omittingKERN_for continuations. But I take it that the convention is to useKERN_CONT. I'll fixup the patch series to use that.
I think in general it is nicer to use KERN_CONT because it explicitly shows that there is a printk somewhere above with no trailing newline.
Note that include/linux/printk.h has this to say about KERN_CONT:
/*
* Annotation for a "continued" line of log printout (only done after a
* line that had no enclosing \n). Only to be used by core/arch code
* during early bootup (a continued line is not SMP-safe otherwise). */
I'm guessing that the above is safe, but if you are fixing printks up then it would be good to check that places using continued lines are safe.
Quoted 5 lines
I tried to use
pr_wherever the file was already using it or where I was changing all printk()s. For files with many printk()s I just continued usingprintk()to keep the patch small and also to avoid mixing printk withpr_. However, if it is preferrable, I'm happy to replace all printk()s withpr_in the files I touch in the series.
I'm not sure what the policy on changing printk to the pr_ variants is. Cc'ed Joe Perches who knows more about such things.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level
In reply to Mandeep Singh BainesQuoted 40 lines · Mandeep Singh Baines
Quoted 35 lines · Ryan Mallon
Quoted 12 lines · Mandeep Singh Baines
printk()s without a priority level default to
KERN_WARNING. To reduce noise atKERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.Signed-off-by Mandeep Singh Baines <[email protected]>---
mm/page_alloc.c +0
-0@@ -4700,33 +4700,36 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn)find_zone_movable_pfns_for_nodes (zone_movable_pfn);/* Print out the zone ranges */ mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4710
Quoted 10 lines
mm/page_alloc.c +2
-2-printk ("Zone PFN ranges:\n" ); +printk (KERN_INFO "Zone PFN ranges:\n" );for (i =0 ; i <MAX_NR_ZONES ; i++) {if (i ==ZONE_MOVABLE )continue ; -printk (" %-8s " , zone_names[i]); +printk (KERN_INFO " %-8s " , zone_names[i]);if (arch_zone_lowest_possible_pfn[i] == arch_zone_highest_possible_pfn[i])printk ("empty\n" );Should be printk(KERN_CONT ... (or
pr_cont).mm/page_alloc.c void __init free_area_init_nodes(unsigned long *max_zone_pfn) · line 4714
Quoted 5 lines
mm/page_alloc.c +1
-1else -printk ("%0#10lx -> %0#10lx\n" , +printk (KERN_INFO "%0#10lx -> %0#10lx\n" , arch_zone_lowest_possible_pfn[i], arch_zone_highest_possible_pfn[i]);The printk above doesn't have a trailing newline so this should be printk(KERN_CONT ...
Quoted 3 lines
There are a couple of other places in this patch series that also need to be fixed in a similar manner.
Quoted 6 lines
D'oh. Good catch;)
The
KERN_INFOhere was unintentional. I had intended to leave it out. The code I was looking at as a reference was just omittingKERN_for continuations. But I take it that the convention is to useKERN_CONT. I'll fixup the patch series to use that.
I think in general it is nicer to use KERN_CONT because it explicitly shows that there is a printk somewhere above with no trailing newline.
Note that include/linux/printk.h has this to say about KERN_CONT:
/*
* Annotation for a "continued" line of log printout (only done after a
* line that had no enclosing \n). Only to be used by core/arch code
* during early bootup (a continued line is not SMP-safe otherwise). */
I'm guessing that the above is safe, but if you are fixing printks up then it would be good to check that places using continued lines are safe.
Quoted 5 lines
I tried to use
pr_wherever the file was already using it or where I was changing all printk()s. For files with many printk()s I just continued usingprintk()to keep the patch small and also to avoid mixing printk withpr_. However, if it is preferrable, I'm happy to replace all printk()s withpr_in the files I touch in the series.
I'm not sure what the policy on changing printk to the pr_ variants is. Cc'ed Joe Perches who knows more about such things.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Quoted 19 lines · Mandeep Singh Baines
Quoted 10 lines · Alexey Dobriyan
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Wed, 26 Jan 2011 14:57:03 -0800 Randy Dunlap <[email protected]> wrote:
Quoted 2 lines
I'm a bit surprised that this wasn't already tunable at boot-time and/or at runtime.
As WANG Cong replied:
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Why? We already have "loglevel=" kernel parameter.
That's different.
Mandeep's patch addresses printks which didn't have a facility level.
For those, we have
ignore_loglevelkernel parameter.
Quoted 9 lines
That's a little different.
ignore_loglevelwill print ALL kernel messages to the console. What we would like to do is look at all messages that areKERN_WARNING(and higher in priority) very closely. Bugs lie there;) Problem is thatDEFAULT_MESSAGE_LEVELisKERN_WARNINGso there is too much noise atKERN_WARNING. So we'd like to be able to setDEFAULT_MESSAGE_LEVEL(default_message_loglevel) to something lower in, priority, at boot or earlier. You can set it via/proc/sys/kernel/printk(takes anint_vec) but that's too late. A ton of stuff has already been logged by the time we're able to change a sysctl.
Why not make printk prefix messages that have no log level with "[NO_LOG_LEVEL]" or similar? That way the can easily be grepped out, and it provides and incentive for people to fix them :-).
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Quoted 3 lines · Ryan Mallon
Why not make printk prefix messages that have no log level with "[
NO_LOG_LEVEL]" or similar? That way the can easily be grepped out, and it provides and incentive for people to fix them :-).
Because printk("foo"); ... printk("\n"); is legit.
Quoted 6 lines · Alexey Dobriyan
Quoted 3 lines · Ryan Mallon
Why not make printk prefix messages that have no log level with "[
NO_LOG_LEVEL]" or similar? That way the can easily be grepped out, and it provides and incentive for people to fix them :-).Because
printk("foo"); ...printk("\n"); is legit.
It should be fixed to KERN_CONT should it not?
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St [email protected] PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
Rafael J. Wysocki
AppliedRe: [PATCH 3/6] PM: use appropriate printk priority level
In reply to Mandeep Singh BainesQuoted 9 lines · Mandeep Singh Baines
printk()s without a priority level default to
KERN_WARNING. To reduce noise atKERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.Changed these messages to
pr_info. But might be more appropriate aspr_debug.Signed-off-by Mandeep Singh Baines <[email protected]>
Applied to suspend-2.6/linux-next.
Thanks,
Rafael
Quoted 36 lines
--- drivers/base/power/trace.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)drivers/base/power/trace.c +3
-3@@ -112,7 +112,7 @@ static unsigned int read_magic_time(void)unsigned int val;get_rtc_time (&time); -printk ("Time: %2d:%02d:%02d Date: %02d/%02d/%02d\n" , +pr_info ("Time: %2d:%02d:%02d Date: %02d/%02d/%02d\n" , time.tm_hour, time.tm_min, time.tm_sec, time.tm_mon +1 , time.tm_mday, time.tm_year %100 ); val = time.tm_year;/* 100 years */ @@ -179,7 +179,7 @@ static int show_file_hash(unsigned int value)unsigned int hash =hash_string (lineno, file,FILEHASH );if (hash != value)continue ; -printk (" hash matches %s:%u\n" , file, lineno); +pr_info (" hash matches %s:%u\n" , file, lineno); match++; }return match;@@ -255,7 +255,7 @@ static int late_resume_init(void) val = val /FILEHASH ; dev = val/* % DEVHASH */ ; -printk (" Magic number: %d:%d:%d\n" , user, file, dev); +pr_info (" Magic number: %d:%d:%d\n" , user, file, dev);show_file_hash (file);show_dev_hash (dev);return 0 ;
Rafael J. Wysocki
AppliedRe: [PATCH 3/6] PM: use appropriate printk priority level
In reply to Mandeep Singh BainesQuoted 9 lines · Mandeep Singh Baines
printk()s without a priority level default to
KERN_WARNING. To reduce noise atKERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.Changed these messages to
pr_info. But might be more appropriate aspr_debug.Signed-off-by Mandeep Singh Baines <[email protected]>
Applied to suspend-2.6/linux-next.
Thanks,
Rafael
Quoted 36 lines
--- drivers/base/power/trace.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)drivers/base/power/trace.c +3
-3@@ -112,7 +112,7 @@ static unsigned int read_magic_time(void)unsigned int val;get_rtc_time (&time); -printk ("Time: %2d:%02d:%02d Date: %02d/%02d/%02d\n" , +pr_info ("Time: %2d:%02d:%02d Date: %02d/%02d/%02d\n" , time.tm_hour, time.tm_min, time.tm_sec, time.tm_mon +1 , time.tm_mday, time.tm_year %100 ); val = time.tm_year;/* 100 years */ @@ -179,7 +179,7 @@ static int show_file_hash(unsigned int value)unsigned int hash =hash_string (lineno, file,FILEHASH );if (hash != value)continue ; -printk (" hash matches %s:%u\n" , file, lineno); +pr_info (" hash matches %s:%u\n" , file, lineno); match++; }return match;@@ -255,7 +255,7 @@ static int late_resume_init(void) val = val /FILEHASH ; dev = val/* % DEVHASH */ ; -printk (" Magic number: %d:%d:%d\n" , user, file, dev); +pr_info (" Magic number: %d:%d:%d\n" , user, file, dev);show_file_hash (file);show_dev_hash (dev);return 0 ;
Re: [PATCH 4/6] TTY: use appropriate printk priority level
In reply to Mandeep Singh BainesQuoted 6 lines · Mandeep Singh Baines
printk()s without a priority level default to
KERN_WARNING. To reduce noise atKERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.Signed-off-by Mandeep Singh Baines <[email protected]>
This doesn't apply to the latest linux-next tree, care to resend it after refreshing it?
thanks,
greg k-h
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/6] TTY: use appropriate printk priority level
In reply to Mandeep Singh BainesQuoted 6 lines · Mandeep Singh Baines
printk()s without a priority level default to
KERN_WARNING. To reduce noise atKERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.Signed-off-by Mandeep Singh Baines <[email protected]>
This doesn't apply to the latest linux-next tree, care to resend it after refreshing it?
thanks,
greg k-h
PATCH v2 1/1 TTY: use appropriate printk priority level
In reply to Greg KHRebased to apply cleanly against v2.6.38-rc3
---
printk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- drivers/tty/vt/vt.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
drivers/tty/vt/vt.c +8 -7
@@ -2157,10 +2157,10 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co currcons = vc->vc_num;if (!vc_cons_allocated (currcons)) { -/* could this happen? */ -printk_once ("con_write: tty %d not allocated\n" , currcons+1 ); -console_unlock (); -return 0 ; +/* could this happen? */ +pr_warn_once ("con_write: tty %d not allocated\n" , currcons+1 ); +console_unlock (); +return 0 ; } himask = vc->vc_hi_font_mask;
@@ -2940,7 +2940,7 @@ static int __init con_init(void)gotoxy (vc, vc->vc_x, vc->vc_y);csi_J (vc,0 );update_screen (vc); -printk ("Console: %s %s %dx%d" , +pr_info ("Console: %s %s %dx%d" , vc->vc_can_do_color ?"colour" :"mono" , display_desc, vc->vc_cols, vc->vc_rows); printable =1 ;
@@ -3103,7 +3103,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last,clear_buffer_attributes (vc); } -printk ("Console: switching " ); +pr_info ("Console: switching " );if (!deflt)printk ("consoles %d-%d " , first+1 , last+1 );if (j >=0 ) {
@@ -3809,7 +3809,8 @@ void do_unblank_screen(int leaving_gfx)return ;if (!vc_cons_allocated (fg_console)) {/* impossible */ -printk ("unblank_screen: tty %d not allocated ??\n" , fg_console+1 ); +pr_warning ("unblank_screen: tty %d not allocated ??\n" , + fg_console+1 );return ; } vc = vc_cons[fg_console].d;
Signature · 1 line
1.7.3.1
PATCH v2 1/1 TTY: use appropriate printk priority level
In reply to Greg KHRebased to apply cleanly against v2.6.38-rc3
---
printk()s without a priority level default to KERN_WARNING. To reduce noise at KERN_WARNING, this patch set the priority level appriopriately for unleveled printks()s. This should be useful to folks that look at dmesg warnings closely.
--- drivers/tty/vt/vt.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
drivers/tty/vt/vt.c +8 -7
@@ -2157,10 +2157,10 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co currcons = vc->vc_num;if (!vc_cons_allocated (currcons)) { -/* could this happen? */ -printk_once ("con_write: tty %d not allocated\n" , currcons+1 ); -console_unlock (); -return 0 ; +/* could this happen? */ +pr_warn_once ("con_write: tty %d not allocated\n" , currcons+1 ); +console_unlock (); +return 0 ; } himask = vc->vc_hi_font_mask;
@@ -2940,7 +2940,7 @@ static int __init con_init(void)gotoxy (vc, vc->vc_x, vc->vc_y);csi_J (vc,0 );update_screen (vc); -printk ("Console: %s %s %dx%d" , +pr_info ("Console: %s %s %dx%d" , vc->vc_can_do_color ?"colour" :"mono" , display_desc, vc->vc_cols, vc->vc_rows); printable =1 ;
@@ -3103,7 +3103,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last,clear_buffer_attributes (vc); } -printk ("Console: switching " ); +pr_info ("Console: switching " );if (!deflt)printk ("consoles %d-%d " , first+1 , last+1 );if (j >=0 ) {
@@ -3809,7 +3809,8 @@ void do_unblank_screen(int leaving_gfx)return ;if (!vc_cons_allocated (fg_console)) {/* impossible */ -printk ("unblank_screen: tty %d not allocated ??\n" , fg_console+1 ); +pr_warning ("unblank_screen: tty %d not allocated ??\n" , + fg_console+1 );return ; } vc = vc_cons[fg_console].d;
Signature · 1 line
1.7.3.1