Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3423942ybi; Fri, 19 Jul 2019 03:04:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9vUxXKaNi/9nEx+FBxb/WSud4YFu2Q6FuV2DiqliAva8J0GJnXMgvGS1QNinc0V2JEgMS X-Received: by 2002:a17:902:2d01:: with SMTP id o1mr57177108plb.105.1563530660440; Fri, 19 Jul 2019 03:04:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563530660; cv=none; d=google.com; s=arc-20160816; b=YK/t/pumJ0/qWC71o8VGRu2AsCXB3I1jMnKc+5rAM4eZnnaOLd701fo3+/mUX6u5e/ lLTikwV4bpk/cY5qLTK9Oi5+mIeWHxn9xKqKTbs7qVvrdrJNgoF+Lp2chJfHSULHijx4 zAtqluXahvW836RzIbisvET5tGM6q1ZzRICpgyKGZd++t+tKhrHFSI0kl0Vf9qs1VuA9 v4SvtzAod2/2Ex3W8iA4pmD2F+eCfDvAizBDFCyRh2tJBzfdkZG+5A/F6xd5hkPR5oyf R7cpsiGq1p5JFXBzbeoh6EHO31sSa+cvpdHkouzlwvTT1icD4uevKxWMZm0X+bRTcxon EGYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=aS9icDVlBr+jQIIvwuDsPt6MGs523UTCC2v03RuoHWQ=; b=vb8gEwMZEBsatLty4meN7iBLFR1Voh29nLV4P+vYWrdu/iDLWiUPW1uncmJXkmphuU PJpKV3JwFHlbOdjby1owu0ViBh5zq2UcWidcaw+p2iWgxk0wafezk9wJiajG7MbFqZtv Ui2fCHrBDIazkVbil5a1U1IwmCEvEYh69bMa95gHA/HqKhpXF1wnAgEeancxnco9GBDK AH6QBoLjaBC1tI2TbMDVEP+Vmv2tDH9bJj4w32qfSrp4Z1OrOtAVivg1rejCU0EUVILd aeVPL2Q4zAqHtv34CzHliYtOtv1b9FlDobj2FS2FVVmadQYvrxx+Nxih3iTLDr5hsIpI unBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si2104107pfd.259.2019.07.19.03.04.04; Fri, 19 Jul 2019 03:04:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727415AbfGSKC5 (ORCPT + 99 others); Fri, 19 Jul 2019 06:02:57 -0400 Received: from foss.arm.com ([217.140.110.172]:41260 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727351AbfGSKC5 (ORCPT ); Fri, 19 Jul 2019 06:02:57 -0400 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 6D6AC337; Fri, 19 Jul 2019 03:02:56 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (unknown [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D8CBE3F59C; Fri, 19 Jul 2019 03:02:53 -0700 (PDT) Date: Fri, 19 Jul 2019 11:02:16 +0100 From: Lorenzo Pieralisi To: Ulf Hansson Cc: Lina Iyer , Sudeep Holla , Mark Rutland , Linux ARM , "Rafael J . Wysocki" , Daniel Lezcano , "Raju P . L . S . S . S . N" , Amit Kucheria , Bjorn Andersson , Stephen Boyd , Niklas Cassel , Tony Lindgren , Kevin Hilman , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , Souvik Chakravarty , Linux PM , linux-arm-msm , Linux Kernel Mailing List Subject: Re: [PATCH 14/18] drivers: firmware: psci: Manage runtime PM in the idle path for CPUs Message-ID: <20190719100216.GA8587@e121166-lin.cambridge.arm.com> References: <20190513192300.653-1-ulf.hansson@linaro.org> <20190513192300.653-15-ulf.hansson@linaro.org> <20190716155317.GB32490@e121166-lin.cambridge.arm.com> <20190718133053.GA27222@e121166-lin.cambridge.arm.com> <20190718174116.GD25567@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 18, 2019 at 11:49:11PM +0200, Ulf Hansson wrote: > On Thu, 18 Jul 2019 at 19:41, Lina Iyer wrote: > > > > On Thu, Jul 18 2019 at 10:55 -0600, Ulf Hansson wrote: > > >On Thu, 18 Jul 2019 at 15:31, Lorenzo Pieralisi > > > wrote: > > >> > > >> On Thu, Jul 18, 2019 at 12:35:07PM +0200, Ulf Hansson wrote: > > >> > On Tue, 16 Jul 2019 at 17:53, Lorenzo Pieralisi > > >> > wrote: > > >> > > > > >> > > On Mon, May 13, 2019 at 09:22:56PM +0200, Ulf Hansson wrote: > > >> > > > When the hierarchical CPU topology layout is used in DT, let's allow the > > >> > > > CPU to be power managed through its PM domain, via deploying runtime PM > > >> > > > support. > > >> > > > > > >> > > > To know for which idle states runtime PM reference counting is needed, > > >> > > > let's store the index of deepest idle state for the CPU, in a per CPU > > >> > > > variable. This allows psci_cpu_suspend_enter() to compare this index with > > >> > > > the requested idle state index and then act accordingly. > > >> > > > > >> > > I do not see why a system with two CPU CPUidle states, say CPU retention > > >> > > and CPU shutdown, should not be calling runtime PM on CPU retention > > >> > > entry. > > >> > > > >> > If the CPU idle governor did select the CPU retention for the CPU, it > > >> > was probably because the target residency for the CPU shutdown state > > >> > could not be met. > > >> > > >> The kernel does not know what those cpu states represent, so, this is an > > >> assumption you are making and it must be made clear that this code works > > >> as long as your assumption is valid. > > >> > > >> If eg a "cluster" retention state has lower target_residency than > > >> the deepest CPU idle state this assumption is wrong. > > > > > >Good point, you are right. I try to find a place to document this assumption. > > > > > >> > > >> And CPUidle and genPD governor decisions are not synced anyway so, > > >> again, this is an assumption, not a certainty. > > >> > > >> > In this case, there is no point in allowing any other deeper idle > > >> > states for cluster/package/system, since those have even greater > > >> > residencies, hence calling runtime PM doesn't make sense. > > >> > > >> On the systems you are testing on. > > > > > >So what you are saying typically means, that if all CPUs in the same > > >cluster have entered the CPU retention state, on some system the > > >cluster may also put into a cluster retention state (assuming the > > >target residency is met)? > > > > > >Do you know of any systems that has these characteristics? > > > > > Many QCOM SoCs can do that. But with the hardware improving, the > > power-performance benefits skew the results in favor of powering off > > the cluster than keeping the CPU and cluster in retention. > > > > Kevin H and I thought of this problem earlier on. But that is a second > > level problem to solve and definitely to be thought of after we have the > > support for the deepest states in the kernel. We left that out for a > > later date. The idea would have been to setup the allowable state(s) in > > the DT for CPU and cluster state definitions and have the genpd take > > that into consideration when deciding the idle state for the domain. > > Thanks for confirming. > > This more or less means we need to improve the hierarchical support in > genpd to support more levels, such that it makes sense to have a genpd > governor assigned at more than one level. This doesn't work well > today. As I also have stated, this is on my todo list for genpd. > > However, I also agree with your standpoint, that let's start simple to > enable the deepest state as a start with, then we can improve things > on top. How to solve this in the kernel I don't know but please do make sure that the DT bindings allow you to describe what's needed, once they are merged you won't be able to change them and I won't bodge the code to make things fit, so if anything let's focus on getting them right as a matter of priority to get this done please. Thanks, Lorenzo