Skip to contentSkip to conversation

+ remove-current-defines-and-uses-of-pr_err-add-pr_emerg.patch added to -mm tree

DISCUSSION Joe Perches 4 participants 13 messages Aug 3, 2007 – Aug 10, 2007 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): tI4NY5SL.1186153543.0764100.khali@localhost

#1 lore raw
Quoted 1 line · Jean Delvare

Fine with me, but this first patch should still be correct per se.

Add new pr_<level> printk(KERN_<level> fmt "\n", ##arg) to kernel.h pr_info and pr_debug are unchanged
Remove local pr_err #defines
Convert current uses of pr_err

include/linux/kernel.h +10 -6
index 4300bb4..6447072 100644
@@ -229,20 +229,24 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
 			void *buf, size_t len);
 #define hex_asc(x)	"0123456789abcdef"[x]
 
+#define pr_emerg(fmt, arg...)	printk(KERN_EMERG fmt "\n", ##arg)
+#define pr_alert(fmt, arg...)	printk(KERN_ALERT fmt "\n", ##arg)
+#define pr_crit(fmt, arg...)	printk(KERN_CRIT fmt "\n", ##arg)
+#define pr_err(fmt, arg...)	printk(KERN_ERR fmt "\n", ##arg)
+#define pr_warn(fmt, arg...)	printk(KERN_WARNING fmt "\n", ##arg)
+#define pr_notice(fmt, arg...)	printk(KERN_NOTICE fmt "\n", ##arg)
+#define pr_info(fmt, arg...)	printk(KERN_INFO fmt, ##arg)
+
 #ifdef DEBUG
 /* If you are writing a driver, please use dev_dbg instead */
-#define pr_debug(fmt,arg...) \
-	printk(KERN_DEBUG fmt,##arg)
+#define pr_debug(fmt, arg...)	printk(KERN_DEBUG fmt, ##arg)
 #else
-static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...)
+static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char *fmt, ...)
 {
 	return 0;
 }
 #endif
 
-#define pr_info(fmt,arg...) \
-	printk(KERN_INFO fmt,##arg)
-
 /*
  *      Display an IP address in readable format.
  */
drivers/i2c/chips/menelaus.c +5 -6
index 48a7e2f..055a7b4 100644
@@ -49,8 +49,7 @@
 #include <asm/arch/menelaus.h>
 
 #define DRIVER_NAME			"menelaus"
-
-#define pr_err(fmt, arg...)	printk(KERN_ERR DRIVER_NAME ": ", ## arg);
+#define PFX                             DRIVER_NAME ": "
 
 #define MENELAUS_I2C_ADDRESS		0x72
 
@@ -156,7 +155,7 @@ static int menelaus_write_reg(int reg, u8 value)
 	int val = i2c_smbus_write_byte_data(the_menelaus->client, reg, value);
 
 	if (val < 0) {
-		pr_err("write error");
+		pr_err(PFX "write error");
 		return val;
 	}
 
@@ -168,7 +167,7 @@ static int menelaus_read_reg(int reg)
 	int val = i2c_smbus_read_byte_data(the_menelaus->client, reg);
 
 	if (val < 0)
-		pr_err("read error");
+		pr_err(PFX "read error");
 
 	return val;
 }
@@ -1178,7 +1177,7 @@ static int menelaus_probe(struct i2c_client *client)
 	/* If a true probe check the device */
 	rev = menelaus_read_reg(MENELAUS_REV);
 	if (rev < 0) {
-		pr_err("device not found");
+		pr_err(PFX "device not found");
 		err = -ENODEV;
 		goto fail1;
 	}
@@ -1259,7 +1258,7 @@ static int __init menelaus_init(void)
 
 	res = i2c_add_driver(&menelaus_i2c_driver);
 	if (res < 0) {
-		pr_err("driver registration failed\n");
+		pr_err(PFX "driver registration failed");
 		return res;
 	}
 
