From patchwork Fri Jun 19 14:29:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 191235 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp653323ilo; Fri, 19 Jun 2020 08:57:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbBm57O1arRMSshsTOmfdsFy5o197hBmMW/jxEePzSSou5X+2Gnof4Cjq6d+HgqmmRFhBv X-Received: by 2002:a17:906:69c3:: with SMTP id g3mr4523518ejs.47.1592582259534; Fri, 19 Jun 2020 08:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592582259; cv=none; d=google.com; s=arc-20160816; b=BCrB3GNNOGN7Wys2f2PO8joWfZXPFSs57lIUFOVUI7G78yTLK61BpBI3/vgzH4GT6v AShGKQ4mSmZKo6nRO1bhdbzIaHBMcgrYsvocOZt5xbzIqomwi1yrdaGRZiMlRfBHc2q4 x2e6VBhWpMpo3iCMSJcQqBqWIZVDGhGXCGh5fw/BE7h9T1XVB+PqGhBx/kPdmFw+7oVr ZAvlC6i3rfAkPF9mxPAN3TDvW9cbly3CXwYJeSjcfGX+AdpTgpG7vCNsgVcYtelfNQlc xNw5T9+qqUZ9klqobdK8h1WWm7AD56fSQwHLk7V63YLl1ug9O8nk/iSuYEfQF0/NIVK4 9cAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8/Pno+5sRsuQafzpW4kBBQ3uI3z/SyyOxMXjn+KH7Bs=; b=bMwvowPLoZ24Io/3sk0rv6YdpV21CaLR7dLfDvp/1RGOkKwrvDNn4RUXA1fuyxDMNm AG+PDdr2sNaCm469BSqmGExAm8HG83MHGk+MJYJ+JjRrdxIrMNYH8V8myABB9931LJQ0 OBPhP4/gNwrTX0nDvkY50mESnSFDSGoDxINJSjrJ249xSY72nGdMyw0681kQXYx8AcMZ +Eyt4/ZATpfqo2J0etxzYX+CfOhzudttdmTB90HfbPaRSA/jA9XOzdzNeXGMvG+OXEUP rVT69TYmerixBqnFyy2Kmz5H8hs07IwuiUaUoqHCuTbtyzkTg9ecycyMs6u3V5GTtjA6 KooA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BFlEdOLX; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds7si6148247ejc.717.2020.06.19.08.57.39; Fri, 19 Jun 2020 08:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=BFlEdOLX; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390610AbgFSP53 (ORCPT + 15 others); Fri, 19 Jun 2020 11:57:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:51074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392646AbgFSPUD (ORCPT ); Fri, 19 Jun 2020 11:20:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 50DD42158C; Fri, 19 Jun 2020 15:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580003; bh=CnVp9pwpDTm0m2p+hSbXaay1pQhH2Cr6uUvMrwh7L4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BFlEdOLXyhKdW+rBWaJAAzCdFPhmg/vks6HxEYyqTHhBRe7ZEIbi4qjDDbYkX+2Ps JiYg/NFHwtwvqU2m2n+2iK+FM+GbORR796UdeRPsfMSjjDTBRK1awn2FhlpF+AN2em pshHZqRlMrPLI1FGkHXTLbqV5g7Q+91mNH7UVP4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lina Iyer , Ulf Hansson , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.7 046/376] cpuidle: psci: Fixup execution order when entering a domain idle state Date: Fri, 19 Jun 2020 16:29:24 +0200 Message-Id: <20200619141712.538262919@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ulf Hansson [ Upstream commit 8b7ce5e49049ca78c238f03d70569a73da049f32 ] Moving forward, platforms are going to need to execute specific "last-man" operations before a domain idle state can be entered. In one way or the other, these operations needs to be triggered while walking the hierarchical topology via runtime PM and genpd, as it's at that point the last-man becomes known. Moreover, executing last-man operations needs to be done after the CPU PM notifications are sent through cpu_pm_enter(), as otherwise it's likely that some notifications would fail. Therefore, let's re-order the sequence in psci_enter_domain_idle_state(), so cpu_pm_enter() gets called prior pm_runtime_put_sync(). Fixes: ce85aef570df ("cpuidle: psci: Manage runtime PM in the idle path") Reported-by: Lina Iyer Signed-off-by: Ulf Hansson Acked-by: Sudeep Holla Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/cpuidle/cpuidle-psci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index bae9140a65a5..d0fb585073c6 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -58,6 +58,10 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, u32 state; int ret; + ret = cpu_pm_enter(); + if (ret) + return -1; + /* Do runtime PM to manage a hierarchical CPU toplogy. */ pm_runtime_put_sync_suspend(pd_dev); @@ -65,10 +69,12 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, if (!state) state = states[idx]; - ret = psci_enter_state(idx, state); + ret = psci_cpu_suspend_enter(state) ? -1 : idx; pm_runtime_get_sync(pd_dev); + cpu_pm_exit(); + /* Clear the domain state to start fresh when back from idle. */ psci_set_domain_state(0); return ret;