linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/6] Set printk priority level
       [not found] <20110125235700.GR8008@google.com>
@ 2011-01-26 23:29 ` Mandeep Singh Baines
  2011-01-27  7:22   ` WANG Cong
  2011-01-26 23:29 ` [PATCH 1/6] mm/page_alloc: use appropriate " Mandeep Singh Baines
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Mandeep Singh Baines @ 2011-01-26 23:29 UTC (permalink / raw)
  To: gregkh, rjw, mingo, akpm; +Cc: linux-kernel, linux-pm, linux-fsdevel, linux-mm

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/6] mm/page_alloc: use appropriate printk priority level
       [not found] <20110125235700.GR8008@google.com>
  2011-01-26 23:29 ` [PATCH v1 0/6] Set printk priority level Mandeep Singh Baines
@ 2011-01-26 23:29 ` Mandeep Singh Baines
  2011-01-27  0:32   ` Ryan Mallon
  2011-01-26 23:29 ` [PATCH 2/6] arch/x86: " Mandeep Singh Baines
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Mandeep Singh Baines @ 2011-01-26 23:29 UTC (permalink / raw)
  To: gregkh, rjw, mingo, akpm
  Cc: linux-kernel, linux-pm, linux-fsdevel, linux-mm,
	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.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
---
 mm/page_alloc.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 90c1439..234c704 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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();
-- 
1.7.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/6] arch/x86: use appropriate printk priority level
       [not found] <20110125235700.GR8008@google.com>
  2011-01-26 23:29 ` [PATCH v1 0/6] Set printk priority level Mandeep Singh Baines
  2011-01-26 23:29 ` [PATCH 1/6] mm/page_alloc: use appropriate " Mandeep Singh Baines
@ 2011-01-26 23:29 ` Mandeep Singh Baines
  2011-01-26 23:29 ` [PATCH 3/6] PM: " Mandeep Singh Baines
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Mandeep Singh Baines @ 2011-01-26 23:29 UTC (permalink / raw)
  To: gregkh, rjw, mingo, akpm
  Cc: linux-kernel, linux-pm, linux-fsdevel, linux-mm,
	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.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
---
 arch/x86/kernel/tsc.c       |    9 +++++----
 arch/x86/platform/efi/efi.c |    2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index ffe5755..dbf2cbc 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -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);
 
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 0fe27d7..0da6907 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -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;
-- 
1.7.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/6] PM: use appropriate printk priority level
       [not found] <20110125235700.GR8008@google.com>
                   ` (2 preceding siblings ...)
  2011-01-26 23:29 ` [PATCH 2/6] arch/x86: " Mandeep Singh Baines
@ 2011-01-26 23:29 ` Mandeep Singh Baines
  2011-01-31 10:12   ` Rafael J. Wysocki
  2011-01-26 23:29 ` [PATCH 4/6] TTY: " Mandeep Singh Baines
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Mandeep Singh Baines @ 2011-01-26 23:29 UTC (permalink / raw)
  To: gregkh, rjw, mingo, akpm
  Cc: linux-kernel, linux-pm, linux-fsdevel, linux-mm,
	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.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
---
 drivers/base/power/trace.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
index 9f4258d..c80e138 100644
--- a/drivers/base/power/trace.c
+++ b/drivers/base/power/trace.c
@@ -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;
-- 
1.7.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/6] TTY: use appropriate printk priority level
       [not found] <20110125235700.GR8008@google.com>
                   ` (3 preceding siblings ...)
  2011-01-26 23:29 ` [PATCH 3/6] PM: " Mandeep Singh Baines
@ 2011-01-26 23:29 ` Mandeep Singh Baines
  2011-02-03 22:13   ` Greg KH
  2011-01-26 23:29 ` [PATCH 5/6] fs: " Mandeep Singh Baines
  2011-01-26 23:29 ` [PATCH 6/6] taskstats: " Mandeep Singh Baines
  6 siblings, 1 reply; 14+ messages in thread
From: Mandeep Singh Baines @ 2011-01-26 23:29 UTC (permalink / raw)
  To: gregkh, rjw, mingo, akpm
  Cc: linux-kernel, linux-pm, linux-fsdevel, linux-mm,
	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.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
---
 drivers/tty/vt/vt.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 76407ec..511d80e 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -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;
