Skip to contentSkip to conversation

printk: allow setting DEFAULT_MESSAGE_LEVEL via Kconfig

PATCH Superseded Mandeep Singh Baines 10 participants 43 messages Jan 25, 2011 – Feb 6, 2011

Subsystems (12)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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
index 5ddd291..f91a7fd 100644
@@ -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
index 28b42b9..67b42fa 100644
@@ -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
#1 lore raw
Quoted 3 lines · Mandeep Singh Baines

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.

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?

#2 lore raw
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_LEVEL Kconfig-settable. That way we can set it to KERN_NOTICE and 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
#3 lore raw
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_LEVEL Kconfig-settable. That way we can set it to KERN_NOTICE and 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.

#4 lore raw
In reply to Mandeep Singh Baines
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_LEVEL Kconfig-settable. That way we can set it to KERN_NOTICE and audit any messages <= KERN_WARNING.

Why? We already have "loglevel=" kernel parameter.

maintainer
#7 lore raw
In reply to Mandeep Singh Baines
Quoted 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_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
index 5ddd291..f91a7fd 100644
@@ -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
index 28b42b9..67b42fa 100644
@@ -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 ;)

#8 lore raw
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_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
index 5ddd291..f91a7fd 100644
@@ -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
index 28b42b9..67b42fa 100644
@@ -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 y

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 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 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 ;)

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#5 lore raw
In reply to WANG Cong
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_LEVEL Kconfig-settable. That way we can set it to KERN_NOTICE and 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/

maintainer
#9 lore raw
In reply to Randy Dunlap
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.

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.

#16 lore raw

cover Set printk priority level

In reply to 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

[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

#18 lore raw

cover Set printk priority level

In reply to 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

[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

#19 lore raw

PATCH 1/6 mm/page_alloc: use appropriate printk priority level

In reply to Mandeep Singh Baines

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.

---
 mm/page_alloc.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)
mm/page_alloc.c +15 -12
index 90c1439..234c704 100644
@@ -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>
#26 lore raw

PATCH 1/6 mm/page_alloc: use appropriate printk priority level

In reply to Mandeep Singh Baines

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.

---
 mm/page_alloc.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)
mm/page_alloc.c +15 -12
index 90c1439..234c704 100644
@@ -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
#27 lore raw

PATCH 2/6 arch/x86: use appropriate printk priority level

In reply to Mandeep Singh Baines

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.

---
 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
index ffe5755..dbf2cbc 100644
@@ -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
index 0fe27d7..0da6907 100644
@@ -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>
#28 lore raw

PATCH 2/6 arch/x86: use appropriate printk priority level

In reply to Mandeep Singh Baines

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.

---
 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
index ffe5755..dbf2cbc 100644
@@ -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
index 0fe27d7..0da6907 100644
@@ -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
#29 lore raw

PATCH 3/6 PM: use appropriate printk priority level

In reply to Mandeep Singh Baines

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.

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
index 9f4258d..c80e138 100644
@@ -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>
#32 lore raw

PATCH 3/6 PM: use appropriate printk priority level

In reply to Mandeep Singh Baines

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.

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
index 9f4258d..c80e138 100644
@@ -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
#33 lore raw

PATCH 4/6 TTY: use appropriate printk priority level

In reply to Mandeep Singh Baines

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 |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/tty/vt/vt.c +5 -4
index 76407ec..511d80e 100644
@@ -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>
#38 lore raw

PATCH 4/6 TTY: use appropriate printk priority level

In reply to Mandeep Singh Baines

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 |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/tty/vt/vt.c +5 -4
index 76407ec..511d80e 100644
@@ -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
#39 lore raw

PATCH 5/6 fs: use appropriate printk priority level

In reply to Mandeep Singh Baines

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.

---
 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
index 4bd454f..4cf2a52 100644
@@ -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
index 7b0b953..c81bcd9 100644
@@ -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
index 2b54bef..3e01121 100644
@@ -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>
#40 lore raw

PATCH 5/6 fs: use appropriate printk priority level

