* [PATCH v3 1/4] cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency [not found] <5069803.31r3eYUQgx@rafael.j.wysocki> @ 2025-09-26 10:12 ` Rafael J. Wysocki 2025-09-28 3:23 ` Shawn Guo 2025-10-01 10:38 ` Qais Yousef 0 siblings, 2 replies; 5+ messages in thread From: Rafael J. Wysocki @ 2025-09-26 10:12 UTC (permalink / raw) To: Linux PM Cc: Shawn Guo, Qais Yousef, LKML, Viresh Kumar, Pierre Gondois, Mario Limonciello, Linux ACPI, Jie Zhan, rust-for-linux, Miguel Ojeda, Alex Gaynor From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Commit a755d0e2d41b ("cpufreq: Honour transition_latency over transition_delay_us") caused platforms where cpuinfo.transition_latency is CPUFREQ_ETERNAL to get a very large transition latency whereas previously it had been capped at 10 ms (and later at 2 ms). This led to a user-observable regression between 6.6 and 6.12 as described by Shawn: "The dbs sampling_rate was 10000 us on 6.6 and suddently becomes 6442450 us (4294967295 / 1000 * 1.5) on 6.12 for these platforms because the default transition delay was dropped [...]. It slows down dbs governor's reacting to CPU loading change dramatically. Also, as transition_delay_us is used by schedutil governor as rate_limit_us, it shows a negative impact on device idle power consumption, because the device gets slightly less time in the lowest OPP." Evidently, the expectation of the drivers using CPUFREQ_ETERNAL as cpuinfo.transition_latency was that it would be capped by the core, but they may as well return a default transition latency value instead of CPUFREQ_ETERNAL and the core need not do anything with it. Accordingly, introduce CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS and make all of the drivers in question use it instead of CPUFREQ_ETERNAL. Also update the related Rust binding. Fixes: a755d0e2d41b ("cpufreq: Honour transition_latency over transition_delay_us") Closes: https://lore.kernel.org/linux-pm/20250922125929.453444-1-shawnguo2@yeah.net/ Reported-by: Shawn Guo <shawnguo@kernel.org> Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com> Cc: 6.6+ <stable@vger.kernel.org> # 6.6+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> --- v1 -> v3: * Add updates of the Rust version of cpufreq-dt and Rust binding * Update the changelog * Add tags from Mario Limonciello and Jie Zhan --- drivers/cpufreq/cpufreq-dt.c | 2 +- drivers/cpufreq/imx6q-cpufreq.c | 2 +- drivers/cpufreq/mediatek-cpufreq-hw.c | 2 +- drivers/cpufreq/rcpufreq_dt.rs | 2 +- drivers/cpufreq/scmi-cpufreq.c | 2 +- drivers/cpufreq/scpi-cpufreq.c | 2 +- drivers/cpufreq/spear-cpufreq.c | 2 +- include/linux/cpufreq.h | 3 +++ rust/kernel/cpufreq.rs | 7 ++++--- 9 files changed, 14 insertions(+), 10 deletions(-) --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -104,7 +104,7 @@ static int cpufreq_init(struct cpufreq_p transition_latency = dev_pm_opp_get_max_transition_latency(cpu_dev); if (!transition_latency) - transition_latency = CPUFREQ_ETERNAL; + transition_latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; cpumask_copy(policy->cpus, priv->cpus); policy->driver_data = priv; --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -442,7 +442,7 @@ soc_opp_out: } if (of_property_read_u32(np, "clock-latency", &transition_latency)) - transition_latency = CPUFREQ_ETERNAL; + transition_latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; /* * Calculate the ramp time for max voltage change in the --- a/drivers/cpufreq/mediatek-cpufreq-hw.c +++ b/drivers/cpufreq/mediatek-cpufreq-hw.c @@ -309,7 +309,7 @@ static int mtk_cpufreq_hw_cpu_init(struc latency = readl_relaxed(data->reg_bases[REG_FREQ_LATENCY]) * 1000; if (!latency) - latency = CPUFREQ_ETERNAL; + latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; policy->cpuinfo.transition_latency = latency; policy->fast_switch_possible = true; --- a/drivers/cpufreq/rcpufreq_dt.rs +++ b/drivers/cpufreq/rcpufreq_dt.rs @@ -123,7 +123,7 @@ impl cpufreq::Driver for CPUFreqDTDriver let mut transition_latency = opp_table.max_transition_latency_ns() as u32; if transition_latency == 0 { - transition_latency = cpufreq::ETERNAL_LATENCY_NS; + transition_latency = cpufreq::DEFAULT_TRANSITION_LATENCY_NS; } policy --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -294,7 +294,7 @@ static int scmi_cpufreq_init(struct cpuf latency = perf_ops->transition_latency_get(ph, domain); if (!latency) - latency = CPUFREQ_ETERNAL; + latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; policy->cpuinfo.transition_latency = latency; --- a/drivers/cpufreq/scpi-cpufreq.c +++ b/drivers/cpufreq/scpi-cpufreq.c @@ -157,7 +157,7 @@ static int scpi_cpufreq_init(struct cpuf latency = scpi_ops->get_transition_latency(cpu_dev); if (!latency) - latency = CPUFREQ_ETERNAL; + latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; policy->cpuinfo.transition_latency = latency; --- a/drivers/cpufreq/spear-cpufreq.c +++ b/drivers/cpufreq/spear-cpufreq.c @@ -182,7 +182,7 @@ static int spear_cpufreq_probe(struct pl if (of_property_read_u32(np, "clock-latency", &spear_cpufreq.transition_latency)) - spear_cpufreq.transition_latency = CPUFREQ_ETERNAL; + spear_cpufreq.transition_latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; cnt = of_property_count_u32_elems(np, "cpufreq_tbl"); if (cnt <= 0) { --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -32,6 +32,9 @@ */ #define CPUFREQ_ETERNAL (-1) + +#define CPUFREQ_DEFAULT_TANSITION_LATENCY_NS NSEC_PER_MSEC + #define CPUFREQ_NAME_LEN 16 /* Print length for names. Extra 1 space for accommodating '\n' in prints */ #define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1) --- a/rust/kernel/cpufreq.rs +++ b/rust/kernel/cpufreq.rs @@ -39,7 +39,8 @@ use macros::vtable; const CPUFREQ_NAME_LEN: usize = bindings::CPUFREQ_NAME_LEN as usize; /// Default transition latency value in nanoseconds. -pub const ETERNAL_LATENCY_NS: u32 = bindings::CPUFREQ_ETERNAL as u32; +pub const DEFAULT_TRANSITION_LATENCY_NS: u32 = + bindings::CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS as u32; /// CPU frequency driver flags. pub mod flags { @@ -400,13 +401,13 @@ impl TableBuilder { /// The following example demonstrates how to create a CPU frequency table. /// /// ``` -/// use kernel::cpufreq::{ETERNAL_LATENCY_NS, Policy}; +/// use kernel::cpufreq::{DEFAULT_TRANSITION_LATENCY_NS, Policy}; /// /// fn update_policy(policy: &mut Policy) { /// policy /// .set_dvfs_possible_from_any_cpu(true) /// .set_fast_switch_possible(true) -/// .set_transition_latency_ns(ETERNAL_LATENCY_NS); +/// .set_transition_latency_ns(DEFAULT_TRANSITION_LATENCY_NS); /// /// pr_info!("The policy details are: {:?}\n", (policy.cpu(), policy.cur())); /// } ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 1/4] cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency 2025-09-26 10:12 ` [PATCH v3 1/4] cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency Rafael J. Wysocki @ 2025-09-28 3:23 ` Shawn Guo 2025-09-28 10:00 ` Rafael J. Wysocki 2025-10-01 10:38 ` Qais Yousef 1 sibling, 1 reply; 5+ messages in thread From: Shawn Guo @ 2025-09-28 3:23 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Linux PM, Shawn Guo, Qais Yousef, LKML, Viresh Kumar, Pierre Gondois, Mario Limonciello, Linux ACPI, Jie Zhan, rust-for-linux, Miguel Ojeda, Alex Gaynor On Fri, Sep 26, 2025 at 12:12:37PM +0200, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > Commit a755d0e2d41b ("cpufreq: Honour transition_latency over > transition_delay_us") caused platforms where cpuinfo.transition_latency > is CPUFREQ_ETERNAL to get a very large transition latency whereas > previously it had been capped at 10 ms (and later at 2 ms). > > This led to a user-observable regression between 6.6 and 6.12 as > described by Shawn: > > "The dbs sampling_rate was 10000 us on 6.6 and suddently becomes > 6442450 us (4294967295 / 1000 * 1.5) on 6.12 for these platforms > because the default transition delay was dropped [...]. > > It slows down dbs governor's reacting to CPU loading change > dramatically. Also, as transition_delay_us is used by schedutil > governor as rate_limit_us, it shows a negative impact on device > idle power consumption, because the device gets slightly less time > in the lowest OPP." > > Evidently, the expectation of the drivers using CPUFREQ_ETERNAL as > cpuinfo.transition_latency was that it would be capped by the core, > but they may as well return a default transition latency value instead > of CPUFREQ_ETERNAL and the core need not do anything with it. > > Accordingly, introduce CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS and make > all of the drivers in question use it instead of CPUFREQ_ETERNAL. Also > update the related Rust binding. > > Fixes: a755d0e2d41b ("cpufreq: Honour transition_latency over transition_delay_us") > Closes: https://lore.kernel.org/linux-pm/20250922125929.453444-1-shawnguo2@yeah.net/ > Reported-by: Shawn Guo <shawnguo@kernel.org> > Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> > Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com> > Cc: 6.6+ <stable@vger.kernel.org> # 6.6+ > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > --- > > v1 -> v3: > * Add updates of the Rust version of cpufreq-dt and Rust binding > * Update the changelog > * Add tags from Mario Limonciello and Jie Zhan > > --- > drivers/cpufreq/cpufreq-dt.c | 2 +- > drivers/cpufreq/imx6q-cpufreq.c | 2 +- > drivers/cpufreq/mediatek-cpufreq-hw.c | 2 +- > drivers/cpufreq/rcpufreq_dt.rs | 2 +- > drivers/cpufreq/scmi-cpufreq.c | 2 +- > drivers/cpufreq/scpi-cpufreq.c | 2 +- > drivers/cpufreq/spear-cpufreq.c | 2 +- > include/linux/cpufreq.h | 3 +++ > rust/kernel/cpufreq.rs | 7 ++++--- > 9 files changed, 14 insertions(+), 10 deletions(-) > > --- a/drivers/cpufreq/cpufreq-dt.c > +++ b/drivers/cpufreq/cpufreq-dt.c > @@ -104,7 +104,7 @@ static int cpufreq_init(struct cpufreq_p > > transition_latency = dev_pm_opp_get_max_transition_latency(cpu_dev); > if (!transition_latency) > - transition_latency = CPUFREQ_ETERNAL; > + transition_latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > cpumask_copy(policy->cpus, priv->cpus); > policy->driver_data = priv; > --- a/drivers/cpufreq/imx6q-cpufreq.c > +++ b/drivers/cpufreq/imx6q-cpufreq.c > @@ -442,7 +442,7 @@ soc_opp_out: > } > > if (of_property_read_u32(np, "clock-latency", &transition_latency)) > - transition_latency = CPUFREQ_ETERNAL; > + transition_latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > /* > * Calculate the ramp time for max voltage change in the > --- a/drivers/cpufreq/mediatek-cpufreq-hw.c > +++ b/drivers/cpufreq/mediatek-cpufreq-hw.c > @@ -309,7 +309,7 @@ static int mtk_cpufreq_hw_cpu_init(struc > > latency = readl_relaxed(data->reg_bases[REG_FREQ_LATENCY]) * 1000; > if (!latency) > - latency = CPUFREQ_ETERNAL; > + latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > policy->cpuinfo.transition_latency = latency; > policy->fast_switch_possible = true; > --- a/drivers/cpufreq/rcpufreq_dt.rs > +++ b/drivers/cpufreq/rcpufreq_dt.rs > @@ -123,7 +123,7 @@ impl cpufreq::Driver for CPUFreqDTDriver > > let mut transition_latency = opp_table.max_transition_latency_ns() as u32; > if transition_latency == 0 { > - transition_latency = cpufreq::ETERNAL_LATENCY_NS; > + transition_latency = cpufreq::DEFAULT_TRANSITION_LATENCY_NS; > } > > policy > --- a/drivers/cpufreq/scmi-cpufreq.c > +++ b/drivers/cpufreq/scmi-cpufreq.c > @@ -294,7 +294,7 @@ static int scmi_cpufreq_init(struct cpuf > > latency = perf_ops->transition_latency_get(ph, domain); > if (!latency) > - latency = CPUFREQ_ETERNAL; > + latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > policy->cpuinfo.transition_latency = latency; > > --- a/drivers/cpufreq/scpi-cpufreq.c > +++ b/drivers/cpufreq/scpi-cpufreq.c > @@ -157,7 +157,7 @@ static int scpi_cpufreq_init(struct cpuf > > latency = scpi_ops->get_transition_latency(cpu_dev); > if (!latency) > - latency = CPUFREQ_ETERNAL; > + latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > policy->cpuinfo.transition_latency = latency; > > --- a/drivers/cpufreq/spear-cpufreq.c > +++ b/drivers/cpufreq/spear-cpufreq.c > @@ -182,7 +182,7 @@ static int spear_cpufreq_probe(struct pl > > if (of_property_read_u32(np, "clock-latency", > &spear_cpufreq.transition_latency)) > - spear_cpufreq.transition_latency = CPUFREQ_ETERNAL; > + spear_cpufreq.transition_latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > cnt = of_property_count_u32_elems(np, "cpufreq_tbl"); > if (cnt <= 0) { > --- a/include/linux/cpufreq.h > +++ b/include/linux/cpufreq.h > @@ -32,6 +32,9 @@ > */ > > #define CPUFREQ_ETERNAL (-1) > + > +#define CPUFREQ_DEFAULT_TANSITION_LATENCY_NS NSEC_PER_MSEC Typo of TANSITION, should be CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS. Shawn > + > #define CPUFREQ_NAME_LEN 16 > /* Print length for names. Extra 1 space for accommodating '\n' in prints */ > #define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1) > --- a/rust/kernel/cpufreq.rs > +++ b/rust/kernel/cpufreq.rs > @@ -39,7 +39,8 @@ use macros::vtable; > const CPUFREQ_NAME_LEN: usize = bindings::CPUFREQ_NAME_LEN as usize; > > /// Default transition latency value in nanoseconds. > -pub const ETERNAL_LATENCY_NS: u32 = bindings::CPUFREQ_ETERNAL as u32; > +pub const DEFAULT_TRANSITION_LATENCY_NS: u32 = > + bindings::CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS as u32; > > /// CPU frequency driver flags. > pub mod flags { > @@ -400,13 +401,13 @@ impl TableBuilder { > /// The following example demonstrates how to create a CPU frequency table. > /// > /// ``` > -/// use kernel::cpufreq::{ETERNAL_LATENCY_NS, Policy}; > +/// use kernel::cpufreq::{DEFAULT_TRANSITION_LATENCY_NS, Policy}; > /// > /// fn update_policy(policy: &mut Policy) { > /// policy > /// .set_dvfs_possible_from_any_cpu(true) > /// .set_fast_switch_possible(true) > -/// .set_transition_latency_ns(ETERNAL_LATENCY_NS); > +/// .set_transition_latency_ns(DEFAULT_TRANSITION_LATENCY_NS); > /// > /// pr_info!("The policy details are: {:?}\n", (policy.cpu(), policy.cur())); > /// } > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 1/4] cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency 2025-09-28 3:23 ` Shawn Guo @ 2025-09-28 10:00 ` Rafael J. Wysocki 2025-09-29 3:14 ` Shawn Guo 0 siblings, 1 reply; 5+ messages in thread From: Rafael J. Wysocki @ 2025-09-28 10:00 UTC (permalink / raw) To: Shawn Guo Cc: Rafael J. Wysocki, Linux PM, Shawn Guo, Qais Yousef, LKML, Viresh Kumar, Pierre Gondois, Mario Limonciello, Linux ACPI, Jie Zhan, rust-for-linux, Miguel Ojeda, Alex Gaynor On Sun, Sep 28, 2025 at 5:24 AM Shawn Guo <shawnguo2@yeah.net> wrote: > > On Fri, Sep 26, 2025 at 12:12:37PM +0200, Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > > > Commit a755d0e2d41b ("cpufreq: Honour transition_latency over > > transition_delay_us") caused platforms where cpuinfo.transition_latency > > is CPUFREQ_ETERNAL to get a very large transition latency whereas > > previously it had been capped at 10 ms (and later at 2 ms). > > > > This led to a user-observable regression between 6.6 and 6.12 as > > described by Shawn: > > > > "The dbs sampling_rate was 10000 us on 6.6 and suddently becomes > > 6442450 us (4294967295 / 1000 * 1.5) on 6.12 for these platforms > > because the default transition delay was dropped [...]. > > > > It slows down dbs governor's reacting to CPU loading change > > dramatically. Also, as transition_delay_us is used by schedutil > > governor as rate_limit_us, it shows a negative impact on device > > idle power consumption, because the device gets slightly less time > > in the lowest OPP." > > > > Evidently, the expectation of the drivers using CPUFREQ_ETERNAL as > > cpuinfo.transition_latency was that it would be capped by the core, > > but they may as well return a default transition latency value instead > > of CPUFREQ_ETERNAL and the core need not do anything with it. > > > > Accordingly, introduce CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS and make > > all of the drivers in question use it instead of CPUFREQ_ETERNAL. Also > > update the related Rust binding. > > > > Fixes: a755d0e2d41b ("cpufreq: Honour transition_latency over transition_delay_us") > > Closes: https://lore.kernel.org/linux-pm/20250922125929.453444-1-shawnguo2@yeah.net/ > > Reported-by: Shawn Guo <shawnguo@kernel.org> > > Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> > > Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com> > > Cc: 6.6+ <stable@vger.kernel.org> # 6.6+ > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > --- > > > > v1 -> v3: > > * Add updates of the Rust version of cpufreq-dt and Rust binding > > * Update the changelog > > * Add tags from Mario Limonciello and Jie Zhan > > > > --- > > drivers/cpufreq/cpufreq-dt.c | 2 +- > > drivers/cpufreq/imx6q-cpufreq.c | 2 +- > > drivers/cpufreq/mediatek-cpufreq-hw.c | 2 +- > > drivers/cpufreq/rcpufreq_dt.rs | 2 +- > > drivers/cpufreq/scmi-cpufreq.c | 2 +- > > drivers/cpufreq/scpi-cpufreq.c | 2 +- > > drivers/cpufreq/spear-cpufreq.c | 2 +- > > include/linux/cpufreq.h | 3 +++ > > rust/kernel/cpufreq.rs | 7 ++++--- > > 9 files changed, 14 insertions(+), 10 deletions(-) > > > > --- a/drivers/cpufreq/cpufreq-dt.c > > +++ b/drivers/cpufreq/cpufreq-dt.c > > @@ -104,7 +104,7 @@ static int cpufreq_init(struct cpufreq_p > > > > transition_latency = dev_pm_opp_get_max_transition_latency(cpu_dev); > > if (!transition_latency) > > - transition_latency = CPUFREQ_ETERNAL; > > + transition_latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > > > cpumask_copy(policy->cpus, priv->cpus); > > policy->driver_data = priv; > > --- a/drivers/cpufreq/imx6q-cpufreq.c > > +++ b/drivers/cpufreq/imx6q-cpufreq.c > > @@ -442,7 +442,7 @@ soc_opp_out: > > } > > > > if (of_property_read_u32(np, "clock-latency", &transition_latency)) > > - transition_latency = CPUFREQ_ETERNAL; > > + transition_latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > > > /* > > * Calculate the ramp time for max voltage change in the > > --- a/drivers/cpufreq/mediatek-cpufreq-hw.c > > +++ b/drivers/cpufreq/mediatek-cpufreq-hw.c > > @@ -309,7 +309,7 @@ static int mtk_cpufreq_hw_cpu_init(struc > > > > latency = readl_relaxed(data->reg_bases[REG_FREQ_LATENCY]) * 1000; > > if (!latency) > > - latency = CPUFREQ_ETERNAL; > > + latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > > > policy->cpuinfo.transition_latency = latency; > > policy->fast_switch_possible = true; > > --- a/drivers/cpufreq/rcpufreq_dt.rs > > +++ b/drivers/cpufreq/rcpufreq_dt.rs > > @@ -123,7 +123,7 @@ impl cpufreq::Driver for CPUFreqDTDriver > > > > let mut transition_latency = opp_table.max_transition_latency_ns() as u32; > > if transition_latency == 0 { > > - transition_latency = cpufreq::ETERNAL_LATENCY_NS; > > + transition_latency = cpufreq::DEFAULT_TRANSITION_LATENCY_NS; > > } > > > > policy > > --- a/drivers/cpufreq/scmi-cpufreq.c > > +++ b/drivers/cpufreq/scmi-cpufreq.c > > @@ -294,7 +294,7 @@ static int scmi_cpufreq_init(struct cpuf > > > > latency = perf_ops->transition_latency_get(ph, domain); > > if (!latency) > > - latency = CPUFREQ_ETERNAL; > > + latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > > > policy->cpuinfo.transition_latency = latency; > > > > --- a/drivers/cpufreq/scpi-cpufreq.c > > +++ b/drivers/cpufreq/scpi-cpufreq.c > > @@ -157,7 +157,7 @@ static int scpi_cpufreq_init(struct cpuf > > > > latency = scpi_ops->get_transition_latency(cpu_dev); > > if (!latency) > > - latency = CPUFREQ_ETERNAL; > > + latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > > > policy->cpuinfo.transition_latency = latency; > > > > --- a/drivers/cpufreq/spear-cpufreq.c > > +++ b/drivers/cpufreq/spear-cpufreq.c > > @@ -182,7 +182,7 @@ static int spear_cpufreq_probe(struct pl > > > > if (of_property_read_u32(np, "clock-latency", > > &spear_cpufreq.transition_latency)) > > - spear_cpufreq.transition_latency = CPUFREQ_ETERNAL; > > + spear_cpufreq.transition_latency = CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS; > > > > cnt = of_property_count_u32_elems(np, "cpufreq_tbl"); > > if (cnt <= 0) { > > --- a/include/linux/cpufreq.h > > +++ b/include/linux/cpufreq.h > > @@ -32,6 +32,9 @@ > > */ > > > > #define CPUFREQ_ETERNAL (-1) > > + > > +#define CPUFREQ_DEFAULT_TANSITION_LATENCY_NS NSEC_PER_MSEC > > Typo of TANSITION, should be CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS. Yes, thanks! Fixed already because CIs caught it yesterday. I'm not sure how this happened though. I must have mangled the patch right before sending it because I had tested the whole patchset before posting it. > > + > > #define CPUFREQ_NAME_LEN 16 > > /* Print length for names. Extra 1 space for accommodating '\n' in prints */ > > #define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1) > > --- a/rust/kernel/cpufreq.rs > > +++ b/rust/kernel/cpufreq.rs > > @@ -39,7 +39,8 @@ use macros::vtable; > > const CPUFREQ_NAME_LEN: usize = bindings::CPUFREQ_NAME_LEN as usize; > > > > /// Default transition latency value in nanoseconds. > > -pub const ETERNAL_LATENCY_NS: u32 = bindings::CPUFREQ_ETERNAL as u32; > > +pub const DEFAULT_TRANSITION_LATENCY_NS: u32 = > > + bindings::CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS as u32; > > > > /// CPU frequency driver flags. > > pub mod flags { > > @@ -400,13 +401,13 @@ impl TableBuilder { > > /// The following example demonstrates how to create a CPU frequency table. > > /// > > /// ``` > > -/// use kernel::cpufreq::{ETERNAL_LATENCY_NS, Policy}; > > +/// use kernel::cpufreq::{DEFAULT_TRANSITION_LATENCY_NS, Policy}; > > /// > > /// fn update_policy(policy: &mut Policy) { > > /// policy > > /// .set_dvfs_possible_from_any_cpu(true) > > /// .set_fast_switch_possible(true) > > -/// .set_transition_latency_ns(ETERNAL_LATENCY_NS); > > +/// .set_transition_latency_ns(DEFAULT_TRANSITION_LATENCY_NS); > > /// > > /// pr_info!("The policy details are: {:?}\n", (policy.cpu(), policy.cur())); > > /// } > > > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 1/4] cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency 2025-09-28 10:00 ` Rafael J. Wysocki @ 2025-09-29 3:14 ` Shawn Guo 0 siblings, 0 replies; 5+ messages in thread From: Shawn Guo @ 2025-09-29 3:14 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Linux PM, Shawn Guo, Qais Yousef, LKML, Viresh Kumar, Pierre Gondois, Mario Limonciello, Linux ACPI, Jie Zhan, rust-for-linux, Miguel Ojeda, Alex Gaynor On Sun, Sep 28, 2025 at 12:00:22PM +0200, Rafael J. Wysocki wrote: > > > --- a/include/linux/cpufreq.h > > > +++ b/include/linux/cpufreq.h > > > @@ -32,6 +32,9 @@ > > > */ > > > > > > #define CPUFREQ_ETERNAL (-1) > > > + > > > +#define CPUFREQ_DEFAULT_TANSITION_LATENCY_NS NSEC_PER_MSEC > > > > Typo of TANSITION, should be CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS. > > Yes, thanks! > > Fixed already because CIs caught it yesterday. With it fixed: Tested-by: Shawn Guo <shawnguo@kernel.org> # with cpufreq-dt driver BTW, a heads-up: the patch won't apply to 6.12 stable kernel directly. Shawn ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 1/4] cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency 2025-09-26 10:12 ` [PATCH v3 1/4] cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency Rafael J. Wysocki 2025-09-28 3:23 ` Shawn Guo @ 2025-10-01 10:38 ` Qais Yousef 1 sibling, 0 replies; 5+ messages in thread From: Qais Yousef @ 2025-10-01 10:38 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Linux PM, Shawn Guo, LKML, Viresh Kumar, Pierre Gondois, Mario Limonciello, Linux ACPI, Jie Zhan, rust-for-linux, Miguel Ojeda, Alex Gaynor On 09/26/25 12:12, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com> > > Commit a755d0e2d41b ("cpufreq: Honour transition_latency over > transition_delay_us") caused platforms where cpuinfo.transition_latency > is CPUFREQ_ETERNAL to get a very large transition latency whereas > previously it had been capped at 10 ms (and later at 2 ms). > > This led to a user-observable regression between 6.6 and 6.12 as > described by Shawn: > > "The dbs sampling_rate was 10000 us on 6.6 and suddently becomes > 6442450 us (4294967295 / 1000 * 1.5) on 6.12 for these platforms > because the default transition delay was dropped [...]. > > It slows down dbs governor's reacting to CPU loading change > dramatically. Also, as transition_delay_us is used by schedutil > governor as rate_limit_us, it shows a negative impact on device > idle power consumption, because the device gets slightly less time > in the lowest OPP." > > Evidently, the expectation of the drivers using CPUFREQ_ETERNAL as > cpuinfo.transition_latency was that it would be capped by the core, > but they may as well return a default transition latency value instead > of CPUFREQ_ETERNAL and the core need not do anything with it. > > Accordingly, introduce CPUFREQ_DEFAULT_TRANSITION_LATENCY_NS and make > all of the drivers in question use it instead of CPUFREQ_ETERNAL. Also > update the related Rust binding. > > Fixes: a755d0e2d41b ("cpufreq: Honour transition_latency over transition_delay_us") > Closes: https://lore.kernel.org/linux-pm/20250922125929.453444-1-shawnguo2@yeah.net/ > Reported-by: Shawn Guo <shawnguo@kernel.org> > Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> > Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com> > Cc: 6.6+ <stable@vger.kernel.org> # 6.6+ > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> The whole series LGTM. I think this is clearer now without the CPUFREQ_ETERNAL. Reviewed-by: Qais Yousef <qyousef@layalina.io> Cheers -- Qais Yousef ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-10-01 10:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <5069803.31r3eYUQgx@rafael.j.wysocki>
2025-09-26 10:12 ` [PATCH v3 1/4] cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency Rafael J. Wysocki
2025-09-28 3:23 ` Shawn Guo
2025-09-28 10:00 ` Rafael J. Wysocki
2025-09-29 3:14 ` Shawn Guo
2025-10-01 10:38 ` Qais Yousef
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).