Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp2678898ybh; Mon, 16 Mar 2020 07:44:07 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuMk/UMKYMtUd+ULTqISXWL4UXmOnGbftmyp1V2TxeYZMxj31aBpH/z67OD/zQyA1Ux+Wje X-Received: by 2002:a05:6830:3151:: with SMTP id c17mr5175609ots.310.1584369847219; Mon, 16 Mar 2020 07:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584369847; cv=none; d=google.com; s=arc-20160816; b=SEiNPU9y70DfBge813hasudrfMlO/0FDacfDZ1pFwjm0BcoAAluOutmb1eQ3KC0qu0 iSTRIQwcfFFB6N1ME7uP4PtPcVSUgXFB+/kjn7+qd5sXtLFS/HZDX6PDHRu6INUy3/ma JJxUMJmQF/eSjBLABpCIDxdF6c6CGuRWw+qe385zGhF6T1HyvCdHiGiJyMKELbBxQSUc Cbix2Hc4jmvVPny5SQXpdwDAEFpy8CVUVvdfQhM5ke+RX5hgFlkXU+J8j+0X5OV9Gq98 vavyMwWK3zvW9urErSu5Zdx6EihKwGRcmo2icGJUjls5rgp0GwS4tfGBzLCPR/4+ENEH cQmw== 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=FAh4+ZsRsbWtICuJgMDzpa3wZ0ySHTOVMGXpJ/bEEEg=; b=OXAwFlzA7CYo3oMR/Pp5F+ccuHgITk0HUEMcSDB5johnFbIvhQ8J28gGyAr3IAZYEF 8AcOIXwWojzka2gfm25AhYlrRoFS/6VGtTeRLpS3t4zyF17pVJippfVbxRXYvwpuqoBD 3ZYZfyaJYJgLLgv7ayLUq+OuSg50MOBp6ZfAvmKhR1WkOGFNUjA7JCKkZe0vDTtDeUH1 RW9r201EtgZA7CMFL6GjqtI6BkSfnabHlL4TjCUxghl8fjT3ECvbr9+mH+5scWOjPvkO tF3VBWZfSkqWuMNxqVtUnLj7tTaDYHgjoW2lk9UN4iBy1cVcqEHdi/bs1yL5UXoiJ6tb QJHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=HOh8OHo6; 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 a11si90866oid.121.2020.03.16.07.43.55; Mon, 16 Mar 2020 07:44:07 -0700 (PDT) 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=HOh8OHo6; 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 S1731607AbgCPOnQ (ORCPT + 99 others); Mon, 16 Mar 2020 10:43:16 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:40331 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731569AbgCPOnP (ORCPT ); Mon, 16 Mar 2020 10:43:15 -0400 Received: by mail-pg1-f196.google.com with SMTP id t24so9875581pgj.7 for ; Mon, 16 Mar 2020 07:43:13 -0700 (PDT) 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=FAh4+ZsRsbWtICuJgMDzpa3wZ0ySHTOVMGXpJ/bEEEg=; b=HOh8OHo6JRPnKsknISWiWoXxam2wMiNmGRR6NvyiakbYVwxifIWYmCejVB3MMOjK4a 8M38Xj1sTNOC2Y4qPpwuVbgnfSHf/rFunliwQ8fzM2CSdhz7RmthIcAeXUBApR98akuP kSGv1c3iSq4XZRtYD36sYYz2Ohe99YSJvhIXF2tQL1a8fdtgC12+j40wENiIYQSVHZYM kekNhjR/ph995qgVpRygRWUKQELRT7EeBTFjpNHsqVJ6uVPCGdXiNoyyylBhFUqd8A0o pXNnfBs02zcST84fApXSJZ5slczDB6UmDi572Xl6Dlds7Dw0c4hWEcyixFEkzdJW+pYu 68Bw== 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=FAh4+ZsRsbWtICuJgMDzpa3wZ0ySHTOVMGXpJ/bEEEg=; b=LlTzfcWdLSO9cfNgKkLCcvJGTVX0RG73bfYHt0GYjYep7z0JfB9Jp4xWGzfwvemMer TtOgZcW7DMFvNvFKePeCOMH6A7MSnPGbKsEJR9fav885/PCJhh/YGi/bTM/VQMctBfPv 63ms5+Er5sw1XOxAOob7qt9lGL52gXCvBsvAemy2h68mXfOXwKO3fvWbw2GfzTTNDUTy c5oQcHTpGqyIUTbAgSJ7zCb6TjuAxonlMeF4SZ7tqQ1Zuckxq8thouBnIZpRyGtkWL7X PsRAia3SzueZwhLGPQC1R9WDgYRNmcQhyFSgosFiOFSeWJLAlev842ySEYUZ0yxydnRh GN4w== X-Gm-Message-State: ANhLgQ37eI0nzi6Jlkm4HJgsCg3Jc2NyoUMrY+AztBlDbDcS5Cr2bClw MB33IKG2vZAPyyGTiJnSCiubEg/Nn0FbaA== X-Received: by 2002:a63:2cd:: with SMTP id 196mr220042pgc.188.1584369792534; Mon, 16 Mar 2020 07:43:12 -0700 (PDT) Received: from Mindolluin.aristanetworks.com ([2a02:8084:e84:2480:228:f8ff:fe6f:83a8]) by smtp.gmail.com with ESMTPSA id i2sm81524pjs.21.2020.03.16.07.43.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Mar 2020 07:43:11 -0700 (PDT) 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 , Daniel Thompson , Douglas Anderson , Jason Wessel , kgdb-bugreport@lists.sourceforge.net Subject: [PATCHv2 47/50] kdb: Don't play with console_loglevel Date: Mon, 16 Mar 2020 14:39:13 +0000 Message-Id: <20200316143916.195608-48-dima@arista.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200316143916.195608-1-dima@arista.com> References: <20200316143916.195608-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 Print the stack trace with KERN_EMERG - it should be always visible. Playing with console_loglevel is a bad idea as there may be more messages printed than wanted. Also the stack trace might be not printed at all if printk() was deferred and console_loglevel was raised back before the trace got flushed. Unfortunately, after rebasing on commit 2277b492582d ("kdb: Fix stack crawling on 'running' CPUs that aren't the master"), kdb_show_stack() uses now kdb_dump_stack_on_cpu(), which for now won't be converted as it uses dump_stack() instead of show_stack(). Convert for now the branch that uses show_stack() and remove console_loglevel exercise from that case. Cc: Daniel Thompson Cc: Douglas Anderson Cc: Jason Wessel Cc: kgdb-bugreport@lists.sourceforge.net Signed-off-by: Dmitry Safonov --- kernel/debug/kdb/kdb_bt.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/kernel/debug/kdb/kdb_bt.c b/kernel/debug/kdb/kdb_bt.c index 3de0cc780c16..43f5dcd2b9ac 100644 --- a/kernel/debug/kdb/kdb_bt.c +++ b/kernel/debug/kdb/kdb_bt.c @@ -21,17 +21,18 @@ static void kdb_show_stack(struct task_struct *p, void *addr) { - int old_lvl = console_loglevel; - - console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH; kdb_trap_printk++; - if (!addr && kdb_task_has_cpu(p)) + if (!addr && kdb_task_has_cpu(p)) { + int old_lvl = console_loglevel; + + console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH; kdb_dump_stack_on_cpu(kdb_process_cpu(p)); - else - show_stack(p, addr); + console_loglevel = old_lvl; + } else { + show_stack_loglvl(p, addr, KERN_EMERG); + } - console_loglevel = old_lvl; kdb_trap_printk--; } -- 2.25.1