In reply to Mandeep Singh Baines

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.

---
 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
index 4bd454f..4cf2a52 100644
@@ -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
index 7b0b953..c81bcd9 100644
@@ -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
index 2b54bef..3e01121 100644
@@ -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
#41 lore raw

PATCH 6/6 taskstats: use appropriate printk priority level

In reply to Mandeep Singh Baines

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.

---
 kernel/taskstats.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/taskstats.c +1 -1
index 3971c6b..9ffea36 100644
@@ -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>
#42 lore raw

PATCH 6/6 taskstats: use appropriate printk priority level

In reply to Mandeep Singh Baines

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.

---
 kernel/taskstats.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/taskstats.c +1 -1
index 3971c6b..9ffea36 100644
@@ -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
#20 lore raw

Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level

In reply to Mandeep Singh Baines
Quoted 12 lines · Mandeep Singh Baines

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.

---

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 -1
 		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]);

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
#25 lore raw

Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level

In reply to Mandeep Singh Baines
Quoted 12 lines · Mandeep Singh Baines

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.

---

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 -1
 		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]);

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
#21 lore raw

Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level

In reply to Ryan Mallon
Quoted 35 lines · Ryan Mallon
Quoted 12 lines · Mandeep Singh Baines

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.

---

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 -1
 		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]);

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
#22 lore raw

Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level

In reply to Ryan Mallon
Quoted 35 lines · Ryan Mallon
Quoted 12 lines · Mandeep Singh Baines

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.

---

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 -1
 		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]);

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
#6 lore raw
In reply to Mandeep Baines
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_LEVEL Kconfig-settable. That way we can set it to KERN_NOTICE and 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_LEVEL selects 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.

#17 lore raw

Re: [PATCH v1 0/6] Set printk priority level

In reply to Mandeep Singh Baines
Quoted 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.

#10 lore raw
In reply to Andrew Morton
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.

#11 lore raw
In reply to Andrew Morton
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.

#12 lore raw
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_loglevel kernel 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.

#23 lore raw

Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level

In reply to Mandeep Singh Baines
Quoted 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 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 +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 -1
 		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]);

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_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 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 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.

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
#24 lore raw

Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level

In reply to Mandeep Singh Baines
Quoted 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 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 +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 -1
 		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]);

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_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 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 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.

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
#13 lore raw
In reply to Mandeep Singh Baines
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_loglevel kernel parameter.

Quoted 9 lines

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.

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
#14 lore raw
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.

#15 lore raw
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
#30 lore raw

Re: [PATCH 3/6] PM: use appropriate printk priority level

In reply to Mandeep Singh Baines
Quoted 9 lines · Mandeep Singh Baines

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.

Changed these messages to pr_info. But might be more appropriate as pr_debug.

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
index 9f4258d..c80e138 100644
@@ -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;
#31 lore raw

Re: [PATCH 3/6] PM: use appropriate printk priority level

In reply to Mandeep Singh Baines
Quoted 9 lines · Mandeep Singh Baines

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.

Changed these messages to pr_info. But might be more appropriate as pr_debug.

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
index 9f4258d..c80e138 100644
@@ -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;
#34 lore raw

Re: [PATCH 4/6] TTY: use appropriate printk priority level

In reply to Mandeep Singh Baines
Quoted 6 lines · Mandeep Singh Baines

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.

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>

#37 lore raw

Re: [PATCH 4/6] TTY: use appropriate printk priority level

In reply to Mandeep Singh Baines
Quoted 6 lines · Mandeep Singh Baines

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.

This doesn't apply to the latest linux-next tree, care to resend it after refreshing it?

thanks,

greg k-h

#35 lore raw

PATCH v2 1/1 TTY: use appropriate printk priority level

In reply to Greg KH

Rebased 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
index 147ede3..d5669ff 100644
@@ -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
#36 lore raw

PATCH v2 1/1 TTY: use appropriate printk priority level

In reply to Greg KH

Rebased 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
index 147ede3..d5669ff 100644
@@ -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