[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <803a7bea-68d6-4973-ad2a-0d8721865831@oss.qualcomm.com>
Date: Wed, 9 Jul 2025 14:02:13 +0530
From: "Maulik Shah (mkshah)" <maulik.shah@....qualcomm.com>
To: Ulf Hansson <ulf.hansson@...aro.org>
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH] pmdomain: governor: Consider CPU latency tolerance from
pm_domain_cpu_gov
On 7/8/2025 8:11 PM, Ulf Hansson wrote:
> On Tue, 8 Jul 2025 at 07:15, Maulik Shah <maulik.shah@....qualcomm.com> wrote:
>>
>>
>> diff --git a/drivers/pmdomain/governor.c b/drivers/pmdomain/governor.c
>> index c1e148657c873a6b5b4d9c0f058d54cb020c56e2..d5ac4c1b5b5a432f0072209d17379e58ec891202 100644
>> --- a/drivers/pmdomain/governor.c
>> +++ b/drivers/pmdomain/governor.c
>> @@ -8,6 +8,7 @@
>> #include <linux/pm_domain.h>
>> #include <linux/pm_qos.h>
>> #include <linux/hrtimer.h>
>> +#include <linux/cpu.h>
>> #include <linux/cpuidle.h>
>> #include <linux/cpumask.h>
>> #include <linux/ktime.h>
>> @@ -349,6 +350,8 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd)
>> struct cpuidle_device *dev;
>> ktime_t domain_wakeup, next_hrtimer;
>> ktime_t now = ktime_get();
>> + struct device *device;
>
> Nitpick: Maybe rename to "cpu_dev" to better distinguish between the
> cpuidle_device *dev, above?
Updated in v2.
>
>> + s64 cpu_constraint, global_constraint;
>> s64 idle_duration_ns;
>> int cpu, i;
>>
>> @@ -359,6 +362,7 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd)
>> if (!(genpd->flags & GENPD_FLAG_CPU_DOMAIN))
>> return true;
>>
>> + global_constraint = cpu_latency_qos_limit();
>> /*
>> * Find the next wakeup for any of the online CPUs within the PM domain
>> * and its subdomains. Note, we only need the genpd->cpus, as it already
>> @@ -372,8 +376,16 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd)
>> if (ktime_before(next_hrtimer, domain_wakeup))
>> domain_wakeup = next_hrtimer;
>> }
>> +
>> + device = get_cpu_device(cpu);
>> + if (device) {
>> + cpu_constraint = dev_pm_qos_read_value(device, DEV_PM_QOS_RESUME_LATENCY);
>
> We should be able to use dev_pm_qos_raw_resume_latency() here, similar
> to how cpuidle_governor_latency_req() does it. I think it's better as
> it avoids acquiring/releasing the spinlock.
Yes, updated to use dev_pm_qos_raw_resume_latency() in v2.
Thanks,
Maulik
Powered by blists - more mailing lists