Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1365007

[PATCH] x86: dumpstack: combine some printks

From Rasmus Villemoes <linux@rasmusvillemoes.dk>
Newsgroups linux.kernel
Subject [PATCH] x86: dumpstack: combine some printks
Date 2016-03-26 21:50 +0100
Message-ID <rh3jI-67R-3@gated-at.bofh.it> (permalink)
References <qgHEK-11w-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Long ago, Jiri Slaby noted that the subsequent printks should be
pr_cont. Let's instead get rid of the multiple printk calls.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
I originally suggested getting rid of the extra printks by building a
suitable string at compile time, but then ended up going out on a
tangent. Since I've basically shelved the COND_CONFIG idea and
288cf3c64e anyway makes it impossible to build the entire string at
compile time, I now suggest this.

 arch/x86/kernel/dumpstack.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index 8efa57a5f29e..2bb25c3fe2e8 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -260,19 +260,12 @@ int __die(const char *str, struct pt_regs *regs, long err)
 	unsigned long sp;
 #endif
 	printk(KERN_DEFAULT
-	       "%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
-#ifdef CONFIG_PREEMPT
-	printk("PREEMPT ");
-#endif
-#ifdef CONFIG_SMP
-	printk("SMP ");
-#endif
-	if (debug_pagealloc_enabled())
-		printk("DEBUG_PAGEALLOC ");
-#ifdef CONFIG_KASAN
-	printk("KASAN");
-#endif
-	printk("\n");
+	       "%s: %04lx [#%d]%s%s%s%s\n", str, err & 0xffff, ++die_counter,
+	       IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT"         : "",
+	       IS_ENABLED(CONFIG_SMP)     ? " SMP"             : "",
+	       debug_pagealloc_enabled()  ? " DEBUG_PAGEALLOC" : "",
+	       IS_ENABLED(CONFIG_KASAN)   ? " KASAN"           : "");
+
 	if (notify_die(DIE_OOPS, str, regs, err,
 			current->thread.trap_nr, SIGSEGV) == NOTIFY_STOP)
 		return 1;
-- 
2.1.4

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] x86: dumpstack: combine some printks Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2016-03-26 21:50 +0100
  [tip:x86/debug] x86/dumpstack: Combine some printk()s tip-bot for Rasmus Villemoes <tipbot@zytor.com> - 2016-04-01 08:40 +0200

csiph-web