From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754835AbcGUVX3 (ORCPT ); Thu, 21 Jul 2016 17:23:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52378 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754724AbcGUVWc (ORCPT ); Thu, 21 Jul 2016 17:22:32 -0400 From: Josh Poimboeuf To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Andy Lutomirski , Linus Torvalds , Steven Rostedt , Brian Gerst , Kees Cook , Peter Zijlstra , Frederic Weisbecker , Byungchul Park Subject: [PATCH 18/19] x86/dumpstack: print stack identifier on its own line Date: Thu, 21 Jul 2016 16:21:55 -0500 Message-Id: <17ab0380258269b289fcadc5f6a1f9604a07b1ef.1469136008.git.jpoimboe@redhat.com> In-Reply-To: References: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 21 Jul 2016 21:22:31 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org show_trace_log_lvl() prints the stack id (e.g. "") without a newline so that any stack address printed after it will appear on the same line. That causes the first stack address to be vertically misaligned with the rest, making it visually cluttered and slightly confusing: Call Trace: [] dump_stack+0x86/0xc3 [] perf_callchain_kernel+0x14b/0x160 [] get_perf_callchain+0x15f/0x2b0 ... [] ? _raw_spin_unlock_irq+0x33/0x60 [] finish_task_switch+0xb4/0x250 [] do_async_page_fault+0x2c/0xa0 It will look worse once we start printing pt_regs registers found in the middle of the stack: RIP: 0010:[] [] _raw_spin_unlock_irq+0x33/0x60 RSP: 0018:ffff88007876f720 EFLAGS: 00000206 RAX: ffff8800786caa40 RBX: ffff88007d5da140 RCX: 0000000000000007 ... Improve readability by adding a newline to the stack name: Call Trace: [] dump_stack+0x86/0xc3 [] perf_callchain_kernel+0x14b/0x160 [] get_perf_callchain+0x15f/0x2b0 ... [] ? _raw_spin_unlock_irq+0x33/0x60 [] finish_task_switch+0xb4/0x250 [] do_async_page_fault+0x2c/0xa0 Now that "continued" lines are no longer needed, we can also remove the hack of using the empty string (aka KERN_CONT) and replace it with KERN_DEFAULT. Signed-off-by: Josh Poimboeuf --- arch/x86/kernel/dumpstack.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index 198dc9e..0eedb01 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c @@ -124,7 +124,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, stack_type_str(stack_info.type, &str_begin, &str_end); if (str_begin) - printk("%s <%s> ", log_lvl, str_begin); + printk("%s <%s>\n", log_lvl, str_begin); /* * Scan the stack, printing any text addresses we find. At the @@ -176,7 +176,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, } if (str_end) - printk("%s <%s> ", log_lvl, str_end); + printk("%s <%s>\n", log_lvl, str_end); } } @@ -193,12 +193,12 @@ void show_stack(struct task_struct *task, unsigned long *sp) bp = (unsigned long)get_frame_pointer(current, NULL); } - show_stack_log_lvl(task, NULL, sp, ""); + show_stack_log_lvl(task, NULL, sp, KERN_DEFAULT); } void show_stack_regs(struct pt_regs *regs) { - show_stack_log_lvl(NULL, regs, NULL, ""); + show_stack_log_lvl(NULL, regs, NULL, KERN_DEFAULT); } static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED; -- 2.7.4