Skip to contentSkip to conversation

stop ==== emergency

PATCH Pete Zaitcev 3 participants 6 messages Feb 6, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Review static void show_trace_log_lvl(struct ta · line 171

Quoted 9 lines · Hugh Dickins

+++ linux/arch/i386/kernel/traps.c 2006-02-03 09:59:37.000000000 +0000

(quoted diff) +2 -1
@@ -166,7 +166,8 @@ static void show_trace_log_lvl(struct ta
 		stack = (unsigned long*)context->previous_esp;
 		if (!stack)
 			break;
-		printk(KERN_EMERG " =======================\n");
+		printk(log_lvl);
+		printk(" =======================\n");
 	}

This is wrong, Hugh. What do you think the priority of the second printk? It's not log_lvl, that's for sure.

-- Pete

#2 lore raw
Quoted 14 lines · Pete Zaitcev

Review static void show_trace_log_lvl(struct ta · line 171

Quoted 9 lines · Hugh Dickins

+++ linux/arch/i386/kernel/traps.c 2006-02-03 09:59:37.000000000 +0000

(quoted diff) +2 -1
@@ -166,7 +166,8 @@ static void show_trace_log_lvl(struct ta
 		stack = (unsigned long*)context->previous_esp;
 		if (!stack)
 			break;
-		printk(KERN_EMERG " =======================\n");
+		printk(log_lvl);
+		printk(" =======================\n");
 	}

This is wrong, Hugh. What do you think the priority of the second printk? It's not log_lvl, that's for sure.

Are you sure? I've not delved into the printk code itself, but this does follow the same pattern as in show_stack_log_lvl itself e.g. its "Call Trace:\n" line. (I am assuming print_context_stack ends with a newline, as it does.)

Hugh

#3 lore raw

Hi Hugh, Pete,

Quoted 7 lines
Quoted 2 lines

This is wrong, Hugh. What do you think the priority of the second printk? It's not log_lvl, that's for sure.

Are you sure? I've not delved into the printk code itself, but this does follow the same pattern as in show_stack_log_lvl itself e.g. its "Call Trace:\n" line. (I am assuming print_context_stack ends with a newline, as it does.)

The code was correct (and was applied already as far as I can see.) However, given that printk calls aren't exactly cheap, don't we want to merge them where possible?

Merge a few printk calls in i386 traps.

---
 arch/i386/kernel/traps.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
arch/i386/kernel/traps.c +4 -8
@@ -114,8 +114,7 @@
 
 static void print_addr_and_symbol(unsigned long addr, char *log_lvl)
 {
-	printk(log_lvl);
-	printk(" [<%08lx>] ", addr);
+	printk("%s [<%08lx>] ", log_lvl, addr);
 	print_symbol("%s", addr);
 	printk("\n");
 }
@@ -166,8 +165,7 @@
 		stack = (unsigned long*)context->previous_esp;
 		if (!stack)
 			break;
-		printk(log_lvl);
-		printk(" =======================\n");
+		printk("%s =======================\n", log_lvl);
 	}
 }
 
@@ -196,14 +194,12 @@
 			break;
 		if (i && ((i % 8) == 0)) {
 			printk("\n");
-			printk(log_lvl);
-			printk("       ");
+			printk("%s       ", log_lvl);
 		}
 		printk("%08lx ", *stack++);
 	}
 	printk("\n");
-	printk(log_lvl);
-	printk("Call Trace:\n");
+	printk("%sCall Trace:\n", log_lvl);
 	show_trace_log_lvl(task, esp, log_lvl);
 }
 

More merges are possible, but I'm not sure how far we want to go.

Thanks,

Signature · 1 line
Jean Delvare
#4 lore raw
Quoted 15 lines · Jean Delvare

However, given that printk calls aren't exactly cheap, don't we want to merge them where possible?

arch/i386/kernel/traps.c +1 -2
@@ -114,8 +114,7 @@
 
 static void print_addr_and_symbol(unsigned long addr, char *log_lvl)
 {
-	printk(log_lvl);
-	printk(" [<%08lx>] ", addr);
+	printk("%s [<%08lx>] ", log_lvl, addr);
....
Quoted 1 line

More merges are possible, but I'm not sure how far we want to go.

I assumed, as I guess Chuck who put in all the printk(log_lvl)s did, that they wouldn't be deciphered right if as separate args. But a glance at vprintk suggests you're right, they're interpreted after expanding into printk_buf.

But my own interest in minimizing printk calls is rather low at the moment; and they're hardly time-critical, are they? fast paths won't be fast if they're doing printk's, and I hope things haven't got so bad that we need dump_stack to be fast! Waste more space? expect so.

More important would be: how's the SMP printk behaviour these days? Does separating log_lvl from message increase the likelihood that the log_lvls might be misapplied if different CPUs print at the same time? If so, then I'd say your changes are very important - but please send them to Andrew rather than to me.

Hugh

#5 lore raw
Quoted 2 lines · Hugh Dickins

But my own interest in minimizing printk calls is rather low at the moment; and they're hardly time-critical, are they?

Absolutely, saving time by mering printks is rather stupid. That said, I'm totally sick of "<4>" all over the place. You might not see it on your VGA, but it leakes everywhere else and is annoying. As far as I am concerned, every printk must end with a newline and this is why I disagreed with your printk(log_lvl);

-- Pete

#6 lore raw
Quoted 1 line · Pete Zaitcev

As far as I am concerned, every printk must end with a newline

You're out of luck, I'm afraid.
Hugh