-- 
1.7.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/6] fs: use appropriate printk priority level
       [not found] <20110125235700.GR8008@google.com>
                   ` (4 preceding siblings ...)
  2011-01-26 23:29 ` [PATCH 4/6] TTY: " Mandeep Singh Baines
@ 2011-01-26 23:29 ` Mandeep Singh Baines
  2011-01-26 23:29 ` [PATCH 6/6] taskstats: " Mandeep Singh Baines
  6 siblings, 0 replies; 14+ messages in thread
From: Mandeep Singh Baines @ 2011-01-26 23:29 UTC (permalink / raw)
  To: gregkh, rjw, mingo, akpm
  Cc: linux-kernel, linux-pm, linux-fsdevel, linux-mm,
	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.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
---
 fs/bio.c         |    2 +-
 fs/namespace.c   |    2 +-
 init/do_mounts.c |    3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/bio.c b/fs/bio.c
index 4bd454f..4cf2a52 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -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;
diff --git a/fs/namespace.c b/fs/namespace.c
index 7b0b953..c81bcd9 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -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]);
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 2b54bef..3e01121 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -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));
-- 
1.7.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/6] taskstats: use appropriate printk priority level
       [not found] <20110125235700.GR8008@google.com>
                   ` (5 preceding siblings ...)
  2011-01-26 23:29 ` [PATCH 5/6] fs: " Mandeep Singh Baines
@ 2011-01-26 23:29 ` Mandeep Singh Baines
  6 siblings, 0 replies; 14+ messages in thread
From: Mandeep Singh Baines @ 2011-01-26 23:29 UTC (permalink / raw)
  To: gregkh, rjw, mingo, akpm
  Cc: linux-kernel, linux-pm, linux-fsdevel, linux-mm,
	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.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
---
 kernel/taskstats.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 3971c6b..9ffea36 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -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);
-- 
1.7.3.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level
  2011-01-26 23:29 ` [PATCH 1/6] mm/page_alloc: use appropriate " Mandeep Singh Baines
@ 2011-01-27  0:32   ` Ryan Mallon
  2011-01-27  4:22     ` Mandeep Singh Baines
  0 siblings, 1 reply; 14+ messages in thread
From: Ryan Mallon @ 2011-01-27  0:32 UTC (permalink / raw)
  To: Mandeep Singh Baines
  Cc: gregkh, rjw, mingo, akpm, linux-kernel, linux-pm, linux-fsdevel,
	linux-mm

On 01/27/2011 12:29 PM, Mandeep Singh Baines wrote:
> 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.
> 
> Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
> ---

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

