linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Lina Iyer <ilina@codeaurora.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Kevin Hilman <khilman@kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Benjamin Gaignard <benjamin.gaignard@st.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] PM / Domains: Add support for PM domain on/off notifiers for genpd
Date: Mon, 21 Sep 2020 18:11:44 +0200	[thread overview]
Message-ID: <CAJZ5v0jXn-O3xQzpW_0QahDOLeGZC58cCeOnVF66HWAsRNT4zg@mail.gmail.com> (raw)
In-Reply-To: <CAPDyKFrMUf4y5kVjr=dW-wf2kqBwcGePf=55U1Ck8O6tp-OuqQ@mail.gmail.com>

On Wed, Aug 26, 2020 at 8:38 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Tue, 25 Aug 2020 at 18:16, Lina Iyer <ilina@codeaurora.org> wrote:
> >
> > On Wed, Aug 19 2020 at 04:41 -0600, Ulf Hansson wrote:
> > >A device may have specific HW constraints that must be obeyed to, before
> > >its corresponding PM domain (genpd) can be powered off - and vice verse at
> > >power on. These constraints can't be managed through the regular runtime PM
> > >based deployment for a device, because the access pattern for it, isn't
> > >always request based. In other words, using the runtime PM callbacks to
> > >deal with the constraints doesn't work for these cases.
> > >
> > >For these reasons, let's instead add a PM domain power on/off notification
> > >mechanism to genpd. To add/remove a notifier for a device, the device must
> > >already have been attached to the genpd, which also means that it needs to
> > >be a part of the PM domain topology.
> > >
> > >To add/remove a notifier, let's introduce two genpd specific functions:
> > > - dev_pm_genpd_add|remove_notifier()
> > >
> > >Note that, to further clarify when genpd power on/off notifiers may be
> > >used, one can compare with the existing CPU_CLUSTER_PM_ENTER|EXIT
> > >notifiers. In the long run, the genpd power on/off notifiers should be able
> > >to replace them, but that requires additional genpd based platform support
> > >for the current users.
> > >
> > >Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> > >---
> > > drivers/base/power/domain.c | 130 ++++++++++++++++++++++++++++++++++--
> > > include/linux/pm_domain.h   |  15 +++++
> > > 2 files changed, 141 insertions(+), 4 deletions(-)
> > >
> > >diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> > >index 4b787e1ff188..9cb85a5e8342 100644
> > >--- a/drivers/base/power/domain.c
> > >+++ b/drivers/base/power/domain.c
> > >@@ -545,13 +545,21 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
> > >       if (!genpd->gov)
> > >               genpd->state_idx = 0;
> > >
> > >+      /* Notify consumers that we are about to power off. */
> > >+      ret = raw_notifier_call_chain(&genpd->power_notifiers, GENPD_STATE_OFF,
> > >+                                    NULL);
> > >+      if (ret)
> > >+              return ret;
> > >+
> > >       /* Don't power off, if a child domain is waiting to power on. */
> > >-      if (atomic_read(&genpd->sd_count) > 0)
> > >-              return -EBUSY;
> > >+      if (atomic_read(&genpd->sd_count) > 0) {
> > >+              ret = -EBUSY;
> > >+              goto busy;
> > >+      }
> > >
> > >       ret = _genpd_power_off(genpd, true);
> > >       if (ret)
> > >-              return ret;
> > >+              goto busy;
> > >
> > >       genpd->status = GENPD_STATE_OFF;
> > >       genpd_update_accounting(genpd);
> > >@@ -564,6 +572,9 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
> > >       }
> > >
> > >       return 0;
> > >+busy:
> > >+      raw_notifier_call_chain(&genpd->power_notifiers, GENPD_STATE_ON, NULL);
> > It would be helpful to abstract these notification related calls into
> > functions of their own. So, for CPU PM domains, it would help to add
> > RCU_NONIDLE() around the notifiers, allowing the callbacks to add trace
> > functions.
>
> Thanks for the suggestion! It makes perfect sense to me - and would
> also be consistent with how CPU PM notifiers are managed,

So I thought that you wanted to send a v2, but I cannot find it.

Cheers!

  reply	other threads:[~2020-09-21 16:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-19 10:40 [PATCH 0/3] PM / Domains: Add power on/off notifiers for genpd Ulf Hansson
2020-08-19 10:40 ` [PATCH 1/3] PM / Domains: Rename power state enums " Ulf Hansson
2020-08-19 10:40 ` [PATCH 2/3] PM / Domains: Allow to abort power off when no ->power_off() callback Ulf Hansson
2020-08-19 10:40 ` [PATCH 3/3] PM / Domains: Add support for PM domain on/off notifiers for genpd Ulf Hansson
2020-08-25 16:16   ` Lina Iyer
2020-08-26  6:37     ` Ulf Hansson
2020-09-21 16:11       ` Rafael J. Wysocki [this message]
2020-09-22  7:45         ` Ulf Hansson
2020-09-09 22:08   ` Lina Iyer

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=CAJZ5v0jXn-O3xQzpW_0QahDOLeGZC58cCeOnVF66HWAsRNT4zg@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=Lorenzo.Pieralisi@arm.com \
    --cc=benjamin.gaignard@st.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=ilina@codeaurora.org \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=rjw@rjwysocki.net \
    --cc=sboyd@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=ulf.hansson@linaro.org \
    --cc=vincent.guittot@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).