Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp117816ybg; Mon, 8 Jun 2020 18:06:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzPEn8/HoNuh6LWsiaoP6KmlfqqlsCdOqnSbXTaRblSPYlErqLr/+WzqNC6EJmjUUMGYPi X-Received: by 2002:a05:6402:642:: with SMTP id u2mr24349545edx.230.1591664774538; Mon, 08 Jun 2020 18:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664774; cv=none; d=google.com; s=arc-20160816; b=YINzzx1SHH0On9UNwLJIKFnGNndUz8r9N1HFFTMqfU1blzQzGYBzvZ08swoM271qvS lnoBpdYNNRAb2M/YASwXFdZHQLUbdf641B/Bpadhpfyi/yie62hCOlGHfJzJmZOKbSsF eZXEUP5RzEq4xodxFnpVa2IqbRAuIj1l9Kd1eWTz+uicFS3M6haRML2hk4d3qFBkPrwR EWbxB6SkANBbUf4TpY8OTcjwLdTbasRlnf472enQfEvXKkcozYcNL4fTeB1OQgEcXuQ6 qTb64G4+tscR8DYviBrQgHEnz8G/D5ZoFf1G4KmC9+/Z3NWwcg6RwBK+V1m3a8wIDoUl 0yvg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8/Pno+5sRsuQafzpW4kBBQ3uI3z/SyyOxMXjn+KH7Bs=; b=qWmdzfJZkWawFLmXutc8B6GIaQjYEMKuKy4cANRm0duNa8HCxX0biksiKYZezaEhji kmqwEwxCCK6Pi7hcVNM89KsNjtvRpS0BJQHbm/fOvN/pZWEw7/1chpBd6NiGZv4kK//p VamPA9G3QTcKmKtdHpG7N6oUwMPfzgHB9sCbGicu7hK4p5GoA6h27Er6QczvjYT4QtWf nLpvJ8EC+q5hqAVvZb7MoPAXs867oJS4gK93cdQZLBswJoBLx1Kibqjkt/ulrgsd5esf NVKCvU/eEPX0JCxHAPNVTnWb2Xu9EDc0REcnr/tlP2zThJZN/5l/rBiW1EE+BG7jZ6/6 vriA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=asC0ZA2K; 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 j11si9989390ejv.117.2020.06.08.18.05.51; Mon, 08 Jun 2020 18:06:14 -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=asC0ZA2K; 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 S1728031AbgFHXHw (ORCPT + 99 others); Mon, 8 Jun 2020 19:07:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:51062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727815AbgFHXHM (ORCPT ); Mon, 8 Jun 2020 19:07:12 -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 9E6E520888; Mon, 8 Jun 2020 23:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657631; bh=CnVp9pwpDTm0m2p+hSbXaay1pQhH2Cr6uUvMrwh7L4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asC0ZA2Kf7DQBdLkqrlomrj2p18prOf9rXA/3a50M2saW74UL/sxWig7wuYS/0Trk cj2JzGb8u6WKcAG7IwLwbv2PwcYcx0IvfywyL4gfHw4gR4QyZBjxczCf1hE0GCw887 VIojbkv2t5sHzIVeHdN0ameH6FJGoZM2I96Njzbs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ulf Hansson , Lina Iyer , Sudeep Holla , "Rafael J . Wysocki" , Sasha Levin , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.7 050/274] cpuidle: psci: Fixup execution order when entering a domain idle state Date: Mon, 8 Jun 2020 19:02:23 -0400 Message-Id: <20200608230607.3361041-50-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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