* [PATCH] cpufreq: CPPC: Mark driver with NEED_UPDATE_LIMITS flag
@ 2025-07-22 5:55 Prashant Malani
2025-07-22 6:03 ` Viresh Kumar
0 siblings, 1 reply; 3+ messages in thread
From: Prashant Malani @ 2025-07-22 5:55 UTC (permalink / raw)
To: open list, open list:CPU FREQUENCY SCALING FRAMEWORK,
Rafael J. Wysocki, Viresh Kumar
Cc: Prashant Malani, Beata Michalska, Rafael J. Wysocki
AMU counters on certain CPPC-based platforms tend to yield inaccurate
delivered performance measurements on systems that are idle/mostly idle.
This results in an inaccurate frequency being stored by cpufreq in its
policy structure when the CPU is brought online. [1]
Consequently, if the userspace governor tries to set the frequency to a
new value, there is a possibility that it would be the erroneous value
stored earlier. In such a scenario, cpufreq would assume that the
requested frequency has already been set and return early, resulting in
the correct/new frequency request never making it to the hardware.
Since the operating frequency is liable to this sort of inconsistency,
mark the CPPC driver with CPUFREQ_NEED_UPDATE_LIMITS so that it is always
invoked when a target frequency update is requested.
[1] https://lore.kernel.org/linux-pm/20250619000925.415528-3-pmalani@google.com/
Cc: Beata Michalska <beata.michalska@arm.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Prashant Malani <pmalani@google.com>
---
drivers/cpufreq/cppc_cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index a1fd0ff22bc5..4a17162a392d 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -910,7 +910,7 @@ static struct freq_attr *cppc_cpufreq_attr[] = {
};
static struct cpufreq_driver cppc_cpufreq_driver = {
- .flags = CPUFREQ_CONST_LOOPS,
+ .flags = CPUFREQ_CONST_LOOPS | CPUFREQ_NEED_UPDATE_LIMITS,
.verify = cppc_verify_policy,
.target = cppc_cpufreq_set_target,
.get = cppc_cpufreq_get_rate,
--
2.50.0.727.gbf7dc18ff4-goog
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: CPPC: Mark driver with NEED_UPDATE_LIMITS flag
2025-07-22 5:55 [PATCH] cpufreq: CPPC: Mark driver with NEED_UPDATE_LIMITS flag Prashant Malani
@ 2025-07-22 6:03 ` Viresh Kumar
2025-07-22 10:15 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2025-07-22 6:03 UTC (permalink / raw)
To: Prashant Malani
Cc: open list, open list:CPU FREQUENCY SCALING FRAMEWORK,
Rafael J. Wysocki, Beata Michalska, Rafael J. Wysocki
On 22-07-25, 05:55, Prashant Malani wrote:
> AMU counters on certain CPPC-based platforms tend to yield inaccurate
> delivered performance measurements on systems that are idle/mostly idle.
> This results in an inaccurate frequency being stored by cpufreq in its
> policy structure when the CPU is brought online. [1]
>
> Consequently, if the userspace governor tries to set the frequency to a
> new value, there is a possibility that it would be the erroneous value
> stored earlier. In such a scenario, cpufreq would assume that the
> requested frequency has already been set and return early, resulting in
> the correct/new frequency request never making it to the hardware.
>
> Since the operating frequency is liable to this sort of inconsistency,
> mark the CPPC driver with CPUFREQ_NEED_UPDATE_LIMITS so that it is always
> invoked when a target frequency update is requested.
>
> [1] https://lore.kernel.org/linux-pm/20250619000925.415528-3-pmalani@google.com/
>
> Cc: Beata Michalska <beata.michalska@arm.com>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Prashant Malani <pmalani@google.com>
> ---
> drivers/cpufreq/cppc_cpufreq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
> index a1fd0ff22bc5..4a17162a392d 100644
> --- a/drivers/cpufreq/cppc_cpufreq.c
> +++ b/drivers/cpufreq/cppc_cpufreq.c
> @@ -910,7 +910,7 @@ static struct freq_attr *cppc_cpufreq_attr[] = {
> };
>
> static struct cpufreq_driver cppc_cpufreq_driver = {
> - .flags = CPUFREQ_CONST_LOOPS,
> + .flags = CPUFREQ_CONST_LOOPS | CPUFREQ_NEED_UPDATE_LIMITS,
> .verify = cppc_verify_policy,
> .target = cppc_cpufreq_set_target,
> .get = cppc_cpufreq_get_rate,
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: CPPC: Mark driver with NEED_UPDATE_LIMITS flag
2025-07-22 6:03 ` Viresh Kumar
@ 2025-07-22 10:15 ` Rafael J. Wysocki
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2025-07-22 10:15 UTC (permalink / raw)
To: Viresh Kumar, Prashant Malani
Cc: open list, open list:CPU FREQUENCY SCALING FRAMEWORK,
Rafael J. Wysocki, Beata Michalska, Rafael J. Wysocki
On Tue, Jul 22, 2025 at 8:03 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 22-07-25, 05:55, Prashant Malani wrote:
> > AMU counters on certain CPPC-based platforms tend to yield inaccurate
> > delivered performance measurements on systems that are idle/mostly idle.
> > This results in an inaccurate frequency being stored by cpufreq in its
> > policy structure when the CPU is brought online. [1]
> >
> > Consequently, if the userspace governor tries to set the frequency to a
> > new value, there is a possibility that it would be the erroneous value
> > stored earlier. In such a scenario, cpufreq would assume that the
> > requested frequency has already been set and return early, resulting in
> > the correct/new frequency request never making it to the hardware.
> >
> > Since the operating frequency is liable to this sort of inconsistency,
> > mark the CPPC driver with CPUFREQ_NEED_UPDATE_LIMITS so that it is always
> > invoked when a target frequency update is requested.
> >
> > [1] https://lore.kernel.org/linux-pm/20250619000925.415528-3-pmalani@google.com/
> >
> > Cc: Beata Michalska <beata.michalska@arm.com>
> > Cc: Viresh Kumar <viresh.kumar@linaro.org>
> > Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Signed-off-by: Prashant Malani <pmalani@google.com>
> > ---
> > drivers/cpufreq/cppc_cpufreq.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
> > index a1fd0ff22bc5..4a17162a392d 100644
> > --- a/drivers/cpufreq/cppc_cpufreq.c
> > +++ b/drivers/cpufreq/cppc_cpufreq.c
> > @@ -910,7 +910,7 @@ static struct freq_attr *cppc_cpufreq_attr[] = {
> > };
> >
> > static struct cpufreq_driver cppc_cpufreq_driver = {
> > - .flags = CPUFREQ_CONST_LOOPS,
> > + .flags = CPUFREQ_CONST_LOOPS | CPUFREQ_NEED_UPDATE_LIMITS,
> > .verify = cppc_verify_policy,
> > .target = cppc_cpufreq_set_target,
> > .get = cppc_cpufreq_get_rate,
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Applied as 6.17 material, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-07-22 10:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-22 5:55 [PATCH] cpufreq: CPPC: Mark driver with NEED_UPDATE_LIMITS flag Prashant Malani
2025-07-22 6:03 ` Viresh Kumar
2025-07-22 10:15 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®