Hi folks, I'm trying to start a conversation with Lina about using the power-domains DT bindings for describing the EAS power model. Partly because I'm still waiting for fossmail approval so I can't send this email to anyone without an @arm.com address, I wanted to circulate a draft internally before I make a fool of myself pubicly; does this mail make sense to you guys (also please let me know if I'm egregiously breaking linux-pm etiquette)? Cheers, Brendan ====================================================================== Hi Lina, Mark, I'm currently investigating a generic way of expressing in DT the power costs of CPU idle states, for use by the energy model for Energy Aware Scheduling (EAS) [1][2]. Essentially what I want to do is probably add a "power-usage" property to idle state nodes. I have heard that you and/or Kevin Hilman have actually experimented with something similar. However, the model is required to be topologically aware: for each idle state, we want to know the power usage of the CPU, as well as of the cluster-level resources it shares. This has led me to this patchset, since the CPU power domain bindings allow you to tell which topology level "owns" an idle state. I guess my point here is that these bindings have another use-case besides OS-coordinated cluster idle. I've hacked up a patch (attached) for my experimentation which allows the bindings as described in this mail to be used without any of the actual CPU Runtime PM implementation I share Mark's concern about the duplication between cpu-idle-states in CPU nodes and power-states in power domain nodes. As I understand it, with this patchset the boundary between cpu-idle-states and power-states nodes translates to the boundary between states managed by cpuidle and states managed by Runtime PM. Mark hinted at a solution where idle state nodes refer to the power domains they affect. I guess this solution would look something like: CPU_0: cpu@0 { compatible = "example-cpu"; reg = <0x0 0x0>; device_type = "cpu"; enable-method = "psci"; cpu-idle-states = <&CPU_SLEEP &CLUSTER_SLEEP>; power-domains = <&CLUSTER_PD>; }; /* ... elsewhere ... */ idle-states { CPU_SLEEP: cpu-sleep { compatible = "arm,idle-state"; arm,psci-suspend-param = <0x0010000>; entry-latency-us = <100>; exit-latency-us = <250>; min-residency-us = <150>; }; CLUSTER_SLEEP: cluster-sleep { compatible = "arm,idle-state"; arm,psci-suspend-param = <0x1010000>; entry-latency-us = <800>; exit-latency-us = <700>; min-residency-us = <2500>; affects-power-domains = <&CLUSTER_PD> }; }; Then if desired/necessary, CLUSTER_SLEEP can be taken care of by Runtime PM (i.e. become a genpd_power_state) rather than cpuidle, the deciding factor being that it has an affects-power-domain property. (In this model, idle state nodes don't have a power-states property at all.) Mark, have I understood you correctly, is that what you were imagining? On 23/06/16 19:39, Lina Iyer wrote: > On Thu, Jun 23 2016 at 12:19 -0600, Mark Rutland wrote: >> On Thu, Jun 23, 2016 at 12:04:51PM -0600, Lina Iyer wrote: >>> Hi Mark, >>> >>> On Thu, Jun 23 2016 at 11:35 -0600, Mark Rutland wrote: >>> >Hi, >>> > >>> >On Wed, Jun 22, 2016 at 01:36:37PM -0600, Lina Iyer wrote: >>> >>From: Axel Haslam >>> >> >>> >>Update DT bindings to describe idle states of PM domains. >>> >> >>> >>Cc: >>> >>Signed-off-by: Marc Titinger >>> >>Signed-off-by: Lina Iyer >>> >>[Lina: Added state properties, removed state names, wakeup-latency, >>> >>added of_pm_genpd_init() API, pruned commit text] >>> >>Signed-off-by: Ulf Hansson >>> >>[Ulf: Moved around code to make it compile properly, rebased on top >>> of multiple state support] >>> >>--- >>> >> .../devicetree/bindings/power/power_domain.txt | 70 >>> ++++++++++++++++++++++ >>> >> 1 file changed, 70 insertions(+) >>> >> >>> >>diff --git >>> a/Documentation/devicetree/bindings/power/power_domain.txt >>> b/Documentation/devicetree/bindings/power/power_domain.txt >>> >>index 025b5e7..41e8dda 100644 >>> >>--- a/Documentation/devicetree/bindings/power/power_domain.txt >>> >>+++ b/Documentation/devicetree/bindings/power/power_domain.txt >>> >>@@ -29,6 +29,43 @@ Optional properties: >>> >> specified by this binding. More details about power domain >>> specifier are >>> >> available in the next section. >>> >> >>> >>+- power-states : A phandle of an idle-state that shall be soaked >>> into a >>> >>+ generic domain power state. >>> > >>> >It's somewhat unfortunate that this gives us two possible locations for >>> >idle state lists (under the /cpus node and in a pm-domains node), >>> >especially as it's not clear what would happen were a DT to have both. >>> > >>> >I would prefer that we extend the existing bindings such that states >>> can >>> >refer to the power domains which they affect. >>> > >>> I agree. The CPU idle states have become defined to be specific to CPUs. >>> PM Domain idle states are generic for any type of domain. I am hoping at >>> some point, we could converge and use the same idle state, but that >>> would mean changing the CPU idle states to make it generic. >> >> Outside of CPU idling, I don't fully understand how this will be used, >> so it's not clear to me what would need to be made generic. Apologies >> for my ignorance there. >> > There may be non-PSCI ARM v7 CPU domains that may have domain controller > drivers in the kernel. They would not hook into the ARM PSCI frameworks. > It is still cpuidle though. > Apologies also for my ignorance, but I don't think I understand you here. It sounds to me like the drivers you're describing are currently unable to get their idle states from DT - is that correct? If so, perhaps we can implement support using the CPU idle state nodes at first, then later make them generic so that these non-PSCI domains can use DT. >>> At some point, during my development, I did use the arm,idle-state for >>> domains as well, but the binding definitions were too restrictive for >>> a generic PM domain. >>> >>> I would be willing to make the change to CPU idle states to make it >>> generic and then we could just reference domain and CPU idle states >>> using the same bindings. Are we okay with that, specifically, >>> arm,psci-suspend-param? This binding is very restrictive in its >>> description. What we pass to the platform driver upon choosing a domain >>> state is very platform specific and therefore has to be generic in its >>> description. >> >> I was suggesting that for PSCI we should consistently us >> arm,psci-suspend-param, not that this should be used for all power >> domain state data. >> >> I imagine that mechanisms for powering down power domains will have >> varied requirements on data they require (and may require more than can >> be encoded in a u32), and I don't think it's best to try to force a >> single representation in the DT for that. It would be better to allow >> them to define the properties which they require. >> > The only way to do that is to push the DT parsing to the platform > drivers. In the case of CPU domains controlled by PSCI, we could use the > arm,idle-states but any other generic domain, may need to define their > own bindings and fill up the domain states before initiailizing the domain. > > While this approach pushes the onus on to the platform code, I am fine > with it. Is that what you were thinking too? [1] http://www.linaro.org/blog/core-dump/energy-aware-scheduling-eas-progress-update/ [2] https://lkml.org/lkml/2015/7/7/754 IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.