Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp960816pxv; Fri, 25 Jun 2021 02:14:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaRGFSOf49I4oeORJv5s2fhZFGlHm3nCrFpRGHoOSTeexReX5EXrLOFP8OI854axm4yOes X-Received: by 2002:a17:907:9604:: with SMTP id gb4mr9506190ejc.544.1624612493856; Fri, 25 Jun 2021 02:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624612493; cv=none; d=google.com; s=arc-20160816; b=PBdNSq+32xA2ARTFOc0sjgwFX4ZAejAdkbiKmZu1HpPhSUQnVsonyGfHp5dcBb6li1 K487y5bVogCrbwdzQjxzrSkJ+tZPIJKHTvMs9q29eCITEt/gaQnJp0C8BEFlzUyJaQZP j2KRGrYOy7yYfkslGzoKmSTYRyaQkSvjYrTW8EnLM6XQ90iskgtn7df3wr4Q3hPOJB6e pDDKOFDvw0aDvLG5T1/1QM5PvSf5Kw3cpwUEO77y0M58TMKidTZfJfYa6j1beX7oCvdT 2a4cULXq4DMqXrlwNcNGmaRGL+qohfKt3wMQjLqKBdlpt+nnjcAxecrf5KldLzRCOu9d /9dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Isgc+M4F8lzQo39RcIUZi5oWcIOHR43lieHIr7259Nk=; b=IaeMrxhEy7hOd7A2euj0TrBipxMj1Ttn8CKZN4K6OHpu9YAiku/ew/AFo8rMeHRpJO tFVKp1qhKNNiFQfpn3l0AYoTmW+zvmIjHnjbM1FOF6GPLRYMho19+MaK1IcG/JlcPHCL p5WTIHpYgy0fDOdgHHQc4fjVatAg/RNSuWf6CV0y7fFIbodKSLV5G/kVeGSRPe7ogQDP rW4d8mkZl/Iuj1s92Bp5y07V9kEqM6AGWii2O1sFc6Z+9gYakEYXDujQa3LEzK56Aw34 f/mzRHfVx/CLP59eKNAetKBJp0bQnuZzeRr4KmUdiI+N1PJDmiRtUpSg6ge7JbYbEKvF vvvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="FxX/8f/9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yc6si5217821ejb.128.2021.06.25.02.14.30; Fri, 25 Jun 2021 02:14:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="FxX/8f/9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231147AbhFYJP3 (ORCPT + 99 others); Fri, 25 Jun 2021 05:15:29 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:43056 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbhFYJP2 (ORCPT ); Fri, 25 Jun 2021 05:15:28 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 952E11FE67; Fri, 25 Jun 2021 09:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1624612387; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Isgc+M4F8lzQo39RcIUZi5oWcIOHR43lieHIr7259Nk=; b=FxX/8f/9CQ6Wy1UwB6wcc+aet4EIhrdQzzauHozpXql6As5aUDxTJMCM/jVH2E3HunuDwy HOosOTmqGpsF0o9tSXpMalKoVlXufCaDerKYC5BjXbNpaB7lHjHb54TZfQQA2jdzdhACKT P8agmOKSdTx1RCOCcpPdzpJcE6T6cxs= Received: from suse.cz (unknown [10.100.216.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 5B70DA3BE9; Fri, 25 Jun 2021 09:13:07 +0000 (UTC) Date: Fri, 25 Jun 2021 11:13:06 +0200 From: Petr Mladek To: Dmitry Safonov Cc: linux-kernel@vger.kernel.org, Dmitry Safonov <0x7f454c46@gmail.com>, Andrew Morton , John Ogness , Sergey Senozhatsky , Steven Rostedt Subject: Re: [PATCH] printk: Add CONFIG_CONSOLE_LOGLEVEL_PANIC Message-ID: References: <20210622143350.1105701-1-dima@arista.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210622143350.1105701-1-dima@arista.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2021-06-22 15:33:50, Dmitry Safonov wrote: > console_verbose() increases console loglevel to CONSOLE_LOGLEVEL_MOTORMOUTH, > which provides more information to debug a panic/oops. > > Unfortunately, in Arista we maintain some DUTs (Device Under Test) that > are configured to have 9600 baud rate. While verbose console messages > have their value to post-analyze crashes, on such setup they: > - may prevent panic/oops messages being printed > - take too long to flush on console resulting in watchdog reboot > > In all our setups we use kdump which saves dmesg buffer after panic, > so in reality those extra messages on console provide no additional value, > but rather add risk of not getting to __crash_kexec(). It makes sense. > Provide CONFIG_CONSOLE_LOGLEVEL_PANIC, which allows to choose how > verbose the kernel must be on oops/panic. > > Cc: Andrew Morton > Cc: John Ogness > Cc: Petr Mladek > Cc: Sergey Senozhatsky > Cc: Steven Rostedt > Signed-off-by: Dmitry Safonov > --- > include/linux/printk.h | 4 ++-- > lib/Kconfig.debug | 13 +++++++++++++ > 2 files changed, 15 insertions(+), 2 deletions(-) > > diff --git a/include/linux/printk.h b/include/linux/printk.h > index fe7eb2351610..5a65a719f917 100644 > --- a/include/linux/printk.h > +++ b/include/linux/printk.h > @@ -76,8 +76,8 @@ static inline void console_silent(void) > > static inline void console_verbose(void) > { > - if (console_loglevel) > - console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH; > + if (console_loglevel && (CONFIG_CONSOLE_LOGLEVEL_PANIC > 0)) > + console_loglevel = CONFIG_CONSOLE_LOGLEVEL_PANIC; console_verbose() is called also in some other situations. For example, check_hung_task(), oops_begin(), debug_locks_ff(). These do not always lead to panic. At minimum, the name is misleading. It should be something like CONFIG_CONSOLE_LOGLEVEL_VERBOSE. But the question is whether we really want to limit the loglevel also in the non-panic scenarios. IMHO, it is a bad idea. A better solution would be to introduce console_verbose_panic() and use it only when it is really going to panic. The function should also use the lower value only when crash dump is really successfully enabled. > } > > /* strlen("ratelimit") + 1 */ > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > index 678c13967580..0c12cafd9d8b 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -61,6 +61,19 @@ config CONSOLE_LOGLEVEL_QUIET > will be used as the loglevel. IOW passing "quiet" will be the > equivalent of passing "loglevel=" > > +config CONSOLE_LOGLEVEL_PANIC > + int "panic console loglevel (1-15)" The range is 1-15 here. > + range 0 15 But it is 0-15 here. If you use "range 1 15" you should not need the check (CONFIG_CONSOLE_LOGLEVEL_PANIC > 0) in the code. > + default "15" > + help > + loglevel to use in kernel panic or oopses. > + > + Usually in order to provide more debug information on console upon > + panic, one wants to see everything being printed (loglevel = 15). > + With an exception to setups with low baudrate on serial console, > + keeping this value high is a good choice. > + 0 value is to keep the loglevel during panic/oops unchanged. The trick with 0 value just makes things more complicated. The default "15" does the same job and should be good enough. The hard-coded default is good enough for the other CONSOLE_LOGLEVEL_* settings. Best Regards, Petr