Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3925538ybh; Tue, 17 Mar 2020 09:01:52 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuXTNQ7ZBw2B+e9vVF4j5hRbZRQ1FII7eh3GX/y2TYQQLOuPFDO06gnvxhJIsU4ZpoP9EI1 X-Received: by 2002:aca:b7c1:: with SMTP id h184mr4179123oif.77.1584460911868; Tue, 17 Mar 2020 09:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584460911; cv=none; d=google.com; s=arc-20160816; b=v4mpy3TYSYS/8xRrQhTZTQBPvvcGx/UnmdT2mUvQnHHyiM5LXKq9CjryJjQB1WYk6U Gxi9K+zHl1E+r8oA0hzB3zZzuaaxd+aTLOjm2smY7x5ydiSphoeVqy1kwZd6a9uHLCvI KN9xkDIudDnKT3nEdj1jjJVfk5nYNfyd5/+MkSPbS1KX5GlqULVysgvRBdGFYVX221c4 Ljof+Mpp3Fvrd6mFiGrVlHA/Vt/14N0PAgjmgu3e11DaDrr1FXqDP1Z4XtaqTBkpkXfo nR/28De0I3GkWPQ9tiICFAXfcjWF726S4IW0n3VFItvEOG7mF8Qjjgg4CA5E8NbOhyPt 0pRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=eAhbBL0CBHwTEuoSCE5w0pXR4TY8wKBETG1SIbtR2Sc=; b=C2pIjl5cLjO9H18dXQyNj6ceeS5QCzANqFBkymu46kCYOFFSdAw2zeX/rMmIwX9cF7 YFRK4cG2AywHLA69xBJfYwaShGUaqiLCXYJcSWBH3ODxSgewNeNalCygShA2P9CSUsXB oyFW09/dQIcIfKEBT4CuH+YUpp8IXXf62za20yEB06mqZ+ntz7isW3q4MdC7wNgudVie uctAFcQbhRvxk9vy2rnzcOApecxG1EK1qEZeQyLm7RQ7cdQc1d+cbzeXKL/k6hL9MG38 sVE06TtrUm9cGuCESvO/KcVEQZohZDcAW1GkC3GnlX6bYqrFxApRjbBNEHLOd4v3e0qB 44eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UxEcJbE5; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t125si1758188oie.167.2020.03.17.09.01.38; Tue, 17 Mar 2020 09:01:51 -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=@linaro.org header.s=google header.b=UxEcJbE5; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726760AbgCQQAx (ORCPT + 99 others); Tue, 17 Mar 2020 12:00:53 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:45597 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726019AbgCQQAx (ORCPT ); Tue, 17 Mar 2020 12:00:53 -0400 Received: by mail-wr1-f67.google.com with SMTP id t2so16340114wrx.12 for ; Tue, 17 Mar 2020 09:00:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=eAhbBL0CBHwTEuoSCE5w0pXR4TY8wKBETG1SIbtR2Sc=; b=UxEcJbE5USWqkkP6abztBR0xn4UoB+3HaAmS+SR+DIlY9cmQmxOjfghKLVcS/MgD93 B+XCDiVXBXMX9b9CkkhYZ+KpTEXpGyoP/ojxfia8bG7x1+vwExQwKqW6YVXY8Jl7k0R8 Zcz8Q2+0ypoeyzHSOUXHWPHFeOkWYd99k3dVN4vuJcfzskzemmHst9Nlz+44lyETb4HD z9zB2P+Dj6smTjN3gNJDV+rd88DPnrtThNakEXkci3fYxvAMOiO9YcWlwnPmP3HBeMod R7d4lgn+WROybjInFFnQo9ov2H+TH0F5SxgcVPpXXcLIdvpZE7GLcIhuGbtOGGLEqZgr HATg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eAhbBL0CBHwTEuoSCE5w0pXR4TY8wKBETG1SIbtR2Sc=; b=DFkw22+YGYHGgu5Yv+uz3n13AJZbno3Ay0Qvi1BS1/y6vaf8MYPgBAQyfeNwr++DaJ tKOR0taiywB8RIrXbuiXGJDYY8UE2dkjWjlzQ/bZwO4o6v9QAftkZreTgCCYr5scXNRv X+hU4OQqLf2TwhxXMAjrnptHxVn0R5l7oEcl79qs8pKMzroyLCLRT/MuqNEsLZ/2bMav F9NXImmnIqBEEuevL32ABux0A3w9Hds8zlZUSN3hTJ0oP6Q7hq/gHw3ssPsgqxpxFVdb k/MMAYUpXnfJZFCBdg72P8iDmnpUuv5urOH5YcGh98Z1LbF44SRuEC9iFEgJVjRoWS29 RkFA== X-Gm-Message-State: ANhLgQ2+n+/rj3pdALFlr/8Hlv58IR8802bDvMg51bJcQObY2PNtNvZI JDnSxVQjrVIzJXakxyBBSGy1DA== X-Received: by 2002:adf:b245:: with SMTP id y5mr6492408wra.136.1584460851735; Tue, 17 Mar 2020 09:00:51 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id x17sm4434916wmi.28.2020.03.17.09.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 09:00:50 -0700 (PDT) Date: Tue, 17 Mar 2020 16:00:49 +0000 From: Daniel Thompson To: Dmitry Safonov Cc: linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com>, Andrew Morton , Greg Kroah-Hartman , Ingo Molnar , Jiri Slaby , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Tetsuo Handa , Douglas Anderson , Jason Wessel , kgdb-bugreport@lists.sourceforge.net Subject: Re: [PATCHv2 47/50] kdb: Don't play with console_loglevel Message-ID: <20200317160049.b2t52oaqifhmcv23@holly.lan> References: <20200316143916.195608-1-dima@arista.com> <20200316143916.195608-48-dima@arista.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200316143916.195608-48-dima@arista.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 16, 2020 at 02:39:13PM +0000, Dmitry Safonov wrote: > 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 Acked-by: Daniel Thompson > --- > 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 >