From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3DBDC43461 for ; Fri, 4 Sep 2020 14:14:29 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8B534206B8 for ; Fri, 4 Sep 2020 14:14:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cDPeI/V3"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="v464VGCE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B534206B8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:Reply-To:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=23Yu7F6LHHc+mF6K6uomdiqWtAuBVCDrUXEFDmNc2lQ=; b=cDPeI/V3cS6cw/6T9S+WQ0vfAr 90ellI+5ru1TdoAsZLGIkk/ctiT2EXx2FDWwP4usCoxN6B8X21VTNHWgl/jNDg7F+KCN4YY/NrtrY k+4nfWMETPfUEHVxaApLnI186EUGra+tAM9uo5uNb0WrFXjjSTjNAUPtNtdMkVI11F8jhiS2GXQRr 28S8gqItZ3TXPgut8Q3u7z4smGkkWM1ycHBDj8+g2mfuPSPTWlVnJzIv7R1mQvFI5qx/Geq1gpeHS pqHHClnneA6TplbmwTHCyCgrRFI3K+sDLK6ZS1kfgwCGRtNxGByW2NtWfi1q3Ur8wN2gADx8SNE76 +wDGtnQQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kECSi-0007Qu-I9; Fri, 04 Sep 2020 14:13:08 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kECSf-0007Pl-31 for linux-arm-kernel@lists.infradead.org; Fri, 04 Sep 2020 14:13:06 +0000 Received: from paulmck-ThinkPad-P72.home (unknown [50.45.173.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5070C206B8; Fri, 4 Sep 2020 14:13:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599228784; bh=WAsv6uOhSS1yjFzNPPN4FXPLfp8p89wDOAzZfbA6WBg=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=v464VGCEopb+8UUAa0eMQCerBcbWJC6TFJ0zOTrhSwo+hSYIpxG62ltAjI5sHgJX8 RteukzG8H/bs/B/qVxRkHStEwhiOpZkj9ecApej7X9OapCMMxjQzT4NEspyHostzQu WqfoV26SsKrroqeK/VLTWEqqVCzu87o6+FBjwR34= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 338A8352118D; Fri, 4 Sep 2020 07:13:04 -0700 (PDT) Date: Fri, 4 Sep 2020 07:13:04 -0700 From: "Paul E. McKenney" To: Ulf Hansson Subject: Re: [PATCH] cpuidle: psci: Fix suspicious RCU usage Message-ID: <20200904141304.GE29330@paulmck-ThinkPad-P72> References: <20200904064705.239614-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200904064705.239614-1-ulf.hansson@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200904_101305_363421_DD243AA2 X-CRM114-Status: GOOD ( 26.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: paulmck@kernel.org Cc: Lorenzo Pieralisi , Vincent Guittot , linux-pm@vger.kernel.org, Peter Zijlstra , Naresh Kamboju , Daniel Lezcano , "Rafael J . Wysocki" , Steven Rostedt , Bjorn Andersson , Stephen Boyd , Lina Iyer , Sudeep Holla , Thomas Gleixner , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Sep 04, 2020 at 08:47:05AM +0200, Ulf Hansson wrote: > The commit eb1f00237aca ("lockdep,trace: Expose tracepoints"), started to > expose us for tracepoints. This lead to the following RCU splat on an ARM64 > Qcom board. > > [ 5.529634] WARNING: suspicious RCU usage > [ 5.537307] sdhci-pltfm: SDHCI platform and OF driver helper > [ 5.541092] 5.9.0-rc3 #86 Not tainted > [ 5.541098] ----------------------------- > [ 5.541105] ../include/trace/events/lock.h:37 suspicious rcu_dereference_check() usage! > [ 5.541110] > [ 5.541110] other info that might help us debug this: > [ 5.541110] > [ 5.541116] > [ 5.541116] rcu_scheduler_active = 2, debug_locks = 1 > [ 5.541122] RCU used illegally from extended quiescent state! > [ 5.541129] no locks held by swapper/0/0. > [ 5.541134] > [ 5.541134] stack backtrace: > [ 5.541143] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.9.0-rc3 #86 > [ 5.541149] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT) > [ 5.541157] Call trace: > [ 5.568185] sdhci_msm 7864900.sdhci: Got CD GPIO > [ 5.574186] dump_backtrace+0x0/0x1c8 > [ 5.574206] show_stack+0x14/0x20 > [ 5.574229] dump_stack+0xe8/0x154 > [ 5.574250] lockdep_rcu_suspicious+0xd4/0xf8 > [ 5.574269] lock_acquire+0x3f0/0x460 > [ 5.574292] _raw_spin_lock_irqsave+0x80/0xb0 > [ 5.574314] __pm_runtime_suspend+0x4c/0x188 > [ 5.574341] psci_enter_domain_idle_state+0x40/0xa0 > [ 5.574362] cpuidle_enter_state+0xc0/0x610 > [ 5.646487] cpuidle_enter+0x38/0x50 > [ 5.650651] call_cpuidle+0x18/0x40 > [ 5.654467] do_idle+0x228/0x278 > [ 5.657678] cpu_startup_entry+0x24/0x70 > [ 5.661153] rest_init+0x1a4/0x278 > [ 5.665061] arch_call_rest_init+0xc/0x14 > [ 5.668272] start_kernel+0x508/0x540 > > Following the path in pm_runtime_put_sync_suspend() from > psci_enter_domain_idle_state(), it seems like we end up using the RCU. > Therefore, let's simply silence the splat by informing the RCU about it > with RCU_NONIDLE. > > Note that, this is a temporary solution. Instead we should strive to avoid > using RCU_NONIDLE (and similar), but rather push rcu_idle_enter|exit() > further down, closer to the arch specific code. However, as the CPU PM > notifiers are also using the RCU, additional rework is needed. > > Reported-by: Naresh Kamboju > Signed-off-by: Ulf Hansson Acked-by: Paul E. McKenney > --- > drivers/cpuidle/cpuidle-psci.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c > index 74463841805f..d928b37718bd 100644 > --- a/drivers/cpuidle/cpuidle-psci.c > +++ b/drivers/cpuidle/cpuidle-psci.c > @@ -66,7 +66,7 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, > return -1; > > /* Do runtime PM to manage a hierarchical CPU toplogy. */ > - pm_runtime_put_sync_suspend(pd_dev); > + RCU_NONIDLE(pm_runtime_put_sync_suspend(pd_dev)); > > state = psci_get_domain_state(); > if (!state) > @@ -74,7 +74,7 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, > > ret = psci_cpu_suspend_enter(state) ? -1 : idx; > > - pm_runtime_get_sync(pd_dev); > + RCU_NONIDLE(pm_runtime_get_sync(pd_dev)); > > cpu_pm_exit(); > > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel