Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3440819pxk; Mon, 28 Sep 2020 18:33:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyi+BPDbU4YwK+GkKLYAtqCNgZkD1H+OW+zvrdebX95Zq6u0I2TbeA/g1uSRB52AqURzncR X-Received: by 2002:a17:906:1cc1:: with SMTP id i1mr1150035ejh.299.1601343200788; Mon, 28 Sep 2020 18:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601343200; cv=none; d=google.com; s=arc-20160816; b=vKPDlTl+lXysosHXNznu5U2czOV6HZVqavyE0LgNpZfma/U2SQc4CxUH96/FGLqjVt AzEYJd1v0rITOwQDxG4o0gWw/pv+035wLqh92OUho3tqRWuWaL4b3VlESaQk+n8Xebsf 9qZzUuJzUHOMU8/bVs83bmvyxu4cepH7ouemwCQjYBFiyg60yW95bKmk9GURhEnPBpf0 +8ZSBuIUaz2LWCq8xeE7dlpkGLgSlV2ppMkMc2T0slMIfmRuEL7RmqHcdL4tWuqZAGAZ Rt6ODQ2YJ/d1NjctkZI5hUDeUdBQ4M1poMRqGbcBbZMan928PsiqtA11jO8p8cB8btT2 BIvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+mjIo3kz4cZI9/X+eyiRaGszQK9dGPZiIyY/uC+eBPc=; b=qnXJkqWLLAV31acT+2//WlnB6VfrtolWcmIu+Wwy+FsMuogJ5MAv3VOZJLPHwWrTa4 54D0+vsmt8qtJfKLNdYsyNppgvI5WhgP9mcNSsfpoMVw+E7KmRSZmi/PRq4drZkCNfZu 4gTsHvf01sbUeyEcrKUdUJnovgOrYuZBpfOJcHt4Hev9LZlm+2PmfOLnfz06tK303ycL 9nupjbrHiJAQPtKPcws1NxFit7y3k2ShrsqM1wvrBvibNhiU6KwGmAJJaFB9JkieYzze SbE4BbFIwJzdz8rJ2sjsUu0eXabogu0pXdUhsDM5HdydOJ86DqDIN+wGZhy5HcH5gfRT OCIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OWK4TqNu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lh12si441527ejb.343.2020.09.28.18.32.51; Mon, 28 Sep 2020 18:33:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OWK4TqNu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727512AbgI2BbF (ORCPT + 99 others); Mon, 28 Sep 2020 21:31:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:40028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727454AbgI2Ba6 (ORCPT ); Mon, 28 Sep 2020 21:30:58 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2A36721734; Tue, 29 Sep 2020 01:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601343057; bh=gnFsBKMWFbEWtrezR3gQjFqKb7oCLp1fI/Myh8q4kV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OWK4TqNu9F/urENUWFW36x5mfLZzIstOI0lfQhZ2ZG8NlCgrHDwXJzB2IAoMHi6Lv 0w0k4SbEPpgJ+Y8dr+BESS2s5EjBEd/Kwip67lXgap9DL3+Rbmfetl6gc2AJg3PlIR Ag0ntZP6D9xwJkY3ytTwm8WZ38O+ze/EfpRmAgVs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ulf Hansson , Naresh Kamboju , "Paul E . McKenney" , "Rafael J . Wysocki" , Sasha Levin , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.8 23/29] cpuidle: psci: Fix suspicious RCU usage Date: Mon, 28 Sep 2020 21:30:20 -0400 Message-Id: <20200929013027.2406344-23-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200929013027.2406344-1-sashal@kernel.org> References: <20200929013027.2406344-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson [ Upstream commit 36050d8984ab743f9990a2eb97a0062fdc3d7bbd ] 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 Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- 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 3806f911b61c0..915172e3ec906 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -64,7 +64,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) @@ -72,7 +72,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