drivers/net/spider_net.c +8 -8
index 590b12c..ce0417c 100644
@@ -1238,14 +1238,14 @@ spider_net_decode_one_descr(struct spider_net_card *card)
 	if (hwdescr->dmac_cmd_status & SPIDER_NET_DESCR_BAD_STATUS) {
 		dev_err(&card->netdev->dev, "bad status, cmd_status=x%08x\n",
 			       hwdescr->dmac_cmd_status);
-		pr_err("buf_addr=x%08x\n", hw_buf_addr);
-		pr_err("buf_size=x%08x\n", hwdescr->buf_size);
-		pr_err("next_descr_addr=x%08x\n", hwdescr->next_descr_addr);
-		pr_err("result_size=x%08x\n", hwdescr->result_size);
-		pr_err("valid_size=x%08x\n", hwdescr->valid_size);
-		pr_err("data_status=x%08x\n", hwdescr->data_status);
-		pr_err("data_error=x%08x\n", hwdescr->data_error);
-		pr_err("which=%ld\n", descr - card->rx_chain.ring);
+		pr_err("buf_addr=x%08x", hw_buf_addr);
+		pr_err("buf_size=x%08x", hwdescr->buf_size);
+		pr_err("next_descr_addr=x%08x", hwdescr->next_descr_addr);
+		pr_err("result_size=x%08x", hwdescr->result_size);
+		pr_err("valid_size=x%08x", hwdescr->valid_size);
+		pr_err("data_status=x%08x", hwdescr->data_status);
+		pr_err("data_error=x%08x", hwdescr->data_error);
+		pr_err("which=%ld", descr - card->rx_chain.ring);
 
 		card->spider_stats.rx_desc_error++;
 		goto bad_desc;
drivers/net/spider_net.h +0 -3
index dbbdb8c..c67b11d 100644
@@ -493,7 +493,4 @@ struct spider_net_card {
 	struct spider_net_descr darray[0];
 };
 
-#define pr_err(fmt,arg...) \
-	printk(KERN_ERR fmt ,##arg)
-
 #endif
drivers/video/omap/lcd_h3.c +3 -4
index 51807b4..c37b651 100644
@@ -27,8 +27,7 @@
 #include <asm/arch/omapfb.h>
 
 #define MODULE_NAME	"omapfb-lcd_h3"
-
-#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
+#define PFX MODULE_NAME ": "
 
 static int h3_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
 {
@@ -48,7 +47,7 @@ static int h3_panel_enable(struct lcd_panel *panel)
 	if (!r)
 		r = tps65010_set_gpio_out_value(GPIO2, HIGH);
 	if (r)
-		pr_err("Unable to turn on LCD panel\n");
+		pr_err(PFX "Unable to turn on LCD panel");
 
 	return r;
 }
@@ -62,7 +61,7 @@ static void h3_panel_disable(struct lcd_panel *panel)
 	if (!r)
 		tps65010_set_gpio_out_value(GPIO2, LOW);
 	if (r)
-		pr_err("Unable to turn off LCD panel\n");
+		pr_err(PFX "Unable to turn off LCD panel");
 }
 
 static unsigned long h3_panel_get_caps(struct lcd_panel *panel)
drivers/video/omap/lcd_inn1610.c +3 -4
index 95604ca..562a30e 100644
@@ -26,8 +26,7 @@
 #include <asm/arch/omapfb.h>
 
 #define MODULE_NAME	"omapfb-lcd_h3"
-
-#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
+#define PFX		MODULE_NAME ": "
 
 static int innovator1610_panel_init(struct lcd_panel *panel,
 				    struct omapfb_device *fbdev)
@@ -35,12 +34,12 @@ static int innovator1610_panel_init(struct lcd_panel *panel,
 	int r = 0;
 
 	if (omap_request_gpio(14)) {
-		pr_err("can't request GPIO 14\n");
+		pr_err(PFX "can't request GPIO 14");
 		r = -1;
 		goto exit;
 	}
 	if (omap_request_gpio(15)) {
-		pr_err("can't request GPIO 15\n");
+		pr_err(PFX "can't request GPIO 15");
 		omap_free_gpio(14);
 		r = -1;
 		goto exit;
#2 lore raw
Quoted 16 lines · Joe Perches
Quoted 1 line · Jean Delvare

Fine with me, but this first patch should still be correct per se.

Add new pr_<level> printk(KERN_<level> fmt "\n", ##arg) to kernel.h pr_info and pr_debug are unchanged
Remove local pr_err #defines
Convert current uses of pr_err

include/linux/kernel.h +0 -0
index 4300bb4..6447072 100644
@@ -229,20 +229,24 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
 			void *buf, size_t len);

include/linux/kernel.h extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, · line 239

Quoted 10 lines
include/linux/kernel.h +8 -0
 #define hex_asc(x)	"0123456789abcdef"[x]
 
+#define pr_emerg(fmt, arg...)	printk(KERN_EMERG fmt "\n", ##arg)
+#define pr_alert(fmt, arg...)	printk(KERN_ALERT fmt "\n", ##arg)
+#define pr_crit(fmt, arg...)	printk(KERN_CRIT fmt "\n", ##arg)
+#define pr_err(fmt, arg...)	printk(KERN_ERR fmt "\n", ##arg)
+#define pr_warn(fmt, arg...)	printk(KERN_WARNING fmt "\n", ##arg)
+#define pr_notice(fmt, arg...)	printk(KERN_NOTICE fmt "\n", ##arg)
+#define pr_info(fmt, arg...)	printk(KERN_INFO fmt, ##arg)
+

Ugh. What do we have printk for then? I do not like this. For pr_debug() it makes sense because its semantics change with -DDEBUG and -UDEBUG, but for these pr_()s it does not seem so.

Quoted 9 lines
include/linux/kernel.h +1 -2
 	if (omap_request_gpio(15)) {
-		pr_err("can't request GPIO 15\n");
+		pr_err(PFX "can't request GPIO 15");
 		omap_free_gpio(14);
 		r = -1;
 		goto exit;
 
 
-
Quoted 5 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/

Jan

#3 lore raw

Hi Jan, Joe,

Quoted 19 lines · Jan Engelhardt
Quoted 18 lines · Joe Perches
Quoted 1 line · Jean Delvare

Fine with me, but this first patch should still be correct per se.

Add new pr_<level> printk(KERN_<level> fmt "\n", ##arg) to kernel.h pr_info and pr_debug are unchanged
Remove local pr_err #defines
Convert current uses of pr_err

include/linux/kernel.h +0 -0
index 4300bb4..6447072 100644
@@ -229,20 +229,24 @@ extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
 			void *buf, size_t len);
 #define hex_asc(x)	"0123456789abcdef"[x]
 
Quoted 12 lines

include/linux/kernel.h extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, · line 239

Quoted 8 lines
include/linux/kernel.h +8 -0
+#define pr_emerg(fmt, arg...)	printk(KERN_EMERG fmt "\n", ##arg)
+#define pr_alert(fmt, arg...)	printk(KERN_ALERT fmt "\n", ##arg)
+#define pr_crit(fmt, arg...)	printk(KERN_CRIT fmt "\n", ##arg)
+#define pr_err(fmt, arg...)	printk(KERN_ERR fmt "\n", ##arg)
+#define pr_warn(fmt, arg...)	printk(KERN_WARNING fmt "\n", ##arg)
+#define pr_notice(fmt, arg...)	printk(KERN_NOTICE fmt "\n", ##arg)
+#define pr_info(fmt, arg...)	printk(KERN_INFO fmt, ##arg)
+

Ugh. What do we have printk for then? I do not like this. For pr_debug() it makes sense because its semantics change with -DDEBUG and -UDEBUG, but for these pr_()s it does not seem so.

I think I agree with Jan here, I see no fundamental need for these additional macros. But if they are really added, then they should follow the same standard as pr_debug() and pr_info(), that is: no "\n" added automatically. Otherwise this will become quite messy.

Thanks,
--
Jean Delvare

#4 lore raw
Quoted 8 lines · Jean Delvare
Quoted 3 lines · Jan Engelhardt

Ugh. What do we have printk for then? I do not like this. For pr_debug() it makes sense because its semantics change with -DDEBUG and -UDEBUG, but for these pr_()s it does not seem so.

I think I agree with Jan here, I see no fundamental need for these additional macros. But if they are really added, then they should follow the same standard as pr_debug() and pr_info(), that is: no "\n" added automatically. Otherwise this will become quite messy.

2 reasons:

This change will eventually isolate multiple line printk messages and allow easier insertion of

printk_block_start
printks
printk_block_end

so that multiple line messages are kept together in the message logs.

and I've done tree-wide patches for single line

printk(KERN_\(emerg|alert|notice|crit\),

(about 2000) and fixed several dozen lines without \n or things like "KERN_<level> /n msg"

Here's the perl script I used.

It's imperfect of course. There are comments with embedded semicolons where it fails, and #defines aren't substituted too well.

if ($#ARGV < 2) {
    print "usage: KERN_<level> pr_<level> files...\n";
    exit;
}
for ($i=2; $i <= $#ARGV; $i++) {
    PrintkSearchReplace($ARGV[$i], $ARGV[0], $ARGV[1]);
}
sub PrintkSearchReplace{
    my($file, $search, $replace) = @_;

    my $orig = "";
    local($/);
    open(my $fh, $file) or die "File not found '$file'\n";
    $orig = <$fh>;
    close(my $fh);

    my $parts = $orig;
    my $whole = "";
    @segments = split(/\;/, $parts);
    foreach $line (@segments) {

	if ($whole ne "") {
	    $whole = $whole . "\;";
	}

	my $origline = $line;

	if ($line =~ m/\bprintk\s*\(\s*${search}\s*.*\".*\\n\s*\"/ms) {
	    
	    $line =~ s/\bprintk\s*\(\s*${search}\s*([^\"]*)\"/${replace}\(\1\"/ms;
	    $line =~ s/\\n\s*\"\s*/\"/ms;

	    print "${file}: changed:\n" . $origline . "\;" . "\nto:\n" . $line . "\;" . "\n" ;

	}
	$whole = $whole . $line;
    }

    if ($orig ne $whole) {
	open(my $fh, ">${file}") or die "Could not open '$file'\n";
	print $fh $whole;
	close(my $fh);
    }

}

#5 lore raw
Quoted 12 lines · Joe Perches
Quoted 8 lines · Jean Delvare
Quoted 3 lines · Jan Engelhardt

Ugh. What do we have printk for then? I do not like this. For pr_debug() it makes sense because its semantics change with -DDEBUG and -UDEBUG, but for these pr_()s it does not seem so.

I think I agree with Jan here, I see no fundamental need for these additional macros. But if they are really added, then they should follow the same standard as pr_debug() and pr_info(), that is: no "\n" added automatically. Otherwise this will become quite messy.

2 reasons:

Quoted 8 lines

This change will eventually isolate multiple line
printk messages and allow easier insertion of

printk_block_start
printks
printk_block_end

so that multiple line messages are kept together in the message logs.

They are not kept together today, so I do not see how that will change. Locking the printk buffer between _start and _end? No thanks, I don't have overlapping messages that often.

Or what is it actually that you are trying to accomplish?

Jan

#6 lore raw
In reply to Joe Perches
Quoted 7 lines · On Fri, 03 Aug 2007 15:16:09 -0700 Joe Perches <[email protected]> wrote:
Quoted 1 line · Jean Delvare

Fine with me, but this first patch should still be correct per se.

Add new pr_<level> printk(KERN_<level> fmt "\n", ##arg) to kernel.h pr_info and pr_debug are unchanged
Remove local pr_err #defines
Convert current uses of pr_err

OK, I've lost the plot here. If we have now converged on an agreeable patch, please resend it?

#7 lore raw
Quoted 6 lines · Andrew Morton
Quoted 3 lines · On Fri, 03 Aug 2007 15:16:09 -0700 Joe Perches <[email protected]> wrote:
Quoted 1 line · Jean Delvare

Fine with me, but this first patch should still be correct per se.

Quoted 7 lines
Quoted 4 lines

Add new pr_<level> printk(KERN_<level> fmt "\n", ##arg) to kernel.h pr_info and pr_debug are unchanged
Remove local pr_err #defines
Convert current uses of pr_err

OK, I've lost the plot here. If we have now converged on an agreeable patch, please resend it?

I don't think we have, no. It's not even clear what Joe is trying to achieve.

Signature · 1 line
Jean Delvare
#8 lore raw
Quoted 11 lines · Jean Delvare
Quoted 8 lines · Andrew Morton
Quoted 4 lines · On Fri, 03 Aug 2007 15:16:09 -0700 Joe Perches <[email protected]> wrote:

Add new pr_<level> printk(KERN_<level> fmt "\n", ##arg) to kernel.h pr_info and pr_debug are unchanged
Remove local pr_err #defines
Convert current uses of pr_err

OK, I've lost the plot here. If we have now converged on an agreeable patch, please resend it?

I don't think we have, no.
It's not even clear what Joe is trying to achieve.

Goals in desired implementation sequence:

1 Standardization of pr_<level>
2 Correctness of single line uses of pr_<level>
3 Correctness of multiple line uses of printk(<level>) 4 Removal of local near equivalents of pr_<level> 5 Standardization of pr_<level> as single line only 6 Conversion of single line printk(KERN_<level> to pr_level 7 Standardize local #defines to enable/print pr_<level>
__file__/__func__/__line__
8 Minimization/elimination of interleaved log messages

cheers, Joe

#9 lore raw
Quoted 10 lines · Joe Perches

Goals in desired implementation sequence:

1 Standardization of pr_<level>
2 Correctness of single line uses of pr_<level>
3 Correctness of multiple line uses of printk(<level>) 4 Removal of local near equivalents of pr_<level> 5 Standardization of pr_<level> as single line only 6 Conversion of single line printk(KERN_<level> to pr_level 7 Standardize local #defines to enable/print pr_<level>
__file__/__func__/__line__

I fail to see what problem these are trying to fix. Please post some broken code that would 'benefit' from pr_halleluja, and why printk(level ) could not do the same.

Quoted 1 line

8 Minimization/elimination of interleaved log messages

This is a separate, and worthwhile, thing to do, yes. And it can be done without deviating from the regular printk().

Jan

#10 lore raw
Quoted 1 line · Jan Engelhardt

I fail to see what problem these are trying to fix.

Any code that does the equivalent of printk(KERN_foo "\n message");

egrep -r "printk[[:space:]]*\([[:space:]]*KERN.*\\\n[A-JL-Za-jl-z[:space:]" --include=*.[ch] *

At least 61 instances right now.

Quoted 2 lines

Please post some broken code that would 'benefit' from pr_halleluja, and why printk(level ) could not do the same.

"Could" most always leads to an interesting argument.

Future minimization of introduced error is a benefit not an absolute.

Adding the ability to log higher priority KERN_<level> without removing printk altogether for embedded systems seems useful. You could leave out say just KERN_INFO, KERN_NOTICE and KERN_WARN levels.

Worth the churn is another question, though git seems to allow most everyone to resync to tree wide changes pretty easily.

If new pr_<level> defines aren't accepted, I suggest removing the current ~200 uses of pr_info.

Quoted 4 lines
Quoted 1 line

8 Minimization/elimination of interleaved log messages

This is a separate, and worthwhile, thing to do, yes. And it can be done without deviating from the regular printk().

I'm not sure how. Maybe you have an idea you could share?

Maybe an external tool to reassemble complete messages from prefixed {{cookie}} message logs would be fine for awhile.

Perhaps something like:

cookie = printk_block_start()
printk_block[s](cookie)
printk_block_end(cookie)?

where printk_block emits cookie when multiple cookies are active.

cheers, Joe

#11 lore raw
Quoted 8 lines · Joe Perches
Quoted 1 line · Jan Engelhardt

I fail to see what problem these are trying to fix.

Any code that does the equivalent of printk(KERN_foo "\n message");

egrep -r "printk[[:space:]]*\([[:space:]]*KERN.*\\\n[A-JL-Za-jl-z[:space:]" --include=*.[ch] *

At least 61 instances right now.

Eww. Well, let's look at some.
arch/i386/kernel/io_apic.c:line 1529

printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
smp_processor_id(), hard_smp_processor_id());

The \n seems unneeded, since print_local_APIC() is run on each cpu. (see caller).

Then, there are also messages that are just a standalone \n without even a debugging level. Not sure that is useful.

	# io_apic.c again, line 1601
	#
        printk(KERN_DEBUG "... APIC TDCR: %08x\n", v);  
        printk("\n");

So, well, let's pick one with KERN_DEBUG "\n....

fs/freevxfs/vxfs_bmap.c:line 169 (near "case VXFS_TYPED_DATA_DEV4")

                        printk(KERN_INFO "\n\nTYPED_DEV4 detected!\n");
                        printk(KERN_INFO "block: %Lu\tsize: %Ld\tdev: %d\n",
                               (unsigned long long) typ4->vd4_block,
                               (unsigned long long) typ4->vd4_size,
                               typ4->vd4_dev);

Seems normal. So it looks like your regex has some false positives. (which nothing can be done about - the 61 must be hand-sorted)

Perhaps we're looking for this idiom:

	printk(KERN_WHATEVER "Doing foo...");
	for (as_long_as_there_is_work) {
		do_it();
		printk(KERN_WHATEVER ".");
	}
	printk(KERN_WHATEVER "\n");

Yes, that imo is horrible :) since code running on another cpu can printk in the middle. Perhaps

	int i;
	for (as_long with ++i) {
		do_it();
		printk("something informative %d\n", i++);
	}

should be done _instead_. This would also address number 8:

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

8 Minimization/elimination of interleaved log messages

This is a separate, and worthwhile, thing to do, yes. And it can be done without deviating from the regular printk().

I'm not sure how. Maybe you have an idea you could share?

[My idea is above]

Quoted 11 lines

Maybe an external tool to reassemble complete messages from prefixed {{cookie}} message logs would be fine for awhile.

Perhaps something like:

cookie = printk_block_start()
printk_block[s](cookie)
printk_block_end(cookie)?

where printk_block emits cookie when multiple cookies are active.

How is this supposed to work? Are you suggesting that the printk buffer is locked? I hope not. Cache output until a block is ended? No, I do not think
that helps either, because the for(){printk(".");} loops are meant to
give an indication _THAT_ something is happening (or not - e.g. lockup). Now, if you hold the output of a printk block until it's _end() counterpart is executed, the user does not get any output when the machine locks up during the for loop.

Hence, better do a full printk (e.g. with newline) in each iteration. And if possible sparingly. Booting in 9600 bps serial mode is going to take longer the more output the kernel produces ;-)
Or just to not clutter dmesg too much.

And at the end of the day when this would be done - what would we need pr_foo for?

Jan

#12 lore raw
Quoted 4 lines · Jan Engelhardt

fs/freevxfs/vxfs_bmap.c:line 169 (near "case VXFS_TYPED_DATA_DEV4")

                        printk(KERN_INFO "\n\nTYPED_DEV4 detected!\n");

Seems normal.

The second output log line of the first printk isn't prefixed with KERN_INFO. It's output with log_level_unknown.

Quoted 2 lines

So it looks like your regex has some false positives. (which nothing can be done about - the 61 must be hand-sorted)

Must have copy/pasted the wrong regex

$ egrep -r "printk[[:space:]]*\([[:space:]]*KERN.*\\\n[A-JL-Za-jl-z[:space:]]" --include=*.[ch] * | wc -l
61
Quoted 1 line

[My idea is above]

Any sequence of printks can be interleaved. I don't see how your suggestion changes that.

Quoted 9 lines
Quoted 9 lines

Maybe an external tool to reassemble complete messages from prefixed {{cookie}} message logs would be fine for awhile.

Perhaps something like:

cookie = printk_block_start()
printk_block[s](cookie)
printk_block_end(cookie)?

Quoted 5 lines
Quoted 2 lines

where printk_block emits cookie when multiple cookies are active.

How is this supposed to work? Are you suggesting that the printk buffer is locked?

No, just another identifier placed into logs that allow messages to be reassembled into something readable when multiple printk_block's are active.

Quoted 3 lines

Now, if you hold the output of a printk block until it's _end() counterpart is executed, the user does not get any output when the machine locks up during the for loop.

External tool scans logs. No blocking or delay in output.

cheers, Joe

#13 lore raw

Hi Joe,

Quoted 8 lines · Joe Perches
Quoted 4 lines · Jan Engelhardt

fs/freevxfs/vxfs_bmap.c:line 169 (near "case VXFS_TYPED_DATA_DEV4")

                        printk(KERN_INFO "\n\nTYPED_DEV4 detected!\n");

Seems normal.

The second output log line of the first printk isn't prefixed with KERN_INFO. It's output with log_level_unknown.

True. This simply means that the leading \n's shouldn't be there. Pretty easy to fix.

Quoted 32 lines
Quoted 2 lines

So it looks like your regex has some false positives. (which nothing can be done about - the 61 must be hand-sorted)

Must have copy/pasted the wrong regex

$ egrep -r "printk[[:space:]]*\([[:space:]]*KERN.*\\\n[A-JL-Za-jl-z[:space:]]" --include=*.[ch] * | wc -l
61
Quoted 1 line

[My idea is above]

Any sequence of printks can be interleaved. I don't see how your suggestion changes that.

Quoted 9 lines
Quoted 9 lines

Maybe an external tool to reassemble complete messages from prefixed {{cookie}} message logs would be fine for awhile.

Perhaps something like:

cookie = printk_block_start()
printk_block[s](cookie)
printk_block_end(cookie)?

Quoted 5 lines
Quoted 2 lines

where printk_block emits cookie when multiple cookies are active.

How is this supposed to work? Are you suggesting that the printk buffer is locked?

No, just another identifier placed into logs that allow messages to be reassembled into something readable when multiple printk_block's are active.

Quoted 5 lines
Quoted 3 lines

Now, if you hold the output of a printk block until it's _end() counterpart is executed, the user does not get any output when the machine locks up during the for loop.

External tool scans logs. No blocking or delay in output.

Assuming that the related messages are prefixed in a similar way (as dev_info and friends do), grouping them is already possible, and pretty
trivial: grep can select whatever you are interested in.

I'm not saying that your ideas are all bad. The ability to build a kernel without the least interesting messages is valuable. Having a more standard formatting for log messages is interesting as well, although dev_info and friends already offer this to some extent. But you have to realize that kernel logging must stay something very simple, and that the first tool to read them is "dmesg" and not some funky log scanner. So the current implementation can't be that far from what we need.

Thanks,

Signature · 1 line
Jean Delvare