Should be printk(KERN_CONT ... (or pr_cont).

>  		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

-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan@bluewatersys.com         	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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level
  2011-01-27  0:32   ` Ryan Mallon
@ 2011-01-27  4:22     ` Mandeep Singh Baines
  2011-01-27 20:32       ` Ryan Mallon
  0 siblings, 1 reply; 14+ messages in thread
From: Mandeep Singh Baines @ 2011-01-27  4:22 UTC (permalink / raw)
  To: Ryan Mallon
  Cc: Mandeep Singh Baines, gregkh, rjw, mingo, akpm, linux-kernel,
	linux-pm, linux-fsdevel, linux-mm

Ryan Mallon (ryan@bluewatersys.com) wrote:
> On 01/27/2011 12:29 PM, Mandeep Singh Baines wrote:
> > 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.
> > 
> > Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
> > ---
> 
> > @@ -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");
> 
> Should be printk(KERN_CONT ... (or pr_cont).
> 
> >  		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.
> 

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.

> ~Ryan
> 
> -- 
> Bluewater Systems Ltd - ARM Technology Solution Centre
> 
> Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
> ryan@bluewatersys.com         	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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v1 0/6] Set printk priority level
  2011-01-26 23:29 ` [PATCH v1 0/6] Set printk priority level Mandeep Singh Baines
@ 2011-01-27  7:22   ` WANG Cong
  0 siblings, 0 replies; 14+ messages in thread
From: WANG Cong @ 2011-01-27  7:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, linux-mm

On Wed, 26 Jan 2011 15:29:24 -0800, Mandeep Singh Baines wrote:

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] mm/page_alloc: use appropriate printk priority level
  2011-01-27  4:22     ` Mandeep Singh Baines
@ 2011-01-27 20:32       ` Ryan Mallon
  0 siblings, 0 replies; 14+ messages in thread
From: Ryan Mallon @ 2011-01-27 20:32 UTC (permalink / raw)
  To: Mandeep Singh Baines
  Cc: gregkh, rjw, mingo, akpm, linux-kernel, linux-pm, linux-fsdevel,
	linux-mm, joe

On 01/27/2011 05:22 PM, Mandeep Singh Baines wrote:
> Ryan Mallon (ryan@bluewatersys.com) wrote:
>> On 01/27/2011 12:29 PM, Mandeep Singh Baines wrote:
>>> 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.
>>>
>>> Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
>>> ---
>>
>>> @@ -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");
>>
>> Should be printk(KERN_CONT ... (or pr_cont).
>>
>>>  		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.
>>
> 
> 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.

> 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

-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan@bluewatersys.com         	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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/6] PM: use appropriate printk priority level
  2011-01-26 23:29 ` [PATCH 3/6] PM: " Mandeep Singh Baines
@ 2011-01-31 10:12   ` Rafael J. Wysocki
  0 siblings, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2011-01-31 10:12 UTC (permalink / raw)
  To: Mandeep Singh Baines
  Cc: gregkh, mingo, akpm, linux-kernel, linux-pm, linux-fsdevel,
	linux-mm

On Thursday, January 27, 2011, Mandeep Singh Baines wrote:
> 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.
> 
> Signed-off-by: Mandeep Singh Baines <msb@chromium.org>

Applied to suspend-2.6/linux-next.

Thanks,
Rafael


> ---
>  drivers/base/power/trace.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
> index 9f4258d..c80e138 100644
> --- a/drivers/base/power/trace.c
> +++ b/drivers/base/power/trace.c
> @@ -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;
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/6] TTY: use appropriate printk priority level
  2011-01-26 23:29 ` [PATCH 4/6] TTY: " Mandeep Singh Baines
@ 2011-02-03 22:13   ` Greg KH
  2011-02-06 17:31     ` [PATCH v2] " Mandeep Singh Baines
  0 siblings, 1 reply; 14+ messages in thread
From: Greg KH @ 2011-02-03 22:13 UTC (permalink / raw)
  To: Mandeep Singh Baines
  Cc: gregkh, rjw, mingo, akpm, linux-kernel, linux-pm, linux-fsdevel,
	linux-mm

On Wed, Jan 26, 2011 at 03:29:28PM -0800, Mandeep Singh Baines wrote:
> 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.
> 
> Signed-off-by: Mandeep Singh Baines <msb@chromium.org>

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 majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2] TTY: use appropriate printk priority level
  2011-02-03 22:13   ` Greg KH
@ 2011-02-06 17:31     ` Mandeep Singh Baines
  0 siblings, 0 replies; 14+ messages in thread
From: Mandeep Singh Baines @ 2011-02-06 17:31 UTC (permalink / raw)
  To: Greg KH
  Cc: gregkh, rjw, mingo, akpm, linux-kernel, linux-pm, linux-fsdevel,
	linux-mm

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.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
---
 drivers/tty/vt/vt.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 147ede3..d5669ff 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -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;
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-02-06 17:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20110125235700.GR8008@google.com>
2011-01-26 23:29 ` [PATCH v1 0/6] Set printk priority level Mandeep Singh Baines
2011-01-27  7:22   ` WANG Cong
2011-01-26 23:29 ` [PATCH 1/6] mm/page_alloc: use appropriate " Mandeep Singh Baines
2011-01-27  0:32   ` Ryan Mallon
2011-01-27  4:22     ` Mandeep Singh Baines
2011-01-27 20:32       ` Ryan Mallon
2011-01-26 23:29 ` [PATCH 2/6] arch/x86: " Mandeep Singh Baines
2011-01-26 23:29 ` [PATCH 3/6] PM: " Mandeep Singh Baines
2011-01-31 10:12   ` Rafael J. Wysocki
2011-01-26 23:29 ` [PATCH 4/6] TTY: " Mandeep Singh Baines
2011-02-03 22:13   ` Greg KH
2011-02-06 17:31     ` [PATCH v2] " Mandeep Singh Baines
2011-01-26 23:29 ` [PATCH 5/6] fs: " Mandeep Singh Baines
2011-01-26 23:29 ` [PATCH 6/6] taskstats: " Mandeep Singh Baines

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).