Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4748374ybb; Tue, 24 Mar 2020 04:41:12 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvkxnmAP/4LvioGzL932kNYuoSn3trx8MeDG9U29P8Fvhde0/ym25MppKTlPfIOBEchp2kB X-Received: by 2002:a9d:2215:: with SMTP id o21mr20814656ota.113.1585050071980; Tue, 24 Mar 2020 04:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585050071; cv=none; d=google.com; s=arc-20160816; b=drKkSTvB4EmmEEIiSznABY5gr7BGx9lSgMlFCEUVENdi1M7G1LzN7LZRMGgGCe9P8Q ttyTs2YzwM9VHUOqByGkuMGfAfvgN4Q2Lv5IKsIHLFFSDxtY7Tv7b+/Vv0/30a6kpEkD cMMW1bsO8AY+xTPeagYeYun/OfxI800zonEP9IkWCh1GqwKgWvf3A2tNnIY6J+aB5a6j GKLpqGSZ2+ZtG5uvnd8KirMiNIvvvgf/276gKFsClFZoYeV4QOaAvolV3gCBPItz6Ciq kYuWJCsS/BvWPCRHxlo8jkBWMTE0D/SS2KQXFOameRb/CJp1JrtcNtmwmM5e8HWlRbsl YyLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CKYQRlemW4QUgRykYIxuKiScyXt8Uxt8wL4tmmbiH8U=; b=BnoHfKaMsJcN5Nkuj3oNY/Q/r4HonjARMf+dnCr1pmFnbsDu//Q7pKJ4lq7nXCUyJv vdbXJLZ1Zo3YeWQ63c57C2PbpOhh7GCG4m8NmwQhllg4OcNGRteV8AOwWAvoDK3cRf6G SzUFmrDuvHurXlo6FQwSZEpuIlwNaHtjqn7fOOazLCP/l1H/EuqoAsZ04lYZXabvqvHf vp+oVzngDEtKYN+zhq7ON+qC68TFb4cTs0ZUJZTqt7OE4cER+5y1n0UXEO+PUPpE7AWy v/YZS5wchrn5gFRA77+cjkoWLdC3kaBn5dwjX0Gu3or2Gy6iH8m3RHUcAtP3310N3pVs NITA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u137si8383024oie.160.2020.03.24.04.40.59; Tue, 24 Mar 2020 04:41:11 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727280AbgCXLjX (ORCPT + 99 others); Tue, 24 Mar 2020 07:39:23 -0400 Received: from foss.arm.com ([217.140.110.172]:32932 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727066AbgCXLjX (ORCPT ); Tue, 24 Mar 2020 07:39:23 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B983131B; Tue, 24 Mar 2020 04:39:22 -0700 (PDT) Received: from e107158-lin (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 15B2D3F792; Tue, 24 Mar 2020 04:39:21 -0700 (PDT) Date: Tue, 24 Mar 2020 11:39:19 +0000 From: Qais Yousef To: "Paul E. McKenney" Cc: Davidlohr Bueso , Josh Triplett , linux-kernel@vger.kernel.org Subject: Re: Hit WARN_ON() in rcutorture.c:1055 Message-ID: <20200324113918.bnlnsip5crehxvlo@e107158-lin> References: <20200323154309.nah44so2556ee56g@e107158-lin.cambridge.arm.com> <20200323155731.GK3199@paulmck-ThinkPad-P72> <20200323170609.w64xrfahd2snfz6h@e107158-lin.cambridge.arm.com> <20200323171751.GL3199@paulmck-ThinkPad-P72> <20200323174147.lneh4rp4tazhtm6x@e107158-lin.cambridge.arm.com> <20200323181010.GN3199@paulmck-ThinkPad-P72> <20200323182351.xr764b6wafzs6fse@e107158-lin.cambridge.arm.com> <20200323184437.GP3199@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="oykz3aaepkbgreh4" Content-Disposition: inline In-Reply-To: <20200323184437.GP3199@paulmck-ThinkPad-P72> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --oykz3aaepkbgreh4 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On 03/23/20 11:44, Paul E. McKenney wrote: > > > > {register, unregister}_pm_notifier() don't seem to be too hard to use. > > > > > > That part is easy. It would also be necessary to find all the affected > > > warnings in rcutorture and suppress them, not only during this time, > > > but also for some period of time afterwards. Maybe this is the only one, > > > but that would be surprising. ;-) > > > > Wouldn't be easier to just deinit/init()? ie: treat it like unload/load module. > > > > But you'll lose some info then that maybe you'd like to keep across > > suspend/resume cycles. > > Hmmm... Are you running rcutorture as a loadable module or built into > your kernel? In the latter case, it starts up automatically shortly > after boot. Built-in. Sorry maybe I wasn't clear. I meant something like the attached. Which still generates this warning, so yeah I get your point about suppressing some warnings in the right places now. [ 48.898066] rcu-torture: Stopping rcu_torture_fwd_prog task [ 48.908998] rcu-torture: Stopping rcu_torture_reader [ 48.917052] rcu-torture: Stopping rcu_torture_fakewriter [ 48.926987] ------------[ cut here ]------------ [ 48.927025] WARNING: CPU: 4 PID: 261 at kernel/rcu/rcutorture.c:1085 rcu_torture_writer+0x49c/0xa90 [ 48.927038] rcu-torture: Stopping rcu_torture_fakewriter [ 48.927041] Modules linked in: [ 48.927070] CPU: 4 PID: 261 Comm: rcu_torture_wri Not tainted 5.6.0-rc6-00002-g533440e608d2-dirty #540 [ 48.927085] Hardware name: ARM Juno development board (r2) (DT) [ 48.927103] pstate: 00000005 (nzcv daif -PAN -UAO) [ 48.927124] pc : rcu_torture_writer+0x49c/0xa90 [ 48.927144] lr : rcu_torture_writer+0x494/0xa90 [ 48.927157] sp : ffff800018bfbde0 [ 48.927172] x29: ffff800018bfbde0 x28: ffff80001426da58 [ 48.927198] x27: ffff80001426cf08 x26: ffff80001426cf08 [ 48.927224] x25: ffff8000121b5000 x24: 0000000000000001 [ 48.927250] x23: ffff80001426d650 x22: ffff80001426b000 [ 48.927275] x21: ffff800013439000 x20: 0000000000000001 [ 48.927301] x19: ffff80001426c000 x18: 0000000000000000 [ 48.927326] x17: 0000000000000000 x16: 0000000000000000 [ 48.927351] x15: 0000000000000000 x14: 0000000000000000 [ 48.927376] x13: 0000000000000000 x12: 0000000000000000 [ 48.927401] x11: 00000000000001fa x10: 0000000000000000 [ 48.927426] x9 : ffff800013a130a0 x8 : ffff0009757f0850 [ 48.927450] x7 : 0000000000000000 x6 : ffff800018bfbcc0 [ 48.927475] x5 : 0000000000000001 x4 : 0000000000000000 [ 48.927499] x3 : 0000000000000080 x2 : 0000000000000000 [ 48.927524] x1 : 0000000000000000 x0 : 0000000000000001 [ 48.927548] Call trace: [ 48.927569] rcu_torture_writer+0x49c/0xa90 [ 48.927590] kthread+0x13c/0x140 [ 48.927611] ret_from_fork+0x10/0x18 [ 48.927627] irq event stamp: 34170 [ 48.927654] hardirqs last enabled at (34169): [] __local_bh_enable_ip+0x98/0x148 [ 48.927680] hardirqs last disabled at (34170): [] do_debug_exception+0x1a8/0x258 [ 48.927702] softirqs last enabled at (34168): [] rcu_torture_free+0x84/0x98 [ 48.927725] softirqs last disabled at (34166): [] rcu_torture_free+0x60/0x98 [ 48.927740] ---[ end trace 57f88d092825f447 ]--- Thanks -- Qais Yousef --oykz3aaepkbgreh4 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="rcu_pm.patch" diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 1aeecc165b21..defad882b236 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -45,6 +45,7 @@ #include #include #include +#include #include "rcu.h" @@ -1628,7 +1629,7 @@ static int rcu_torture_stall(void *args) } /* Spawn CPU-stall kthread, if stall_cpu specified. */ -static int __init rcu_torture_stall_init(void) +static int rcu_torture_stall_init(void) { if (stall_cpu <= 0) return 0; @@ -2008,7 +2009,7 @@ static int rcu_torture_fwd_prog(void *args) } /* If forward-progress checking is requested and feasible, spawn the thread. */ -static int __init rcu_torture_fwd_prog_init(void) +static int rcu_torture_fwd_prog_init(void) { struct rcu_fwd *rfp; @@ -2359,7 +2360,7 @@ static void rcutorture_sync(void) cur_ops->sync(); } -static int __init +static int rcu_torture_init(void) { long i; @@ -2549,5 +2550,47 @@ rcu_torture_init(void) return firsterr; } -module_init(rcu_torture_init); -module_exit(rcu_torture_cleanup); +static int rcu_torture_notify(struct notifier_block *nb, + unsigned long mode, void *_unused) +{ + switch (mode) { + case PM_HIBERNATION_PREPARE: + case PM_SUSPEND_PREPARE: + pr_info("Shutdodwn rcu torture.."); + rcu_torture_cleanup(); + break; + + case PM_POST_RESTORE: + pr_info("Restart rcu torture.."); + rcu_torture_init(); + break; + } + + return 0; +} + +static struct notifier_block rcu_nb = { + .notifier_call = rcu_torture_notify +}; + +static int nb_failed; + +int rcu_torture_module_init(void) +{ + nb_failed = register_pm_notifier(&rcu_nb); + if (nb_failed) + pr_warn("Failed to register PM notifier"); + + return rcu_torture_init(); +} + +void rcu_torture_module_exit(void) +{ + if (!nb_failed) + unregister_pm_notifier(&rcu_nb); + + rcu_torture_cleanup(); +} + +module_init(rcu_torture_module_init); +module_exit(rcu_torture_module_exit); --oykz3aaepkbgreh4--