From patchwork Fri Sep 4 06:47:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 249060 Delivered-To: patches@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp1128953ilg; Thu, 3 Sep 2020 23:47:12 -0700 (PDT) X-Received: by 2002:a19:c34b:: with SMTP id t72mr3122398lff.38.1599202031926; Thu, 03 Sep 2020 23:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599202031; cv=none; d=google.com; s=arc-20160816; b=DutfeeTuDzSZL04bzcp5M12HlPLGgxT2VI/imt7DhTUdlUkTMis6CE/m6SPw69GWlt uu1Ut011P2HvG3WZnfw9EKSAGDODqOMm7jAWvFV68ffw3IBh3WSNDndMsN3Hwt5b8mZP pnfPTsK5f33hlmHY22pfcdq9Nn+Ag0sUlQeMSNKO9Pz3d46FiVzjZ7+3qHESYiN59jj8 34mipjTL7nwIOvwdO4lbW9hEcNHkX6lyYRpQJBnRzyZtcEIQW2ct8U/lk6jQvPl/4zLw b8KH3chB8Fgywezjd/MxtlPciHDmYU/VymK0+/WCfLHh+71F+TJao9jn2lCDdex3J4Tc OgAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=Tl35yEj3vFr4lnpqN2LCmv10aMtv5m1NyZfC1pcrNgQ=; b=KspDtaShFWajdt5kdUFZ1DmNvzFqHjV8zIWqH6nrkiq+oHC+dQqn+/ic38/gBIqVl8 Fq+kWwq3KSOy88irM8R1acLRfx0JQ5ptUj7/7AQQfO92DTDnj0Ju5gddVWLk3MGRK0+X /ID++5qodBid1Y6AD3gAyuNz9+mzhU0fjuswgknvzFSFO+GNoQLyOUyAmV6qQCJ7N7jG BelgMhZshPhn0NIj5+kpXnkF4FgRjXpIc7+9lDybb9HCF0bB4nV19RyZdLacaj3SlWxc aBeTmOG6DSHVysBJAqwPBkyTEbSZ6pCBdJu3NbdhMd45ixY6KuuHNpVl2IZPgaMhZvFz NGtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W9cO6wDP; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c14sor2712663lji.35.2020.09.03.23.47.11 for (Google Transport Security); Thu, 03 Sep 2020 23:47:11 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W9cO6wDP; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Tl35yEj3vFr4lnpqN2LCmv10aMtv5m1NyZfC1pcrNgQ=; b=W9cO6wDPQmVC6TMWa3OLr8vvizINHhKHQQvTZcqdUDxYXdku/2CJvJNpa6dx6+YkVu dO2tOFB3HdlunJUXuMoUUWdq6FvJXkagED+vRYec3XJ68yYFvz0z3iqsnvstsdvSKIaC 9xKognRHjxbN+TNh2UmvRpJJRwqS7+LM1oZHCZusR8ycuJQGREPLm7lF9yhKX2h5i5wq 7W2RBRVViUpQcG9lRwQzt49a4v+wJ9UfXTeesKcbNqeZYPSNkIsFIJ2ADvfnR+/5un87 lmefxlS6wYbvw233vY2cmBNHnoVdfQ8ak+KtZ6cblmnEO5x5IobyqOH2yTQer8hVTHrK xTjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Tl35yEj3vFr4lnpqN2LCmv10aMtv5m1NyZfC1pcrNgQ=; b=rDHO7rUc1G7M1NgdaCNxDTjRsu832Xo7k1lx4eaEev9gwEDGKOQxeoybu9aWjUJcNi bkWxLw7UuEWW6NSuBWXj0n2I7K41j+p0MuAsfOZ/8sUaL014TjGS1s8CLIUK7A+Zrq0d CsQipE0pBbNZgtjcqxve7/LKlUI/eY3uALLiOwmr7pHEuhDtyAbl9ufEP+2B+UwHclH4 9tZGPKc7kAkAxTcgVQjLppk2q17REMySBbrJmNNJxNg0I2PHVKaaR6HqjEDIvcAWbMKh E2KT+ebmWnlJCDdWbAJ7ua63TOOfc++2PXM9qj3jdFTW6b7hsUyVZvp40ubm+b4mGfuv S5HQ== X-Gm-Message-State: AOAM533huo5jo/3WQ8lQdShMpLQZ1iqNWohlG91MT9zusI4jr4ighp2Q ACU3e1LvEhPOVzlSXQFQIdqcYoXe9wgvphWatj8= X-Google-Smtp-Source: ABdhPJwjM49j8i+XfHoLwy4HR+g/2ZH8aBtwHU+BHE59zLWfNJxe4UQH2hQRFNB6IWCLyPf2wxUnUA== X-Received: by 2002:a2e:2a83:: with SMTP id q125mr3223909ljq.242.1599202031489; Thu, 03 Sep 2020 23:47:11 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-98-128-180-79.NA.cust.bahnhof.se. [98.128.180.79]) by smtp.gmail.com with ESMTPSA id i187sm1100194lfd.65.2020.09.03.23.47.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Sep 2020 23:47:10 -0700 (PDT) From: Ulf Hansson To: Peter Zijlstra , "Rafael J . Wysocki" , "Paul E . McKenney" , linux-pm@vger.kernel.org Cc: Thomas Gleixner , Steven Rostedt , Sudeep Holla , Lorenzo Pieralisi , Daniel Lezcano , Lina Iyer , Vincent Guittot , Stephen Boyd , Bjorn Andersson , Ulf Hansson , linux-arm-kernel@lists.infradead.org, Naresh Kamboju Subject: [PATCH] cpuidle: psci: Fix suspicious RCU usage Date: Fri, 4 Sep 2020 08:47:05 +0200 Message-Id: <20200904064705.239614-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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 --- drivers/cpuidle/cpuidle-psci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.25.1 Acked-by: Paul E. McKenney 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();