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=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT 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 15E09C43461 for ; Fri, 4 Sep 2020 06:48:27 +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 CDFC620722 for ; Fri, 4 Sep 2020 06:48:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hmvnh1pw"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="W9cO6wDP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CDFC620722 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Su1DCT0hopVEMwy91O6YuEqZdryoz6M9I1yLcinXNmo=; b=hmvnh1pwF8oxA08lxAXYg6ZMIS ojJf9Nx0GY97RWBY1/EVtGX7DvXLAsRII1iZO7ONwHkM9JiOIhq1HR5Ib1G+XjuF8yv+t4Y6vNhZJ SPwkM7YIJ8DKHStKhWy1bhNPZ6g0gc6v80wxzB1YwDGHYQT+2V0YiVYmSshrXAiqUrcpCd+mzWlwd DnzXUlWc4vNInSd1InmAuhB/4q1Fg9p300pQ/NW0yPXiZo7HrZPVRbz6Yin5rFpRr3gbwouJHZVBO HyqlX7rEZFwhNLYY5R0QtfmWwly61Wj9Fnl8DZ0iN51oOFrt7xZ/1ANOqAvya/EtrDSv0FjjHQGUi wZYGsKJg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kE5VF-0003fg-5J; Fri, 04 Sep 2020 06:47:17 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kE5VB-0003dt-1y for linux-arm-kernel@lists.infradead.org; Fri, 04 Sep 2020 06:47:15 +0000 Received: by mail-lj1-x242.google.com with SMTP id t23so6670336ljc.3 for ; Thu, 03 Sep 2020 23:47:12 -0700 (PDT) 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=cvOUZbYP2XFID+0YwjA0ERYMem42nM/67HWAKJ0W7HzFXlC+y9SslIVAWlgh8Oge4A wH78RAiYcuMvrPD8vs2/6xSCxmYmVOZoGhLWSdtb5P6ast/Q2jIN3UUlfeBoE0M3UX/X scLxQf0YZu03oJQWrhmGf87dn4g1jqCRQet97HA6fpN/SeS6HWLweK/tpWzug7rvDLi/ LglQgHow5OzDrZBLLpJtWZjm3C2/4yx4fzT6C1FM8OEIe5kUmbWKGoxjewFC7pA+NT5p Xl7fEhpps0QY3ii/wP7wCkS/A0U71brsr6Oz4NhyBGhKn1tCAm9xavyyr2vxjXyytdXk cyvg== X-Gm-Message-State: AOAM530TJ0Bzgaf4Jie+OZFiU7SVwbQdFRxAlJ9Nz0KwceaCLBTVMQCV EIRaq//JqJSOzqsPoXVz0sksGw== 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) 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200904_024713_432446_B281FC4B X-CRM114-Status: GOOD ( 16.84 ) 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: , Cc: Ulf Hansson , Lorenzo Pieralisi , Vincent Guittot , Stephen Boyd , Naresh Kamboju , Daniel Lezcano , Lina Iyer , Bjorn Andersson , Steven Rostedt , 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 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(-) 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