Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp596462ybt; Fri, 19 Jun 2020 09:00:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3tspDgsE3LiE4gHyqwZL4EkOTS//AJHlPdtInBG/ycTwZV1K6xGqbcYljai7DxxNx/RuW X-Received: by 2002:a17:906:b28e:: with SMTP id q14mr4197875ejz.484.1592582437598; Fri, 19 Jun 2020 09:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592582437; cv=none; d=google.com; s=arc-20160816; b=fpusZYv9Yz3fxve8M48M/EFtosbUW178iYBZ3FdRQBp5fyNaI86kDPioyvKbnnILDA oNY85dHFkJ1O/dG51wf9aSE2TP7AVaTYDNb6LwWTtKWjn0Cu8urvkqhkQutyx3Q+uJwj KK15TkfpkwmDhUKiQzt54zs0K2MYCLodSH/Na4IaEFyvhR20YWqpDsnNLrcMtxkMCyPv d/TAcSi3+G2/jbgAcm6bW3PLOQtg4+o8sS9cWDdd+VRQHDxB5dao97Cz8reLY8tO/Vpn p7nAUTZxrLqZzL2f5CBq5QlcngyojUJNa9lhUjsnAxizEBfLKfhLIbUVqiCkq1vzTwfV oI0g== 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=A5HpX/RzTtUFVpNfY5lMfavtDSMK1UPw9WVT9hqoP9MVi2kXHURdJyM1aL8luHlott oZcrnrHzIQV90XpKiDntPcByTf6DzpztLtb60bb5IGX5PVQbVUtPF/bAkohqoR8da5h/ zNhf2ObQAtkjZWQQxZDoBoPqNsTKot1kguqocP30MS9Dat3bf7N0HBv4IelwOhU8NzGM 7pku/BJG67qnySFEqnj/JnMIEanFzXnKe5RrLad3UWa1i/WPFfHE6W1jw0FSwfXKuRUr lgdRT1CkIQxjmnBexWTzoLm+hdtHGr+j71XpUfuCO/J0AtahhdOaAtFk/c4CYK9TgoWb d90A== 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 linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 w14si4431699ede.41.2020.06.19.09.00.14; Fri, 19 Jun 2020 09:00:37 -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=BFlEdOLX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392718AbgFSP5d (ORCPT + 99 others); Fri, 19 Jun 2020 11:57:33 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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; -- 2.25.1