Skip to contentSkip to conversation

x86/kernel: Update bug_at() head message

PATCH In review Andy Shevchenko 3 participants 3 messages Jan 10, 2017 – Jan 12, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86/kernel: Update bug_at() head message

First of all, %*ph specifier allows to dump data in hex format using the pointer to a buffer. This is suitable to use here.

Besides that Thomas suggested to move it to critical level and replace __FILE__ by explicit mention of "jumplabel".

---
 arch/x86/kernel/jump_label.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/jump_label.c +1 -2
index fc25f698d792..32f126e726f5 100644
@@ -32,8 +32,7 @@ static void bug_at(unsigned char *ip, int line)
 	 * Something went wrong. Crash the box, as something could be
 	 * corrupting the kernel.
 	 */
-	pr_warning("Unexpected op at %pS [%p] (%02x %02x %02x %02x %02x) %s:%d\n",
-	       ip, ip, ip[0], ip[1], ip[2], ip[3], ip[4], __FILE__, line);
+	pr_crit("jumplabel: Unexpected op at %pS [%p] (%5ph) %d\n", ip, ip, ip, line);
 	BUG();
 }
 
Signature · 1 line
2.11.0
#1 lore raw
Quoted 16 lines · Andy Shevchenko

First of all, %*ph specifier allows to dump data in hex format using the pointer to a buffer. This is suitable to use here.

Besides that Thomas suggested to move it to critical level and replace __FILE__ by explicit mention of "jumplabel".

---
 arch/x86/kernel/jump_label.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/jump_label.c +0 -0
index fc25f698d792..32f126e726f5 100644

arch/x86/kernel/jump_label.c static void bug_at(unsigned char *ip, int line) · line 36

Quoted 7 lines
arch/x86/kernel/jump_label.c +1 -2
@@ -32,8 +32,7 @@ static void bug_at(unsigned char *ip, int line)
 	 * Something went wrong. Crash the box, as something could be
 	 * corrupting the kernel.
 	 */
-	pr_warning("Unexpected op at %pS [%p] (%02x %02x %02x %02x %02x) %s:%d\n",
-	       ip, ip, ip[0], ip[1], ip[2], ip[3], ip[4], __FILE__, line);
+	pr_crit("jumplabel: Unexpected op at %pS [%p] (%5ph) %d\n", ip, ip, ip, line);
 	BUG();

What is 'jumplabel'? Nobody calls it that in the kernel - everyone calls it 'jump_label' ...

(Fixed that in patch, no need to resend.)

Thanks,

Ingo

#2 lore raw

[tip:locking/core] locking/jump_labels: Update bug_at() boot message

In reply to Andy Shevchenko
locking/jump_labels: Update bug_at() boot message
Commit-ID:  6e03f66c001790d6ca853c68a56c87460bc86467
Gitweb:     http://git.kernel.org/tip/6e03f66c001790d6ca853c68a56c87460bc86467
Author:     Andy Shevchenko <[email protected]>
AuthorDate: Tue, 10 Jan 2017 18:43:54 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 12 Jan 2017 09:43:07 +0100

locking/jump_labels: Update bug_at() boot message

First of all, %*ph specifier allows to dump data in hex format using the pointer to a buffer. This is suitable to use here.

Besides that Thomas suggested to move it to critical level and replace __FILE__ by explicit mention of "jumplabel".

---
 arch/x86/kernel/jump_label.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/jump_label.c +1 -2
index fc25f69..c37bd0f 100644
@@ -32,8 +32,7 @@ static void bug_at(unsigned char *ip, int line)
 	 * Something went wrong. Crash the box, as something could be
 	 * corrupting the kernel.
 	 */
-	pr_warning("Unexpected op at %pS [%p] (%02x %02x %02x %02x %02x) %s:%d\n",
-	       ip, ip, ip[0], ip[1], ip[2], ip[3], ip[4], __FILE__, line);
+	pr_crit("jump_label: Fatal kernel bug, unexpected op at %pS [%p] (%5ph) %d\n", ip, ip, ip, line);
 	BUG();
 }