Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3788816rwb; Tue, 16 Aug 2022 08:47:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR455ry4VTdhpd/+LJ2Fj4q3S5h2IqXF/BkRoFMV+nKa8BMTOMXVodAtqzqI4yG+nazfZm/Q X-Received: by 2002:a05:6402:d55:b0:443:9d64:55ea with SMTP id ec21-20020a0564020d5500b004439d6455eamr11196446edb.90.1660664845760; Tue, 16 Aug 2022 08:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660664845; cv=none; d=google.com; s=arc-20160816; b=aHaHRlE92wJD05LZqdIssPC6SYi8dkVZR3w27HidaqXHAaqIfvjykOj0+m8uUbUNp4 T3JRxeNUTAQWF58oGX/dV18A83gsWzC4EsZKYssRwjilYcX6BW2tXCUOaQ0ml1uuL3nt rbEWilZzT1NDsa5JtOApDbT7M7dKVRU5LpGWayjsWSdFbVQeGzd3Fk8PiPZmVcMHwUk0 IYp7q9ENvRMhYGKJ6JsadFySQogKCr0U0oTJZfUYQJVC+qm45WDChoezsSIH0AOp7EiY o00Utx207SWV1Yl0PpU3bY4m7cpQSZjw8pGRhTSec0WAiCTTod+rtKFfQwisHRA+y7b0 owQw== 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; bh=yFsAsa1osbFJStnz4hMFkLgJAVyr73LCz6DNzWojQUA=; b=ozqg2vbul9G9oibUvNhUedhxCGhrQ0jVbj/aqSLs7PZaFmhVD4Gkyp54uO1a+4CitM hcML5aqqu1JvL55wt+wkt4K6KrXgY+wu09UHGnDNExZzJ1euzOA2ErgjsLdfQz2yHEg1 MvQI1U56CyUTYjcgWx1djQu2mBFxiIMIDzmztPA28ftqecJVZIOUKGYCPWmda0/b/WL4 rrsMhjSI5HRa5ifuuT312EDfHCrivZkVYM0sniV613VzuJPiUfAdpwz+xO1Efl/L9ypJ UeqKmqedOwf1UZ1/5VLalS5ZP/huBQIapWuB8G78B0oXixSWrJA+L6in6V1srm8ZwI12 uouQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e26-20020a50d4da000000b00440608ba4d7si11045853edj.376.2022.08.16.08.47.00; Tue, 16 Aug 2022 08:47:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235737AbiHPO51 (ORCPT + 99 others); Tue, 16 Aug 2022 10:57:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231962AbiHPO5W (ORCPT ); Tue, 16 Aug 2022 10:57:22 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 9039C832C9 for ; Tue, 16 Aug 2022 07:57:21 -0700 (PDT) Received: (qmail 131232 invoked by uid 1000); 16 Aug 2022 10:57:20 -0400 Date: Tue, 16 Aug 2022 10:57:20 -0400 From: Alan Stern To: Steven Rostedt Cc: "Guilherme G. Piccoli" , akpm@linux-foundation.org, bhe@redhat.com, pmladek@suse.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, x86@kernel.org, kernel-dev@igalia.com, kernel@gpiccoli.net, halves@canonical.com, fabiomirmar@gmail.com, alejandro.j.jimenez@oracle.com, andriy.shevchenko@linux.intel.com, arnd@arndb.de, bp@alien8.de, corbet@lwn.net, d.hatayama@jp.fujitsu.com, dave.hansen@linux.intel.com, dyoung@redhat.com, feng.tang@intel.com, gregkh@linuxfoundation.org, mikelley@microsoft.com, hidehiro.kawai.ez@hitachi.com, jgross@suse.com, john.ogness@linutronix.de, keescook@chromium.org, luto@kernel.org, mhiramat@kernel.org, mingo@redhat.com, paulmck@kernel.org, peterz@infradead.org, senozhatsky@chromium.org, tglx@linutronix.de, vgoyal@redhat.com, vkuznets@redhat.com, will@kernel.org, Sergei Shtylyov Subject: Re: [PATCH v2 08/13] tracing: Improve panic/die notifiers Message-ID: References: <20220719195325.402745-1-gpiccoli@igalia.com> <20220719195325.402745-9-gpiccoli@igalia.com> <20220816101445.184ebb7c@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220816101445.184ebb7c@gandalf.local.home> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 16, 2022 at 10:14:45AM -0400, Steven Rostedt wrote: > On Tue, 19 Jul 2022 16:53:21 -0300 > "Guilherme G. Piccoli" wrote: > > > Sorry for the late review, but this fell to the bottom of my queue :-/ > > > +/* > > + * The idea is to execute the following die/panic callback early, in order > > + * to avoid showing irrelevant information in the trace (like other panic > > + * notifier functions); we are the 2nd to run, after hung_task/rcu_stall > > + * warnings get disabled (to prevent potential log flooding). > > + */ > > +static int trace_die_panic_handler(struct notifier_block *self, > > + unsigned long ev, void *unused) > > +{ > > + if (!ftrace_dump_on_oops) > > + goto out; > > + > > + if (self == &trace_die_notifier && ev != DIE_OOPS) > > + goto out; > > I really hate gotos that are not for clean ups. > > > + > > + ftrace_dump(ftrace_dump_on_oops); > > + > > +out: > > + return NOTIFY_DONE; > > +} > > + > > Just do: > > static int trace_die_panic_handler(struct notifier_block *self, > unsigned long ev, void *unused) > { > if (!ftrace_dump_on_oops) > return NOTIFY_DONE; > > /* The die notifier requires DIE_OOPS to trigger */ > if (self == &trace_die_notifier && ev != DIE_OOPS) > return NOTIFY_DONE; > > ftrace_dump(ftrace_dump_on_oops); > > return NOTIFY_DONE; > } Or better yet: if (ftrace_dump_on_oops) { /* The die notifier requires DIE_OOPS to trigger */ if (self != &trace_die_notifier || ev == DIE_OOPS) ftrace_dump(ftrace_dump_on_oops); } return NOTIFY_DONE; Alan Stern > Thanks, > > Other than that, Acked-by: Steven Rostedt (Google) > > -- Steve