linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lina Iyer <lina.iyer@linaro.org>
To: Rob Herring <robherring2@gmail.com>
Cc: "Rafael Wysocki" <rjw@rjwysocki.net>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Kevin Hilman" <khilman@linaro.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Krzysztof Kozłowski" <k.kozlowski@samsung.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	msivasub@codeaurora.org, "Andy Gross" <agross@codeaurora.org>,
	"Stephen Boyd" <sboyd@codeaurora.org>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Daniel Lezcano" <daniel.lezcano@linaro.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>
Subject: Re: [PATCH v2 1/2] ARM: common: Introduce PM domains for CPUs/clusters
Date: Thu, 13 Aug 2015 14:12:48 -0600	[thread overview]
Message-ID: <20150813201248.GB84868@linaro.org> (raw)
In-Reply-To: <CAL_JsqLcSs79bnj4ELN0uiwJ6gxt46PghxvuGQ7prkq-4gLKhg@mail.gmail.com>

On Thu, Aug 13 2015 at 11:29 -0600, Rob Herring wrote:
>On Wed, Aug 12, 2015 at 2:00 PM, Lina Iyer <lina.iyer@linaro.org> wrote:
>> Define and add Generic PM domains (genpd) for CPU clusters. Many new
>> SoCs group CPUs as clusters. Clusters share common resources like GIC,
>> power rail, caches, VFP, Coresight etc. When all CPUs in the cluster are
>> idle, these shared resources may also be put in their idle state.
>>
>> The idle time between the last CPU entering idle and a CPU resuming
>> execution is an opportunity for these shared resources to be powered
>> down. Generic PM domain provides a framework for defining such power
>> domains and attach devices to the domain. When the devices in the domain
>> are idle at runtime, the domain would also be suspended and resumed
>> before the first of the devices resume execution.
>>
>> We define a generic PM domain for each cluster and attach CPU devices in
>> the cluster to that PM domain. The DT definitions for the SoC describe
>> this relationship. Genpd callbacks for power_on and power_off can then
>> be used to power up/down the shared resources for the domain.
>>
>> Cc: Stephen Boyd <sboyd@codeaurora.org>
>> Cc: Kevin Hilman <khilman@linaro.org>
>> Cc: Ulf Hansson <ulf.hansson@linaro.org>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
>> Cc: Mark Rutland <mark.rutland@arm.com>
>> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
>> Signed-off-by: Kevin Hilman <khilman@linaro.org>
>> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
>> ---
>> Changes since v1:
>>
>> - Function name changes and split out common code
>> - Use cpu,pd for now. Removed references to ARM. Open to recommendations.
>> - Still located in arch/arm/common/. May move to a more appropriate location.
>> - Platform drivers can directly call of_init_cpu_domain() without using
>>   compatibles.
>> - Now maintains a list of CPU PM domains.
>
>[...]
>
>> +static int __init of_pm_domain_attach_cpus(void)
>> +{
>> +       int cpuid, ret;
>> +
>> +       /* Find any CPU nodes with a phandle to this power domain */
>> +       for_each_possible_cpu(cpuid) {
>> +               struct device *cpu_dev;
>> +               struct of_phandle_args pd_args;
>> +
>> +               cpu_dev = get_cpu_device(cpuid);
>> +               if (!cpu_dev) {
>> +                       pr_warn("%s: Unable to get device for CPU%d\n",
>> +                                       __func__, cpuid);
>> +                       return -ENODEV;
>> +               }
>> +
>> +               /*
>> +                * We are only interested in CPUs that can be attached to
>> +                * PM domains that are cpu,pd compatible.
>> +                */
>
>Under what conditions would the power domain for a cpu not be cpu,pd compatible?
>
Mostly never. But I dont want to assume and attach a CPU to its domain
that I am not concerned with.

>Why can't the driver handling the power domain register with gen_pd
>and the cpu_pd as the driver is going to be aware of which domains are
>for cpus.
They could and like Renesas they would. They could have an intricate
hierarchy of domains that they may want to deal with in their platform
drivers. Platforms could define the CPU devices as IRQ-safe and attach
it to their domains. Ensure the reference count of the online and
running CPUs are correct and they are good to go. They also would attach
the CPU devices to the domain and everything would work as they would
here. Its just repeated code across platforms that we are trying to
avoid.

>While there could be h/w such that all power domains within
>a chip have a nice uniform programming model, I'd guess that is the
>exception, not the rule. First, chips I have worked on were not that
>way. CPU related and peripheral related domains are handled quite
>differently. 
>
Agreed. These are very SoC specific components and would require
platform specific programming. But most SoCs, would need to do many
other things like suspending debuggers, reducing clocks, GIC save and
restore, cluster state determination etc that are only getting more
generalized. We have generalized ARM CPU idle, I see this as the
platform for the next set of power saving in an SoC.

>Second, often the actions on the CPU power domains don't
>take effect until a WFI, so you end up with a different programming
>sequence.
>
How so? The last core going down (in this case, when the domain is
suspended the last core is the last device that does a _put() on the
domain) would determine and perform the power domain's programming
sequence, in the context of the last CPU. A sequence that would only be
effected in hardware when the the CPU executes WFI. I dont see why it
would be any different than how it is today.

Thanks,
Lina

  reply	other threads:[~2015-08-13 20:12 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04 23:35 [PATCH 0/9] ARM: PM / Domains: Generic PM domains for CPUs/Clusters Lina Iyer
2015-08-04 23:35 ` [PATCH 1/9] PM / Domains: Allocate memory outside domain locks Lina Iyer
2015-08-12 19:47   ` Kevin Hilman
2015-09-01 12:40   ` Ulf Hansson
2015-08-04 23:35 ` [PATCH 2/9] PM / Domains: Remove dev->driver check for runtime PM Lina Iyer
2015-08-12 19:50   ` Kevin Hilman
2015-08-13  8:57     ` Geert Uytterhoeven
2015-08-14  3:40       ` Kevin Hilman
2015-08-14  7:24         ` Geert Uytterhoeven
2015-08-14 17:19           ` Kevin Hilman
2015-08-16  9:24             ` Geert Uytterhoeven
2015-08-21 21:04               ` Kevin Hilman
2015-08-24 19:50                 ` Lina Iyer
2015-08-25  9:24                   ` Geert Uytterhoeven
2015-09-01 13:28   ` Ulf Hansson
2015-08-04 23:35 ` [PATCH 3/9] PM / Domains: Support IRQ safe PM domains Lina Iyer
2015-08-12 20:12   ` Kevin Hilman
2015-08-12 20:47     ` Lina Iyer
2015-08-12 23:03   ` Stephen Boyd
2015-08-04 23:35 ` [PATCH 4/9] kernel/cpu_pm: fix cpu_cluster_pm_exit comment Lina Iyer
2015-08-12 20:13   ` Kevin Hilman
2015-08-04 23:35 ` [PATCH 5/9] ARM: common: Introduce PM domains for CPUs/clusters Lina Iyer
2015-08-06  3:14   ` Rob Herring
2015-08-07 23:45     ` Kevin Hilman
2015-08-11 13:07       ` Geert Uytterhoeven
2015-08-11 15:58         ` Lina Iyer
2015-08-11 20:12           ` Rob Herring
2015-08-11 22:29             ` Lina Iyer
2015-08-12 19:00             ` [PATCH v2 1/2] " Lina Iyer
2015-08-13 17:29               ` Rob Herring
2015-08-13 20:12                 ` Lina Iyer [this message]
2015-08-13 22:01                   ` Rob Herring
2015-08-14 14:38                     ` Lina Iyer
2015-08-12 19:00             ` [PATCH v2 2/2] ARM: domain: Add platform handlers for CPU PM domains Lina Iyer
2015-08-13 15:01     ` [PATCH 5/9] ARM: common: Introduce PM domains for CPUs/clusters Lorenzo Pieralisi
2015-08-13 15:45       ` Lina Iyer
2015-08-13 15:52         ` Lorenzo Pieralisi
2015-08-13 16:22           ` Lina Iyer
2015-08-14  3:51           ` Kevin Hilman
2015-08-14  4:02             ` Lina Iyer
2015-08-14 15:49             ` Lorenzo Pieralisi
2015-08-14 19:11               ` Kevin Hilman
2015-08-13 17:26         ` Sudeep Holla
2015-08-13 19:27           ` Lina Iyer
2015-08-14  9:52             ` Sudeep Holla
2015-08-04 23:35 ` [PATCH 6/9] ARM: domain: Add platform handlers for CPU PM domains Lina Iyer
2015-08-05 14:45   ` Rob Herring
2015-08-05 16:38     ` Lina Iyer
2015-08-05 19:23     ` Lina Iyer
2015-08-06  3:01       ` Rob Herring
2015-08-10 15:36         ` Lina Iyer
2015-08-04 23:35 ` [PATCH 7/9] ARM: cpuidle: Add runtime PM support for CPU idle Lina Iyer
2015-08-04 23:35 ` [PATCH 8/9] ARM64: smp: Add runtime PM support for CPU hotplug Lina Iyer
2015-08-04 23:35 ` [PATCH 9/9] ARM: " Lina Iyer
2015-08-12 20:28   ` Kevin Hilman
2015-08-12 20:43     ` Lina Iyer
2015-08-14 18:59       ` Kevin Hilman
2015-08-12 23:47   ` Stephen Boyd
2015-08-13 16:00     ` Lina Iyer
2015-08-13 19:18       ` Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150813201248.GB84868@linaro.org \
    --to=lina.iyer@linaro.org \
    --cc=agross@codeaurora.org \
    --cc=catalin.marinas@arm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=geert@linux-m68k.org \
    --cc=k.kozlowski@samsung.com \
    --cc=khilman@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=msivasub@codeaurora.org \
    --cc=rjw@rjwysocki.net \
    --cc=robherring2@gmail.com \
    --cc=sboyd@codeaurora.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).