linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lina Iyer <ilina@codeaurora.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux PM <linux-pm@vger.kernel.org>,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH v6 1/3] PM / Domains: add domain feature flag for next wakeup
Date: Mon, 4 Jan 2021 08:54:18 -0700	[thread overview]
Message-ID: <X/M6KheIV5ES68V1@codeaurora.org> (raw)
In-Reply-To: <CAPDyKFr0+Hzod+cq1gBN66O-Tvt5RAB2aK=rzcqGaPF41TMRnQ@mail.gmail.com>

On Tue, Dec 22 2020 at 06:07 -0700, Ulf Hansson wrote:
>On Mon, 30 Nov 2020 at 23:51, Lina Iyer <ilina@codeaurora.org> wrote:
>>
>> PM domains may support entering multiple power down states when the
>> component devices and sub-domains are suspended. Also, they may specify
>> the residency value for an idle state, only after which the idle state
>> may provide power benefits. If the domain does not specify the residency
>> for any of its idle states, the governor's choice is much simplified.
>>
>> Let's make this optional with the use of a PM domain feature flag.
>>
>> Signed-off-by: Lina Iyer <ilina@codeaurora.org>
>> ---
>> Changes in v6:
>>         - New patch based on discussions on v5 of the series
>> ---
>>  drivers/base/power/domain.c | 18 ++++++++++++++++++
>>  include/linux/pm_domain.h   | 28 ++++++++++++++++++++++------
>>  2 files changed, 40 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>> index 1b0c9ccbbe1f..1e6c0bf1c945 100644
>> --- a/drivers/base/power/domain.c
>> +++ b/drivers/base/power/domain.c
>> @@ -1748,6 +1748,24 @@ int dev_pm_genpd_remove_notifier(struct device *dev)
>>  }
>>  EXPORT_SYMBOL_GPL(dev_pm_genpd_remove_notifier);
>>
>> +/**
>> + * genpd_enable_next_wakeup - Enable genpd gov to use next_wakeup
>> + *
>> + * @genpd: The genpd to be updated
>> + * @enable: Enable/disable genpd gov to use next wakeup
>> + */
>> +void genpd_enable_next_wakeup(struct generic_pm_domain *genpd, bool enable)
>> +{
>> +       genpd_lock(genpd);
>> +       if (enable)
>> +               genpd->flags |= GENPD_FLAG_GOV_NEXT_WAKEUP;
>> +       else
>> +               genpd->flags &= ~GENPD_FLAG_GOV_NEXT_WAKEUP;
>> +       genpd->next_wakeup = KTIME_MAX;
>> +       genpd_unlock(genpd);
>> +}
>> +EXPORT_SYMBOL_GPL(genpd_enable_next_wakeup);
>> +
>
>Please drop this, as I don't think we need a dedicated function to
>enable this feature.
>
Ah, I responded to the patch #2 regarding this before reading this
email.

>Instead, it seems like a better idea to let the genpd provider set it,
>before it calls pm_genpd_init(), along with its other genpd
>configurations.
>
If we no longer have a need for this feature in the domain, we could
dynamically disable it.

