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=-8.2 required=3.0 tests=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_SANE_1 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 4961DC3F2D1 for ; Wed, 4 Mar 2020 12:23:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 1D8DC21741 for ; Wed, 4 Mar 2020 12:23:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="V+wB5j9C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D8DC21741 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LR3jgHE2AKiZQ+THT0t1C7jtGwdPQjWywvrnceLDygA=; b=V+wB5j9CHTSmvb CddNxzjZnXGwtIevWAYdQBVXZz97OpfA/u4ArofZ2C7sjkTz1V+6F0N6Fb8t+SJjiC9N0KV+MafpY CT+aEHVngTI9mymytT2e03ubEv+SfAE4QVmWab+DIOFGoRKM9KuWg4w295nc3aV+F3qKYzyUqHLPd u1RUhVkn1IoW5rIZ/lO7efikqJZcLR6O/L8m9TeKiH0shIDLOh4CTCWKFNN6+DguYWPxH0l2IouQ2 VPUhTNKl0KsVSW12NhwnIIKNJAQr+nDh4aHP8hGbcGDfPEK/a0uNCGHos5FlOf27PAJ6uY5I9YNvT kBhwn7XMu6BCxE/3bHBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j9T3Y-00070p-6w; Wed, 04 Mar 2020 12:23:20 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j9T3U-000705-Fz for linux-arm-kernel@lists.infradead.org; Wed, 04 Mar 2020 12:23:17 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C4C6331B; Wed, 4 Mar 2020 04:23:15 -0800 (PST) Received: from bogus (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3B76E3F534; Wed, 4 Mar 2020 04:23:14 -0800 (PST) Date: Wed, 4 Mar 2020 12:23:12 +0000 From: Sudeep Holla To: Ulf Hansson Subject: Re: [PATCH v2 4/4] cpuidle: psci: Allow WFI to be the only state for the hierarchical topology Message-ID: <20200304122312.GE25004@bogus> References: <20200303203559.23995-1-ulf.hansson@linaro.org> <20200303203559.23995-5-ulf.hansson@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200303203559.23995-5-ulf.hansson@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200304_042316_616235_EE0A34E7 X-CRM114-Status: GOOD ( 22.05 ) 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: Lorenzo Pieralisi , Benjamin Gaignard , linux-pm@vger.kernel.org, Stephen Boyd , Daniel Lezcano , "Rafael J . Wysocki" , Lina Iyer , Bjorn Andersson , Sudeep Holla , 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+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org The $subject is bit confusing. IIUC, if there are no idle states to manage including hierarchical domain states you will not register the driver right ? If so, you are not allowing WFI to be the only state, hence my concern with $subject. On Tue, Mar 03, 2020 at 09:35:59PM +0100, Ulf Hansson wrote: > It's possible that only the WFI state is supported for the CPU, while also > a shared idle state exists for a group of CPUs. > > When the hierarchical topology is used, the shared idle state may not be > compatible with arm,idle-state, rather with "domain-idle-state", which > makes dt_init_idle_driver() to return zero. This leads to that the > cpuidle-psci driver bails out during initialization, avoiding to register a > cpuidle driver and instead relies on the default architectural back-end > (called via cpu_do_idle()). In other words, the shared idle state becomes > unused. > > Let's fix this behaviour, by allowing the dt_init_idle_driver() to return 0 > and then continue with the initialization. If it turns out that the > hierarchical topology is used and we have some additional states to manage, > then continue with the cpuidle driver registration, otherwise bail out as > before. > > Reported-by: Benjamin Gaignard > Fixes: a65a397f2451 ("cpuidle: psci: Add support for PM domains by using genpd") > Signed-off-by: Ulf Hansson > --- > > Changes in v2: > - Convert the error code returned from psci_cpu_suspend_enter() into an > expected error code by cpuidle core. > > --- > drivers/cpuidle/cpuidle-psci.c | 48 +++++++++++++++++++++------------- > 1 file changed, 30 insertions(+), 18 deletions(-) > > diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c > index bae9140a65a5..ae0fabec2742 100644 > --- a/drivers/cpuidle/cpuidle-psci.c > +++ b/drivers/cpuidle/cpuidle-psci.c > @@ -56,16 +56,19 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev, > u32 *states = data->psci_states; > struct device *pd_dev = data->dev; > u32 state; > - int ret; > + int ret = 0; > > /* Do runtime PM to manage a hierarchical CPU toplogy. */ > pm_runtime_put_sync_suspend(pd_dev); > > state = psci_get_domain_state(); > - if (!state) > + if (!state && states) > state = states[idx]; > > - ret = psci_enter_state(idx, state); > + if (state) > + ret = psci_cpu_suspend_enter(state) ? -1 : idx; > + else > + cpu_do_idle(); May be, I haven't followed this completely yet, but I don't want to be in the position to replicated default arch idle hook. Just use the one that exist by simply not registering the driver. -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel