Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp516420rwe; Thu, 1 Sep 2022 03:37:08 -0700 (PDT) X-Google-Smtp-Source: AA6agR4jCDs18g7uy9+LQolybptXxfoTK9OAC3LA+srrZvHu1RIKQLoZxhBTcG2haVbChAu/lXDI X-Received: by 2002:a05:6402:1945:b0:446:692:8aeb with SMTP id f5-20020a056402194500b0044606928aebmr27845918edz.403.1662028628317; Thu, 01 Sep 2022 03:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662028628; cv=none; d=google.com; s=arc-20160816; b=lnTFnvLontUv0BBDFRBE701RfLyPONdW5V9WgkKREzefrnAwm8rKJqBHRvtVT0zPri 7abju+b47WCTF9g4fsiSnUzCxAsuFIF46YhFvjsSTY38IP/DhavWh3FiIU+NuX5Uh4bj RS4ySuOZ3ludNmBr4/B1u/WX1kC2xse9TVNWdOJo33lay4KsrIaRFE2krVc1KBsWu8d0 xqdrMWq/r/pDhcTVfjPJ0zH+eGho7/QMOk+1JLUJIR/stZKaRO+iMa3WcFzHhl4WQYp4 yLSDIdina6yk6PXvtHCjW5r6MoxPr8vMurSncHHXN6TV+j2Fjpq6HXNwVq08SSBUbVB0 27sg== 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:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=6slCVeaRfGLdu0FBbW7r8tRY2IkzYK1UF8/XLYPyaws=; b=joHfoEICqYZw4Q/JWKSAxQgUqHvWIYDRE1pEXAcQTVMcG9+rurCLpVWnQ3WKX7SuQu gqcZJTWJ13cfWatYFhMYRWQ0DQfIZlE3TevRfTxTU1IKpNfEH0M8YY+LSfRIq/ZOuWiM 1XHmPeqtSiZHvsglG3IizV4E8VSf2qyE6tyma5s0ZO5OzkebU2QPTGfV1aSeICLoEhGg 9hzcItXOI6A6rQM3aBxjTtn/HlJgZI3Jus7E2cmhUIBi/9w10IGX5YcD53XSMKgKa8nL ehGffqh8htct8bORQ31qMPcLY4gXbKHn8KryfI08O9YFcg1caJPEHC9uBw/hmF4eN5z8 fYOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pPK95Zqw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr20-20020a170906d55400b00741a19b63b4si7971424ejc.879.2022.09.01.03.36.39; Thu, 01 Sep 2022 03:37:08 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pPK95Zqw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232494AbiIAKRv (ORCPT + 99 others); Thu, 1 Sep 2022 06:17:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233602AbiIAKRp (ORCPT ); Thu, 1 Sep 2022 06:17:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3132F132EFD for ; Thu, 1 Sep 2022 03:17:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E7984B8253D for ; Thu, 1 Sep 2022 10:17:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF0EFC433C1; Thu, 1 Sep 2022 10:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662027460; bh=lEsecR9/MhQrB8RJTlGXlTDanfUfsZB9RoqMuYg27TE=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=pPK95ZqwJxoq7d/isyzZEpNdJN6BOYFln6Zkf9b1+DHwe4qBgUMOn3uqHNeek0h8Q IWV8mHognZcqHTrMIZwk14btCeUkDPzgq3TdLoy3ZL9zNbTbvSpZZr4Xp2syU7JVkk MxncaHuhsg1FkwTykqwb15HIgFK/e18Jc3W2BrtvqlkyQcRSPpMZ7fzr8WzAqcIX9J o5xxs21jtEghhqUuhPXcNaOtkH7E5bGIEMcclKHGPq+6IjBogiCzJ57xtFFSjtnxY3 bQFiHQ5kpcxaSt3Ju14A2OfydAyQMkkCq+uttXG8VfVKZVuwz6FJjmBlwR7oiS0X6K bhVIX4bZEtVwA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 36DEF5C06C8; Thu, 1 Sep 2022 03:17:40 -0700 (PDT) Date: Thu, 1 Sep 2022 03:17:40 -0700 From: "Paul E. McKenney" To: John Ogness Cc: linux-kernel@vger.kernel.org, gwml@vger.gnuweeb.org, kernel-team@fb.com, w@lwt.eu, Petr Mladek , Sergey Senozhatsky , Steven Rostedt Subject: Re: [PATCH rcu 1/2] torture: Optionally flush printk() buffers before powering off Message-ID: <20220901101740.GP6159@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220831182113.GA2697286@paulmck-ThinkPad-P17-Gen-1> <20220831182148.2698489-2-paulmck@kernel.org> <87tu5rfogb.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tu5rfogb.fsf@jogness.linutronix.de> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Thu, Sep 01, 2022 at 11:18:20AM +0206, John Ogness wrote: > Added CC the rest of the printk folks since this would be the first use > of pr_flush() outside of the printk subsystem. And it is a controversial > usage, since it is used to work around potential (future) bugs in > printk. > > On 2022-08-31, "Paul E. McKenney" wrote: > > The rcutorture test suite produces quite a bit of console output at > > the end of a test. This means that the new-in-2022 printk() kthreads > > are likely to be in the process of flushing output at the time of the > > torture_shutdown() function's call to kernel_power_off(). Normally, > > rcutorture relies on printk() to flush any pending output upon shutdown, > > the better to detect bugs in this area, for example, the one introduced > > by 8e274732115f ("printk: extend console_lock for per-console locking"). > > However, once such a bug is detected and reported, it is necessary to > > test the rest of the system, without noise from the already-reported bug. > > Since the printk kthread implementation has been reverted, this is no > longer an issue. When a kthread implementation is re-introduced, this > issue will need to have been considered and handled. > > IMHO this patch is premature at this time and hopefully will never > become necessary (in the form of a bug workaround). Very well, I will drop it, for the time being, anyway. ;-) Thanx, Paul > > This commit therefore adds a torture.printk_shutdown_bug_workaround > > kernel parameter, which causes torture_shutdown() to invoke pr_flush(), > > and print an informative message on the console, immediately before > > invoking kernel_power_off(). When this kernel parameter is not specified, > > it is up to printk() to flush its own buffers. > > > > Suggested-by: John Ogness > > Signed-off-by: Paul E. McKenney > > --- > > Documentation/admin-guide/kernel-parameters.txt | 6 ++++++ > > kernel/torture.c | 7 +++++++ > > 2 files changed, 13 insertions(+) > > > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > > index d7f30902fda02..ba1b8776aab83 100644 > > --- a/Documentation/admin-guide/kernel-parameters.txt > > +++ b/Documentation/admin-guide/kernel-parameters.txt > > @@ -6143,6 +6143,12 @@ > > are running concurrently, especially on systems > > with rotating-rust storage. > > > > + torture.printk_shutdown_bug_workaround= [KNL] > > + Execute pr_flush(1000, true) just before invoking > > + kernel_power_off() to work around any bugs that > > + might prevent printk() from flushing its buffers > > + at shutdown time. > > + > > torture.verbose_sleep_frequency= [KNL] > > Specifies how many verbose printk()s should be > > emitted between each sleep. The default of zero > > diff --git a/kernel/torture.c b/kernel/torture.c > > index 789aeb0e1159c..7cd2016b02076 100644 > > --- a/kernel/torture.c > > +++ b/kernel/torture.c > > @@ -48,6 +48,9 @@ module_param(disable_onoff_at_boot, bool, 0444); > > static bool ftrace_dump_at_shutdown; > > module_param(ftrace_dump_at_shutdown, bool, 0444); > > > > +static bool printk_shutdown_bug_workaround; > > +module_param(printk_shutdown_bug_workaround, bool, 0444); > > + > > static int verbose_sleep_frequency; > > module_param(verbose_sleep_frequency, int, 0444); > > > > @@ -651,6 +654,10 @@ static int torture_shutdown(void *arg) > > VERBOSE_TOROUT_STRING("No torture_shutdown_hook(), skipping."); > > if (ftrace_dump_at_shutdown) > > rcu_ftrace_dump(DUMP_ALL); > > + if (printk_shutdown_bug_workaround) { > > + pr_info("%s: Flushing printk() buffers at power-down time.\n", __func__); > > + pr_flush(1000, true); > > + } > > kernel_power_off(); /* Shut down the system. */ > > return 0; > > } > > -- > > 2.31.1.189.g2e36527f23 > > John Ogness