>>  static int genpd_add_subdomain(struct generic_pm_domain *genpd,
>>                                struct generic_pm_domain *subdomain)
>>  {
>> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
>> index 2ca919ae8d36..1f359bd19f77 100644
>> --- a/include/linux/pm_domain.h
>> +++ b/include/linux/pm_domain.h
>> @@ -55,13 +55,19 @@
>>   *
>>   * GENPD_FLAG_RPM_ALWAYS_ON:   Instructs genpd to always keep the PM domain
>>   *                             powered on except for system suspend.
>> + *
>> + * GENPD_FLAG_GOV_NEXT_WAKEUP: Enable the genpd governor to consider its
>> + *                             components' next wakeup when  determining the
>> + *                             optimal idle state. This is setup only if the
>> + *                             domain's idle state specifies a residency.
>>   */
>> -#define GENPD_FLAG_PM_CLK       (1U << 0)
>> -#define GENPD_FLAG_IRQ_SAFE     (1U << 1)
>> -#define GENPD_FLAG_ALWAYS_ON    (1U << 2)
>> -#define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3)
>> -#define GENPD_FLAG_CPU_DOMAIN   (1U << 4)
>> -#define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5)
>> +#define GENPD_FLAG_PM_CLK         (1U << 0)
>> +#define GENPD_FLAG_IRQ_SAFE       (1U << 1)
>> +#define GENPD_FLAG_ALWAYS_ON      (1U << 2)
>> +#define GENPD_FLAG_ACTIVE_WAKEUP   (1U << 3)
>> +#define GENPD_FLAG_CPU_DOMAIN     (1U << 4)
>> +#define GENPD_FLAG_RPM_ALWAYS_ON   (1U << 5)
>> +#define GENPD_FLAG_GOV_NEXT_WAKEUP (1U << 6)
>
>Nitpick.
>
>To me, the configuration is something that corresponds to the genpd,
>rather than the governor (even if it affects it in this case). That
>said, how about just naming the flag something like
>"GENPD_FLAG_MIN_RESIDENCY", as to indicate that the genpd's power off
>states have minimum residencies values that may deserve to be
>considered, while power off.
>
Hmmm..
>>
>>  enum gpd_status {
>>         GENPD_STATE_ON = 0,     /* PM domain is on */
>> @@ -205,6 +211,11 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
>>         return to_gpd_data(dev->power.subsys_data->domain_data);
>>  }
>>
>> +static inline bool genpd_may_use_next_wakeup(struct generic_pm_domain *genpd)
>> +{
>> +       return genpd->flags & GENPD_FLAG_GOV_NEXT_WAKEUP;
>> +}
>
>This can probably be moved into drivers/base/power/domain_governor.c.
>
Okay.
>> +
>>  int pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev);
>>  int pm_genpd_remove_device(struct device *dev);
>>  int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
>> @@ -217,6 +228,7 @@ int pm_genpd_remove(struct generic_pm_domain *genpd);
>>  int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state);
>>  int dev_pm_genpd_add_notifier(struct device *dev, struct notifier_block *nb);
>>  int dev_pm_genpd_remove_notifier(struct device *dev);
>> +void genpd_enable_next_wakeup(struct generic_pm_domain *genpd, bool enable);
>>
>>  extern struct dev_power_governor simple_qos_governor;
>>  extern struct dev_power_governor pm_domain_always_on_gov;
>> @@ -275,6 +287,10 @@ static inline int dev_pm_genpd_remove_notifier(struct device *dev)
>>         return -EOPNOTSUPP;
>>  }
>>
>> +static void genpd_enable_next_wakeup(struct generic_pm_domain *genpd,
>> +                                    bool enable)
>> +{ }
>> +
>>  #define simple_qos_governor            (*(struct dev_power_governor *)(NULL))
>>  #define pm_domain_always_on_gov                (*(struct dev_power_governor *)(NULL))
>>  #endif
>> --
>> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
>> a Linux Foundation Collaborative Project
>>
>
>Kind regards
>Uffe

  reply	other threads:[~2021-01-04 15:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 22:50 [PATCH v6 0/3] Better domain idle from device wakeup patterns Lina Iyer
2020-11-30 22:50 ` [PATCH v6 1/3] PM / Domains: add domain feature flag for next wakeup Lina Iyer
2020-12-22 13:06   ` Ulf Hansson
2021-01-04 15:54     ` Lina Iyer [this message]
2020-11-30 22:50 ` [PATCH v6 2/3] PM / domains: inform PM domain of a device's " Lina Iyer
2020-12-22 13:09   ` Ulf Hansson
2021-01-04 15:43     ` Lina Iyer
2021-01-08 10:07       ` Ulf Hansson
2020-11-30 22:50 ` [PATCH v6 3/3] PM / Domains: use device's next wakeup to determine domain idle state Lina Iyer
2020-12-22 14:41   ` Ulf Hansson
2020-12-08 17:26 ` [PATCH v6 0/3] Better domain idle from device wakeup patterns Rafael J. Wysocki
2020-12-09 10:36   ` Ulf Hansson
2020-12-09 15:18     ` 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=X/M6KheIV5ES68V1@codeaurora.org \
    --to=ilina@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --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).