Linux Power Management development
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@baylibre.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	linux-pm@vger.kernel.org, Dhruva Gole <d-gole@ti.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] pmdommain: add support system-wide resume latency constraints
Date: Thu, 11 Jun 2026 12:33:41 -0700	[thread overview]
Message-ID: <7hy0gklvmy.fsf@baylibre.com> (raw)
In-Reply-To: <CAPDyKFrqT6DPUk5yWBDfnebHKTm4rGZp-8ZBRdcvp4r5Vu-PoA@mail.gmail.com>

Ulf Hansson <ulf.hansson@linaro.org> writes:

> On Fri, 6 Feb 2026 at 01:30, Kevin Hilman (TI) <khilman@baylibre.com> wrote:
>>
>> In addition to checking for CPU latency constraints when checking if
>> OK to power down a domain, also check for QoS latency constraints in
>> all devices of a domain and use that in determining the final latency
>> constraint to use for the domain.
>>
>> Since cpu_system_power_down_ok() is used for system-wide suspend, the
>> per-device constratints are only relevant if the LATENCY_SYS QoS flag
>> is set.
>>
>> Signed-off-by: Kevin Hilman (TI) <khilman@baylibre.com>
>> ---
>>  drivers/pmdomain/governor.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 45 insertions(+)
>>
>> diff --git a/drivers/pmdomain/governor.c b/drivers/pmdomain/governor.c
>> index 96737abbb496..bbf59b93c8b6 100644
>> --- a/drivers/pmdomain/governor.c
>> +++ b/drivers/pmdomain/governor.c
>> @@ -13,6 +13,8 @@
>>  #include <linux/cpumask.h>
>>  #include <linux/ktime.h>
>>
>> +#include "core.h"
>> +
>>  static int dev_update_qos_constraint(struct device *dev, void *data)
>>  {
>>         s64 *constraint_ns_p = data;
>> @@ -425,17 +427,60 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd)
>>         return true;
>>  }
>>
>> +/**
>> + * check_device_qos_latency - Callback to check device QoS latency constraints
>> + * @dev: Device to check
>> + * @data: Pointer to s32 variable holding minimum latency found so far
>> + *
>> + * This callback checks if the device has a system-wide resume latency QoS
>> + * constraint and updates the minimum latency if this device has a stricter
>> + * constraint.
>> + *
>> + * Returns: 0 to continue iteration.
>> + */
>> +static int check_device_qos_latency(struct device *dev, void *data)
>> +{
>> +       s32 *min_dev_latency = data;
>> +       enum pm_qos_flags_status flag_status;
>> +       s32 dev_latency;
>> +
>> +       dev_latency = dev_pm_qos_read_value(dev, DEV_PM_QOS_RESUME_LATENCY);
>
> ->cpu_system_power_down_ok() executes in atomic context on a
> PREEMPT_RT configured system.

Oh, right.  Good point.  Thanks for pointing that out!

> dev_pm_qos_read_value() uses spinlocks, which sleep in that configuration.
>
> I don't know the best approach to fix this. Perhaps add a specific
> dev_pm_qos interface that can be used here? Or re-work the code so it
> only applies for !PREEMPT_RT?

There's already a "raw" lockless helper to read the resume latench
(dev_pm_qos_raw_resume_latency), so I'll use that, as well as add a
similar lockless read for the flags.

Thanks for the review,

Kevin

      reply	other threads:[~2026-06-11 19:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06  0:29 [PATCH v2 0/3] PM: QoS/pmdomains: support resume latencies for system-wide PM Kevin Hilman (TI)
2026-02-06  0:29 ` [PATCH v2 1/3] PM / QoS: add flag to indicate latency applies system-wide Kevin Hilman (TI)
2026-02-10 16:57   ` Rafael J. Wysocki
2026-02-06  0:29 ` [PATCH v2 2/3] pmdomain: core: add genpd_for_each_child() helper Kevin Hilman (TI)
2026-03-10 10:09   ` Ulf Hansson
2026-02-06  0:29 ` [PATCH v2 3/3] pmdommain: add support system-wide resume latency constraints Kevin Hilman (TI)
2026-02-11 21:29   ` Kendall Willis
2026-02-26 17:43     ` Kevin Hilman
2026-03-10 10:23   ` Ulf Hansson
2026-06-11 19:33     ` Kevin Hilman [this message]

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=7hy0gklvmy.fsf@baylibre.com \
    --to=khilman@baylibre.com \
    --cc=d-gole@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.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