Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp46258ybx; Tue, 5 Nov 2019 19:10:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwDe0BsU2EQIEBwuDP7pQ181KW1ApJYVqwhju4Z+SGLOW8Gvg+syvpBllvUJrRIe8/2WImp X-Received: by 2002:a05:6402:2042:: with SMTP id bc2mr227175edb.167.1573009847457; Tue, 05 Nov 2019 19:10:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573009847; cv=none; d=google.com; s=arc-20160816; b=GaUacRrjb91FvZQj++x0jaIT8vMl48ZOGZjMIgP4iPg0wBtChXq3Y5i9wvw0tb4UYo cGg6bcj29GFjsD/dmoePslIjwpyN7pv3SM4TJ5l1TNjaYVYV830WYxTYdq8nwto9OYVx 1gWpEmC+un7w+SjXazBANSaE2tSWr/hIIVCMt4AN7GcysQaWOnaKoxNBMZV08yP8RAWZ dNIR6RIlZmOToScVO5d7CQsNMtBQS6xuFoIiqXnBRGd5domycruI0AM9IOo0eS9cHrFd 4GHtrviQRVSy1o62BoVEM+IOiE156RFeoBOhlAs+PAW66Bd+cnMNlazo2liWNzdJdL3m LJWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=N1CFwW2Lm09nRLvgyZYRXxfZ7SInie3qB3fO3E3lvMM=; b=PCc4EE7akcxf1cV+OAPI5x1qL94DiH9UMwm9tFGmTz6inUJlb+xGSwvJYiVmKY7yU4 oABZp0dUTktv19QFCVSgaohWz4vZlHGrOv4HGqp27H4q9y6QbCFmYqbsCqUQXGQ2XnJu YXRVqbVWLL4n3Zk8I7TeiDECWziLaAWa98gvn04rxWRmTo/h4wN/6/NhzJ+DrcBy8Isp cyDHEksfiS84LJRn2uIZhBQWeq+h63lpwuSjRL+nFqEIt12RL0YYbgVGHVFY0gH/pxma xFZniLYwNMfepM5Xno9E1pktyUxNsPLj5G3Y7sMgUIGno1ff1+H6Wxz98kfXoQRLE54S SEiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=BYCbNjxn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r19si15330310ejz.6.2019.11.05.19.10.23; Tue, 05 Nov 2019 19:10:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=BYCbNjxn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731096AbfKFDIy (ORCPT + 99 others); Tue, 5 Nov 2019 22:08:54 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:35327 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731087AbfKFDIw (ORCPT ); Tue, 5 Nov 2019 22:08:52 -0500 Received: by mail-pl1-f194.google.com with SMTP id x6so10731596pln.2 for ; Tue, 05 Nov 2019 19:08:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N1CFwW2Lm09nRLvgyZYRXxfZ7SInie3qB3fO3E3lvMM=; b=BYCbNjxnCKSUWP/HkZiGt6P10evxcNKiAhL25CeoFxPbOCVkyxKFvpaSqDjbFGhUW1 hRZTqA72lB3F6gBZLNf5Axt0itQPo8MukQ/NIKdKBi5I/Ig94XUCvV5nKsNphQDbzsic cN4yegmfagZJffzD2QbENFRrbayRaJz4FPrbcAAIdOHbhNHP9ThuRGC5ht6T0FcWvxbs 8u2FvYHevA7quLveiCBHFOxAEIK08hPBRwlAEAxkiepwc88xVHoogz+azgnlgXGk8k3F CRyGh7VgcSZEXrYSaRXmi2SYg+3WUjuGL+cDOP7oseO8yZTWJaPoCM8m7dFcBVYYOUwu 7guA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N1CFwW2Lm09nRLvgyZYRXxfZ7SInie3qB3fO3E3lvMM=; b=VKG3AVX4KQvbUKhSgmKVIcw4dkDGs/9l3W5UifbO+e3ezgIKqZ+ggNlMdJaQ8hqVcI tGbBWRcgrnKSQ7lfwuTVCyVwk0CDW+TPmFgaJemfIR5qjS20D5iqWeEAZF0SfHCBsMYk lt0HHWHmenaBt+Ky7cWliAJo7kd9Zueahzdpv4HPLQy6MhfddJGNbq4FhNkxBnxXfWka o9fjfdqK38vHwl3G7iq3bb1j8HotnLkdV3vrXCmBUvgJAjsPE7P0EtLN4HDGBT76V/kg 6CtL2gSpwEM7viEyTMeNNy9Jrx6wZMauV/Lj146D98ipJgIJk0swlT4pLMfXE49VyOe3 Mm/Q== X-Gm-Message-State: APjAAAUCapueSI8zWuekC2wKFeQ8Ul8ZQg3PFQP+PpUfSWwQrbzRGgb+ pBPtXRpShblgbookeM65JjhtTQTnDo0= X-Received: by 2002:a17:902:b48d:: with SMTP id y13mr174340plr.290.1573009730444; Tue, 05 Nov 2019 19:08:50 -0800 (PST) Received: from Mindolluin.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id k24sm19570487pgl.6.2019.11.05.19.08.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Nov 2019 19:08:49 -0800 (PST) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Dmitry Safonov <0x7f454c46@gmail.com>, Dmitry Safonov , Andrew Morton , Greg Kroah-Hartman , Ingo Molnar , Jiri Slaby , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Tetsuo Handa , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org Subject: [PATCH 43/50] xtensa: Add show_stack_loglvl() Date: Wed, 6 Nov 2019 03:05:34 +0000 Message-Id: <20191106030542.868541-44-dima@arista.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191106030542.868541-1-dima@arista.com> References: <20191106030542.868541-1-dima@arista.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the log-level of show_stack() depends on a platform realization. It creates situations where the headers are printed with lower log level or higher than the stacktrace (depending on a platform or user). Furthermore, it forces the logic decision from user to an architecture side. In result, some users as sysrq/kdb/etc are doing tricks with temporary rising console_loglevel while printing their messages. And in result it not only may print unwanted messages from other CPUs, but also omit printing at all in the unlucky case where the printk() was deferred. Introducing log-level parameter and KERN_UNSUPPRESSED [1] seems an easier approach than introducing more printk buffers. Also, it will consolidate printings with headers. Introduce show_stack_loglvl(), that eventually will substitute show_stack(). Cc: Chris Zankel Cc: Max Filippov Cc: linux-xtensa@linux-xtensa.org [1]: https://lore.kernel.org/lkml/20190528002412.1625-1-dima@arista.com/T/#u Signed-off-by: Dmitry Safonov --- arch/xtensa/kernel/traps.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index cbc0d673f542..ba6c150095c6 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c @@ -502,7 +502,8 @@ static void show_trace(struct task_struct *task, unsigned long *sp, static int kstack_depth_to_print = 24; -void show_stack(struct task_struct *task, unsigned long *sp) +void show_stack_loglvl(struct task_struct *task, unsigned long *sp, + const char *loglvl) { int i = 0; unsigned long *stack; @@ -511,16 +512,21 @@ void show_stack(struct task_struct *task, unsigned long *sp) sp = stack_pointer(task); stack = sp; - pr_info("Stack:\n"); + printk("%sStack:\n", loglvl); for (i = 0; i < kstack_depth_to_print; i++) { if (kstack_end(sp)) break; - pr_cont(" %08lx", *sp++); + printk("%s %08lx", loglvl, *sp++); if (i % 8 == 7) - pr_cont("\n"); + printk("%s\n", loglvl); } - show_trace(task, stack, KERN_INFO); + show_trace(task, stack, loglvl); +} + +void show_stack(struct task_struct *task, unsigned long *sp) +{ + show_stack_loglvl(task, sp, KERN_INFO); } DEFINE_SPINLOCK(die_lock); -- 2.23.0