From: Tony Lindgren Subject: Re: Power driver patches to avoid lockdep complaints Date: Thu, 15 Sep 2016 14:45:27 -0700 Message-ID: <20160915214526.bxiqp6lkgkkfnpwi@atomide.com> References: <20160615211344.GA31850@linux.vnet.ibm.com> <20160823004549.b66jru7ogyfifunf@atomide.com> <20160823005917.GY3482@linux.vnet.ibm.com> <3368049.VBoKnTMGvK@vostro.rjw.lan> <20160823101600.GA3482@linux.vnet.ibm.com> <20160915194129.tq65ieriuo6a3yrf@atomide.com> <20160915195240.7lxrrf2s2fkgavwn@atomide.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from muru.com ([72.249.23.125]:42477 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753951AbcIOVpb (ORCPT ); Thu, 15 Sep 2016 17:45:31 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: "Rafael J. Wysocki" Cc: "Paul E. McKenney" , "Rafael J. Wysocki" , Pavel Machek , Guenter Roeck , Steven Rostedt , Linux PM * Rafael J. Wysocki [160915 13:41]: > On Thu, Sep 15, 2016 at 9:52 PM, Tony Lindgren wrote: > > * Tony Lindgren [160915 12:41]: > >> Rafael, I'm still not seeing these applied, care to check? > > > > Sorry looks like only one of the three fixes is missing from > > current mainline: > > > > 13e698e68f75 ("power: Use _rcuidle for suspend/resume tracepoints") > > > > So I'm still getting warning out of box with omap2plus_defconfig. > > It's not been applied, because I was unaware of it. OK well good thing I bugged you then :) > Care to send it to me as a patch? Below produced with git show --pretty=email 13e698e68f75. Regards, Tony 8< ------------------------ >From 13e698e68f75708c45241a2dad23cd6b65181056 Mon Sep 17 00:00:00 2001 From: "Paul E. McKenney" Date: Tue, 26 Apr 2016 10:42:25 -0700 Subject: [PATCH] power: Use _rcuidle for suspend/resume tracepoints Further testing with false negatives suppressed by commit 293e2421fe25 ("rcu: Remove superfluous versions of rcu_read_lock_sched_held()") identified a few more unprotected uses of RCU from the idle loop. Because RCU actively ignores idle-loop code (for energy-efficiency reasons, among other things), using RCU from the idle loop can result in too-short grace periods, in turn resulting in arbitrary misbehavior. The affected function is rpm_suspend(). The resulting lockdep-RCU splat is as follows: ------------------------------------------------------------------------ Warning from omap3 =============================== [ INFO: suspicious RCU usage. ] 4.6.0-rc5-next-20160426+ #1112 Not tainted ------------------------------- include/trace/events/rpm.h:63 suspicious rcu_dereference_check() usage! other info that might help us debug this: RCU used illegally from idle CPU! rcu_scheduler_active = 1, debug_locks = 0 RCU used illegally from extended quiescent state! 1 lock held by swapper/0/0: #0: (&(&dev->power.lock)->rlock){-.-...}, at: [] __pm_runtime_suspend+0x54/0x84 stack backtrace: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.6.0-rc5-next-20160426+ #1112 Hardware name: Generic OMAP36xx (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0xb0/0xe4) [] (dump_stack) from [] (rpm_suspend+0x604/0x7e4) [] (rpm_suspend) from [] (__pm_runtime_suspend+0x64/0x84) [] (__pm_runtime_suspend) from [] (omap2_gpio_prepare_for_idle+0x5c/0x70) [] (omap2_gpio_prepare_for_idle) from [] (omap_sram_idle+0x140/0x244) [] (omap_sram_idle) from [] (omap3_enter_idle_bm+0xfc/0x1ec) [] (omap3_enter_idle_bm) from [] (cpuidle_enter_state+0x80/0x3d4) [] (cpuidle_enter_state) from [] (cpu_startup_entry+0x198/0x3a0) [] (cpu_startup_entry) from [] (start_kernel+0x354/0x3c8) [] (start_kernel) from [<8000807c>] (0x8000807c) ------------------------------------------------------------------------ Reported-by: Tony Lindgren Signed-off-by: Paul E. McKenney Tested-by: Tony Lindgren Tested-by: Guenter Roeck Cc: Steven Rostedt Cc: "Rafael J. Wysocki" Cc: Pavel Machek Cc: Cc: Cc: diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index fd553d0..15b6d5b 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -419,7 +419,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) struct device *parent = NULL; int retval; - trace_rpm_suspend(dev, rpmflags); + trace_rpm_suspend_rcuidle(dev, rpmflags); repeat: retval = rpm_check_suspend_allowed(dev); @@ -549,7 +549,7 @@ static int rpm_suspend(struct device *dev, int rpmflags) } out: - trace_rpm_return_int(dev, _THIS_IP_, retval); + trace_rpm_return_int_rcuidle(dev, _THIS_IP_, retval); return retval;