* [PATCH 00/15] cpufreq: simplify boost handling
@ 2025-01-24 8:58 Viresh Kumar
2025-01-24 8:58 ` [PATCH 08/15] cpufreq: apple: Set .set_boost directly Viresh Kumar
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Viresh Kumar @ 2025-01-24 8:58 UTC (permalink / raw)
To: Rafael J. Wysocki, Alyssa Rosenzweig, Christophe Leroy,
Cristian Marussi, Gautham R. Shenoy, Hector Martin, Huacai Chen,
Huang Rui, Madhavan Srinivasan, Mario Limonciello,
Michael Ellerman, Naveen N Rao, Nicholas Piggin, Perry Yuan,
Sudeep Holla, Sven Peter, Viresh Kumar, WANG Xuerui
Cc: linux-pm, Vincent Guittot, Lifeng Zheng, arm-scmi, asahi,
linux-arm-kernel, linux-arm-msm, linux-kernel, linuxppc-dev,
loongarch
Hello,
The boost feature can be controlled at two levels currently, driver
level (applies to all policies) and per-policy.
Currently most of the drivers enables driver level boost support from the
per-policy ->init() callback, which isn't really efficient as that gets called
for each policy and then there is online/offline path too where this gets done
unnecessarily.
Also it is possible to have a scenario where not all cpufreq policies support
boost frequencies. And letting sysfs (or other parts of the kernel) enable boost
feature for that policy isn't correct.
Simplify and cleanup handling of boost to solve these issues.
Pushed here:
git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git cpufreq/boost
Rebased over few dependencies from PM tree, will push to the arm-cpufreq tree
after merge window is closed.
Viresh Kumar (15):
cpufreq: staticize cpufreq_boost_trigger_state()
cpufreq: Export cpufreq_boost_set_sw()
cpufreq: Introduce policy->boost_supported flag
cpufreq: acpi: Set policy->boost_supported
cpufreq: amd: Set policy->boost_supported
cpufreq: cppc: Set policy->boost_supported
cpufreq: Restrict enabling boost on policies with no boost frequencies
cpufreq: apple: Set .set_boost directly
cpufreq: loongson: Set .set_boost directly
cpufreq: powernv: Set .set_boost directly
cpufreq: scmi: Set .set_boost directly
cpufreq: dt: Set .set_boost directly
cpufreq: qcom: Set .set_boost directly
cpufreq: staticize policy_has_boost_freq()
cpufreq: Remove cpufreq_enable_boost_support()
drivers/cpufreq/acpi-cpufreq.c | 3 +++
drivers/cpufreq/amd-pstate.c | 4 ++--
drivers/cpufreq/apple-soc-cpufreq.c | 10 +---------
drivers/cpufreq/cppc_cpufreq.c | 9 +--------
drivers/cpufreq/cpufreq-dt.c | 14 +-------------
drivers/cpufreq/cpufreq.c | 30 ++++++++++++-----------------
drivers/cpufreq/freq_table.c | 7 +++++--
drivers/cpufreq/loongson3_cpufreq.c | 10 +---------
drivers/cpufreq/powernv-cpufreq.c | 5 +----
drivers/cpufreq/qcom-cpufreq-hw.c | 7 +------
drivers/cpufreq/scmi-cpufreq.c | 11 +----------
include/linux/cpufreq.h | 20 ++++++-------------
12 files changed, 35 insertions(+), 95 deletions(-)
--
2.31.1.272.g89b43f80a514
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 08/15] cpufreq: apple: Set .set_boost directly
2025-01-24 8:58 [PATCH 00/15] cpufreq: simplify boost handling Viresh Kumar
@ 2025-01-24 8:58 ` Viresh Kumar
2025-01-24 8:58 ` [PATCH 11/15] cpufreq: scmi: " Viresh Kumar
2025-01-24 11:05 ` [PATCH 00/15] cpufreq: simplify boost handling Rafael J. Wysocki
2 siblings, 0 replies; 6+ messages in thread
From: Viresh Kumar @ 2025-01-24 8:58 UTC (permalink / raw)
To: Rafael J. Wysocki, Hector Martin, Sven Peter, Alyssa Rosenzweig,
Viresh Kumar
Cc: linux-pm, Vincent Guittot, Lifeng Zheng, asahi, linux-arm-kernel,
linux-kernel
The boost feature can be controlled at two levels currently, driver
level (applies to all policies) and per-policy.
Currently the driver enables driver level boost support from the
per-policy ->init() callback, which isn't really efficient as that gets
called for each policy and then there is online/offline path too where
this gets done unnecessarily.
Instead set the .set_boost field directly and always enable the boost
support. If a policy doesn't support boost feature, the core will not
enable it for that policy.
Keep the initial state of driver level boost to disabled and let the
user enable it if required as ideally the boost frequencies must be used
only when really required.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/apple-soc-cpufreq.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c
index 6ff604a0fe79..4994c86feb57 100644
--- a/drivers/cpufreq/apple-soc-cpufreq.c
+++ b/drivers/cpufreq/apple-soc-cpufreq.c
@@ -310,15 +310,6 @@ static int apple_soc_cpufreq_init(struct cpufreq_policy *policy)
policy->fast_switch_possible = true;
policy->suspend_freq = freq_table[0].frequency;
- if (policy_has_boost_freq(policy)) {
- ret = cpufreq_enable_boost_support();
- if (ret) {
- dev_warn(cpu_dev, "failed to enable boost: %d\n", ret);
- } else {
- apple_soc_cpufreq_driver.boost_enabled = true;
- }
- }
-
return 0;
out_free_cpufreq_table:
@@ -353,6 +344,7 @@ static struct cpufreq_driver apple_soc_cpufreq_driver = {
.target_index = apple_soc_cpufreq_set_target,
.fast_switch = apple_soc_cpufreq_fast_switch,
.register_em = cpufreq_register_em_with_opp,
+ .set_boost = cpufreq_boost_set_sw,
.suspend = cpufreq_generic_suspend,
};
--
2.31.1.272.g89b43f80a514
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 11/15] cpufreq: scmi: Set .set_boost directly
2025-01-24 8:58 [PATCH 00/15] cpufreq: simplify boost handling Viresh Kumar
2025-01-24 8:58 ` [PATCH 08/15] cpufreq: apple: Set .set_boost directly Viresh Kumar
@ 2025-01-24 8:58 ` Viresh Kumar
2025-01-28 11:27 ` Sudeep Holla
2025-01-24 11:05 ` [PATCH 00/15] cpufreq: simplify boost handling Rafael J. Wysocki
2 siblings, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2025-01-24 8:58 UTC (permalink / raw)
To: Rafael J. Wysocki, Sudeep Holla, Cristian Marussi, Viresh Kumar
Cc: linux-pm, Vincent Guittot, Lifeng Zheng, arm-scmi,
linux-arm-kernel, linux-kernel
The boost feature can be controlled at two levels currently, driver
level (applies to all policies) and per-policy.
Currently the driver enables driver level boost support from the
per-policy ->init() callback, which isn't really efficient as that gets
called for each policy and then there is online/offline path too where
this gets done unnecessarily.
Instead set the .set_boost field directly and always enable the boost
support. If a policy doesn't support boost feature, the core will not
enable it for that policy.
Keep the initial state of driver level boost to disabled and let the
user enable it if required as ideally the boost frequencies must be used
only when really required.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/scmi-cpufreq.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
index 4a3ee59cb771..ff2897789797 100644
--- a/drivers/cpufreq/scmi-cpufreq.c
+++ b/drivers/cpufreq/scmi-cpufreq.c
@@ -297,16 +297,6 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
policy->transition_delay_us =
scmi_get_rate_limit(domain, policy->fast_switch_possible);
- if (policy_has_boost_freq(policy)) {
- ret = cpufreq_enable_boost_support();
- if (ret) {
- dev_warn(cpu_dev, "failed to enable boost: %d\n", ret);
- goto out_free_table;
- } else {
- scmi_cpufreq_driver.boost_enabled = true;
- }
- }
-
ret = freq_qos_add_request(&policy->constraints, &priv->limits_freq_req, FREQ_QOS_MAX,
FREQ_QOS_MAX_DEFAULT_VALUE);
if (ret < 0) {
@@ -394,6 +384,7 @@ static struct cpufreq_driver scmi_cpufreq_driver = {
.init = scmi_cpufreq_init,
.exit = scmi_cpufreq_exit,
.register_em = scmi_cpufreq_register_em,
+ .set_boost = cpufreq_boost_set_sw,
};
static int scmi_cpufreq_probe(struct scmi_device *sdev)
--
2.31.1.272.g89b43f80a514
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 00/15] cpufreq: simplify boost handling
2025-01-24 8:58 [PATCH 00/15] cpufreq: simplify boost handling Viresh Kumar
2025-01-24 8:58 ` [PATCH 08/15] cpufreq: apple: Set .set_boost directly Viresh Kumar
2025-01-24 8:58 ` [PATCH 11/15] cpufreq: scmi: " Viresh Kumar
@ 2025-01-24 11:05 ` Rafael J. Wysocki
2025-01-27 3:32 ` Viresh Kumar
2 siblings, 1 reply; 6+ messages in thread
From: Rafael J. Wysocki @ 2025-01-24 11:05 UTC (permalink / raw)
To: Viresh Kumar
Cc: Rafael J. Wysocki, Alyssa Rosenzweig, Christophe Leroy,
Cristian Marussi, Gautham R. Shenoy, Hector Martin, Huacai Chen,
Huang Rui, Madhavan Srinivasan, Mario Limonciello,
Michael Ellerman, Naveen N Rao, Nicholas Piggin, Perry Yuan,
Sudeep Holla, Sven Peter, WANG Xuerui, linux-pm, Vincent Guittot,
Lifeng Zheng, arm-scmi, asahi, linux-arm-kernel, linux-arm-msm,
linux-kernel, linuxppc-dev, loongarch
On Fri, Jan 24, 2025 at 9:58 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> Hello,
>
> The boost feature can be controlled at two levels currently, driver
> level (applies to all policies) and per-policy.
>
> Currently most of the drivers enables driver level boost support from the
> per-policy ->init() callback, which isn't really efficient as that gets called
> for each policy and then there is online/offline path too where this gets done
> unnecessarily.
>
> Also it is possible to have a scenario where not all cpufreq policies support
> boost frequencies. And letting sysfs (or other parts of the kernel) enable boost
> feature for that policy isn't correct.
>
> Simplify and cleanup handling of boost to solve these issues.
I guess this depends on the previous series?
> Pushed here:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm.git cpufreq/boost
>
> Rebased over few dependencies from PM tree, will push to the arm-cpufreq tree
> after merge window is closed.
>
> Viresh Kumar (15):
> cpufreq: staticize cpufreq_boost_trigger_state()
> cpufreq: Export cpufreq_boost_set_sw()
> cpufreq: Introduce policy->boost_supported flag
> cpufreq: acpi: Set policy->boost_supported
> cpufreq: amd: Set policy->boost_supported
> cpufreq: cppc: Set policy->boost_supported
> cpufreq: Restrict enabling boost on policies with no boost frequencies
> cpufreq: apple: Set .set_boost directly
> cpufreq: loongson: Set .set_boost directly
> cpufreq: powernv: Set .set_boost directly
> cpufreq: scmi: Set .set_boost directly
> cpufreq: dt: Set .set_boost directly
> cpufreq: qcom: Set .set_boost directly
> cpufreq: staticize policy_has_boost_freq()
> cpufreq: Remove cpufreq_enable_boost_support()
>
> drivers/cpufreq/acpi-cpufreq.c | 3 +++
> drivers/cpufreq/amd-pstate.c | 4 ++--
> drivers/cpufreq/apple-soc-cpufreq.c | 10 +---------
> drivers/cpufreq/cppc_cpufreq.c | 9 +--------
> drivers/cpufreq/cpufreq-dt.c | 14 +-------------
> drivers/cpufreq/cpufreq.c | 30 ++++++++++++-----------------
> drivers/cpufreq/freq_table.c | 7 +++++--
> drivers/cpufreq/loongson3_cpufreq.c | 10 +---------
> drivers/cpufreq/powernv-cpufreq.c | 5 +----
> drivers/cpufreq/qcom-cpufreq-hw.c | 7 +------
> drivers/cpufreq/scmi-cpufreq.c | 11 +----------
> include/linux/cpufreq.h | 20 ++++++-------------
> 12 files changed, 35 insertions(+), 95 deletions(-)
>
> --
> 2.31.1.272.g89b43f80a514
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 00/15] cpufreq: simplify boost handling
2025-01-24 11:05 ` [PATCH 00/15] cpufreq: simplify boost handling Rafael J. Wysocki
@ 2025-01-27 3:32 ` Viresh Kumar
0 siblings, 0 replies; 6+ messages in thread
From: Viresh Kumar @ 2025-01-27 3:32 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: Alyssa Rosenzweig, Christophe Leroy, Cristian Marussi,
Gautham R. Shenoy, Hector Martin, Huacai Chen, Huang Rui,
Madhavan Srinivasan, Mario Limonciello, Michael Ellerman,
Naveen N Rao, Nicholas Piggin, Perry Yuan, Sudeep Holla,
Sven Peter, WANG Xuerui, linux-pm, Vincent Guittot, Lifeng Zheng,
arm-scmi, asahi, linux-arm-kernel, linux-arm-msm, linux-kernel,
linuxppc-dev, loongarch
On 24-01-25, 12:05, Rafael J. Wysocki wrote:
> On Fri, Jan 24, 2025 at 9:58 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >
> > Hello,
> >
> > The boost feature can be controlled at two levels currently, driver
> > level (applies to all policies) and per-policy.
> >
> > Currently most of the drivers enables driver level boost support from the
> > per-policy ->init() callback, which isn't really efficient as that gets called
> > for each policy and then there is online/offline path too where this gets done
> > unnecessarily.
> >
> > Also it is possible to have a scenario where not all cpufreq policies support
> > boost frequencies. And letting sysfs (or other parts of the kernel) enable boost
> > feature for that policy isn't correct.
> >
> > Simplify and cleanup handling of boost to solve these issues.
>
> I guess this depends on the previous series?
Yes my series and the boost related patches in your tree.
--
viresh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 11/15] cpufreq: scmi: Set .set_boost directly
2025-01-24 8:58 ` [PATCH 11/15] cpufreq: scmi: " Viresh Kumar
@ 2025-01-28 11:27 ` Sudeep Holla
0 siblings, 0 replies; 6+ messages in thread
From: Sudeep Holla @ 2025-01-28 11:27 UTC (permalink / raw)
To: Viresh Kumar
Cc: Rafael J. Wysocki, Cristian Marussi, Sudeep Holla, linux-pm,
Vincent Guittot, Lifeng Zheng, arm-scmi, linux-arm-kernel,
linux-kernel
On Fri, Jan 24, 2025 at 02:28:15PM +0530, Viresh Kumar wrote:
> The boost feature can be controlled at two levels currently, driver
> level (applies to all policies) and per-policy.
>
> Currently the driver enables driver level boost support from the
> per-policy ->init() callback, which isn't really efficient as that gets
> called for each policy and then there is online/offline path too where
> this gets done unnecessarily.
>
> Instead set the .set_boost field directly and always enable the boost
> support. If a policy doesn't support boost feature, the core will not
> enable it for that policy.
>
> Keep the initial state of driver level boost to disabled and let the
> user enable it if required as ideally the boost frequencies must be used
> only when really required.
>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-28 11:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-24 8:58 [PATCH 00/15] cpufreq: simplify boost handling Viresh Kumar
2025-01-24 8:58 ` [PATCH 08/15] cpufreq: apple: Set .set_boost directly Viresh Kumar
2025-01-24 8:58 ` [PATCH 11/15] cpufreq: scmi: " Viresh Kumar
2025-01-28 11:27 ` Sudeep Holla
2025-01-24 11:05 ` [PATCH 00/15] cpufreq: simplify boost handling Rafael J. Wysocki
2025-01-27 3:32 ` Viresh Kumar
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).