* [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c.
@ 2025-05-26 11:30 Lifeng Zheng
2025-05-26 11:30 ` [PATCH 1/3] cpufreq: CPPC: Remove cpu_data_list Lifeng Zheng
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Lifeng Zheng @ 2025-05-26 11:30 UTC (permalink / raw)
To: rafael, viresh.kumar, robert.moore, lenb
Cc: linux-pm, linux-kernel, linux-acpi, acpica-devel, linuxarm,
jonathan.cameron, zhanjie9, lihuisong, cenxinghai, yubowen8,
zhenglifeng1
This patch series makes some minor optimizations for cppc_cpufreq.c to
makes codes cleaner.
Lifeng Zheng (3):
cpufreq: CPPC: Remove cpu_data_list
cpufreq: CPPC: Return void in populate_efficiency_class()
cpufreq: CPPC: Remove forward declaration of
cppc_cpufreq_register_em()
drivers/cpufreq/cppc_cpufreq.c | 59 +++++++++-------------------------
include/acpi/cppc_acpi.h | 1 -
2 files changed, 15 insertions(+), 45 deletions(-)
--
2.33.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] cpufreq: CPPC: Remove cpu_data_list
2025-05-26 11:30 [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c Lifeng Zheng
@ 2025-05-26 11:30 ` Lifeng Zheng
2025-05-26 11:30 ` [PATCH 2/3] cpufreq: CPPC: Return void in populate_efficiency_class() Lifeng Zheng
` (4 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Lifeng Zheng @ 2025-05-26 11:30 UTC (permalink / raw)
To: rafael, viresh.kumar, robert.moore, lenb
Cc: linux-pm, linux-kernel, linux-acpi, acpica-devel, linuxarm,
jonathan.cameron, zhanjie9, lihuisong, cenxinghai, yubowen8,
zhenglifeng1
After commit a28b2bfc099c ("cppc_cpufreq: replace per-cpu data array with a
list"), cpu_data can be got from policy->driver_data, so cpu_data_list is
not actually needed and can be removed.
Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
---
drivers/cpufreq/cppc_cpufreq.c | 25 -------------------------
include/acpi/cppc_acpi.h | 1 -
2 files changed, 26 deletions(-)
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index b7c688a5659c..f3b5ea9fcbf5 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -26,14 +26,6 @@
#include <acpi/cppc_acpi.h>
-/*
- * This list contains information parsed from per CPU ACPI _CPC and _PSD
- * structures: e.g. the highest and lowest supported performance, capabilities,
- * desired performance, level requested etc. Depending on the share_type, not
- * all CPUs will have an entry in the list.
- */
-static LIST_HEAD(cpu_data_list);
-
static struct cpufreq_driver cppc_cpufreq_driver;
#ifdef CONFIG_ACPI_CPPC_CPUFREQ_FIE
@@ -567,8 +559,6 @@ static struct cppc_cpudata *cppc_cpufreq_get_cpu_data(unsigned int cpu)
goto free_mask;
}
- list_add(&cpu_data->node, &cpu_data_list);
-
return cpu_data;
free_mask:
@@ -583,7 +573,6 @@ static void cppc_cpufreq_put_cpu_data(struct cpufreq_policy *policy)
{
struct cppc_cpudata *cpu_data = policy->driver_data;
- list_del(&cpu_data->node);
free_cpumask_var(cpu_data->shared_cpu_map);
kfree(cpu_data);
policy->driver_data = NULL;
@@ -954,24 +943,10 @@ static int __init cppc_cpufreq_init(void)
return ret;
}
-static inline void free_cpu_data(void)
-{
- struct cppc_cpudata *iter, *tmp;
-
- list_for_each_entry_safe(iter, tmp, &cpu_data_list, node) {
- free_cpumask_var(iter->shared_cpu_map);
- list_del(&iter->node);
- kfree(iter);
- }
-
-}
-
static void __exit cppc_cpufreq_exit(void)
{
cpufreq_unregister_driver(&cppc_cpufreq_driver);
cppc_freq_invariance_exit();
-
- free_cpu_data();
}
module_exit(cppc_cpufreq_exit);
diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h
index 325e9543e08f..20f3d62e7a16 100644
--- a/include/acpi/cppc_acpi.h
+++ b/include/acpi/cppc_acpi.h
@@ -139,7 +139,6 @@ struct cppc_perf_fb_ctrs {
/* Per CPU container for runtime CPPC management. */
struct cppc_cpudata {
- struct list_head node;
struct cppc_perf_caps perf_caps;
struct cppc_perf_ctrls perf_ctrls;
struct cppc_perf_fb_ctrs perf_fb_ctrs;
--
2.33.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] cpufreq: CPPC: Return void in populate_efficiency_class()
2025-05-26 11:30 [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c Lifeng Zheng
2025-05-26 11:30 ` [PATCH 1/3] cpufreq: CPPC: Remove cpu_data_list Lifeng Zheng
@ 2025-05-26 11:30 ` Lifeng Zheng
2025-05-26 11:30 ` [PATCH 3/3] cpufreq: CPPC: Remove forward declaration of cppc_cpufreq_register_em() Lifeng Zheng
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Lifeng Zheng @ 2025-05-26 11:30 UTC (permalink / raw)
To: rafael, viresh.kumar, robert.moore, lenb
Cc: linux-pm, linux-kernel, linux-acpi, acpica-devel, linuxarm,
jonathan.cameron, zhanjie9, lihuisong, cenxinghai, yubowen8,
zhenglifeng1
The return value of populate_efficiency_class() is never needed and the
result of it doesn't affect the initialization of cppc_cpufreq. It makes
more sense to have it return void.
Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
---
drivers/cpufreq/cppc_cpufreq.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index f3b5ea9fcbf5..c2be4b188a23 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -480,7 +480,7 @@ static int cppc_get_cpu_cost(struct device *cpu_dev, unsigned long KHz,
return 0;
}
-static int populate_efficiency_class(void)
+static void populate_efficiency_class(void)
{
struct acpi_madt_generic_interrupt *gicc;
DECLARE_BITMAP(used_classes, 256) = {};
@@ -495,7 +495,7 @@ static int populate_efficiency_class(void)
if (bitmap_weight(used_classes, 256) <= 1) {
pr_debug("Efficiency classes are all equal (=%d). "
"No EM registered", class);
- return -EINVAL;
+ return;
}
/*
@@ -512,8 +512,6 @@ static int populate_efficiency_class(void)
index++;
}
cppc_cpufreq_driver.register_em = cppc_cpufreq_register_em;
-
- return 0;
}
static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
@@ -529,9 +527,8 @@ static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
}
#else
-static int populate_efficiency_class(void)
+static void populate_efficiency_class(void)
{
- return 0;
}
#endif
--
2.33.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] cpufreq: CPPC: Remove forward declaration of cppc_cpufreq_register_em()
2025-05-26 11:30 [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c Lifeng Zheng
2025-05-26 11:30 ` [PATCH 1/3] cpufreq: CPPC: Remove cpu_data_list Lifeng Zheng
2025-05-26 11:30 ` [PATCH 2/3] cpufreq: CPPC: Return void in populate_efficiency_class() Lifeng Zheng
@ 2025-05-26 11:30 ` Lifeng Zheng
2025-05-28 13:26 ` [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c Pierre Gondois
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Lifeng Zheng @ 2025-05-26 11:30 UTC (permalink / raw)
To: rafael, viresh.kumar, robert.moore, lenb
Cc: linux-pm, linux-kernel, linux-acpi, acpica-devel, linuxarm,
jonathan.cameron, zhanjie9, lihuisong, cenxinghai, yubowen8,
zhenglifeng1
cppc_cpufreq_register_em() is only used in populate_efficiency_class(). A
forward declaration is not necessary. Move cppc_cpufreq_register_em() in
front of populate_efficiency_class() and remove the forward declaration of
cppc_cpufreq_register_em().
No functional change.
Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
---
drivers/cpufreq/cppc_cpufreq.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index c2be4b188a23..a1fd0ff22bc5 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -344,7 +344,6 @@ static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu)
#if defined(CONFIG_ARM64) && defined(CONFIG_ENERGY_MODEL)
static DEFINE_PER_CPU(unsigned int, efficiency_class);
-static void cppc_cpufreq_register_em(struct cpufreq_policy *policy);
/* Create an artificial performance state every CPPC_EM_CAP_STEP capacity unit. */
#define CPPC_EM_CAP_STEP (20)
@@ -480,6 +479,18 @@ static int cppc_get_cpu_cost(struct device *cpu_dev, unsigned long KHz,
return 0;
}
+static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
+{
+ struct cppc_cpudata *cpu_data;
+ struct em_data_callback em_cb =
+ EM_ADV_DATA_CB(cppc_get_cpu_power, cppc_get_cpu_cost);
+
+ cpu_data = policy->driver_data;
+ em_dev_register_perf_domain(get_cpu_device(policy->cpu),
+ get_perf_level_count(policy), &em_cb,
+ cpu_data->shared_cpu_map, 0);
+}
+
static void populate_efficiency_class(void)
{
struct acpi_madt_generic_interrupt *gicc;
@@ -514,18 +525,6 @@ static void populate_efficiency_class(void)
cppc_cpufreq_driver.register_em = cppc_cpufreq_register_em;
}
-static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
-{
- struct cppc_cpudata *cpu_data;
- struct em_data_callback em_cb =
- EM_ADV_DATA_CB(cppc_get_cpu_power, cppc_get_cpu_cost);
-
- cpu_data = policy->driver_data;
- em_dev_register_perf_domain(get_cpu_device(policy->cpu),
- get_perf_level_count(policy), &em_cb,
- cpu_data->shared_cpu_map, 0);
-}
-
#else
static void populate_efficiency_class(void)
{
--
2.33.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c.
2025-05-26 11:30 [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c Lifeng Zheng
` (2 preceding siblings ...)
2025-05-26 11:30 ` [PATCH 3/3] cpufreq: CPPC: Remove forward declaration of cppc_cpufreq_register_em() Lifeng Zheng
@ 2025-05-28 13:26 ` Pierre Gondois
2025-05-29 6:28 ` zhenglifeng (A)
2025-06-17 2:33 ` zhenglifeng (A)
2025-06-19 5:46 ` Viresh Kumar
5 siblings, 1 reply; 10+ messages in thread
From: Pierre Gondois @ 2025-05-28 13:26 UTC (permalink / raw)
To: Lifeng Zheng, rafael, viresh.kumar, robert.moore, lenb
Cc: linux-pm, linux-kernel, linux-acpi, acpica-devel, linuxarm,
jonathan.cameron, zhanjie9, lihuisong, cenxinghai, yubowen8
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
On 5/26/25 13:30, Lifeng Zheng wrote:
> This patch series makes some minor optimizations for cppc_cpufreq.c to
> makes codes cleaner.
>
> Lifeng Zheng (3):
> cpufreq: CPPC: Remove cpu_data_list
> cpufreq: CPPC: Return void in populate_efficiency_class()
> cpufreq: CPPC: Remove forward declaration of
> cppc_cpufreq_register_em()
>
> drivers/cpufreq/cppc_cpufreq.c | 59 +++++++++-------------------------
> include/acpi/cppc_acpi.h | 1 -
> 2 files changed, 15 insertions(+), 45 deletions(-)
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c.
2025-05-28 13:26 ` [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c Pierre Gondois
@ 2025-05-29 6:28 ` zhenglifeng (A)
0 siblings, 0 replies; 10+ messages in thread
From: zhenglifeng (A) @ 2025-05-29 6:28 UTC (permalink / raw)
To: Pierre Gondois, rafael, viresh.kumar, robert.moore, lenb
Cc: linux-pm, linux-kernel, linux-acpi, acpica-devel, linuxarm,
jonathan.cameron, zhanjie9, lihuisong, cenxinghai, yubowen8
On 2025/5/28 21:26, Pierre Gondois wrote:
> Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Thanks!
>
> On 5/26/25 13:30, Lifeng Zheng wrote:
>> This patch series makes some minor optimizations for cppc_cpufreq.c to
>> makes codes cleaner.
>>
>> Lifeng Zheng (3):
>> cpufreq: CPPC: Remove cpu_data_list
>> cpufreq: CPPC: Return void in populate_efficiency_class()
>> cpufreq: CPPC: Remove forward declaration of
>> cppc_cpufreq_register_em()
>>
>> drivers/cpufreq/cppc_cpufreq.c | 59 +++++++++-------------------------
>> include/acpi/cppc_acpi.h | 1 -
>> 2 files changed, 15 insertions(+), 45 deletions(-)
>>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c.
2025-05-26 11:30 [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c Lifeng Zheng
` (3 preceding siblings ...)
2025-05-28 13:26 ` [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c Pierre Gondois
@ 2025-06-17 2:33 ` zhenglifeng (A)
2025-06-18 19:06 ` Rafael J. Wysocki
2025-06-19 5:46 ` Viresh Kumar
5 siblings, 1 reply; 10+ messages in thread
From: zhenglifeng (A) @ 2025-06-17 2:33 UTC (permalink / raw)
To: rafael, viresh.kumar, robert.moore, lenb
Cc: linux-pm, linux-kernel, linux-acpi, acpica-devel, linuxarm,
jonathan.cameron, zhanjie9, lihuisong, yubowen8
Gentle ping.
On 2025/5/26 19:30, Lifeng Zheng wrote:
> This patch series makes some minor optimizations for cppc_cpufreq.c to
> makes codes cleaner.
>
> Lifeng Zheng (3):
> cpufreq: CPPC: Remove cpu_data_list
> cpufreq: CPPC: Return void in populate_efficiency_class()
> cpufreq: CPPC: Remove forward declaration of
> cppc_cpufreq_register_em()
>
> drivers/cpufreq/cppc_cpufreq.c | 59 +++++++++-------------------------
> include/acpi/cppc_acpi.h | 1 -
> 2 files changed, 15 insertions(+), 45 deletions(-)
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c.
2025-06-17 2:33 ` zhenglifeng (A)
@ 2025-06-18 19:06 ` Rafael J. Wysocki
2025-06-19 5:47 ` Viresh Kumar
0 siblings, 1 reply; 10+ messages in thread
From: Rafael J. Wysocki @ 2025-06-18 19:06 UTC (permalink / raw)
To: zhenglifeng (A), viresh.kumar
Cc: robert.moore, lenb, linux-pm, linux-kernel, linux-acpi, linuxarm,
jonathan.cameron, zhanjie9, lihuisong, yubowen8
On Tue, Jun 17, 2025 at 4:33 AM zhenglifeng (A) <zhenglifeng1@huawei.com> wrote:
>
> Gentle ping.
>
> On 2025/5/26 19:30, Lifeng Zheng wrote:
> > This patch series makes some minor optimizations for cppc_cpufreq.c to
> > makes codes cleaner.
> >
> > Lifeng Zheng (3):
> > cpufreq: CPPC: Remove cpu_data_list
> > cpufreq: CPPC: Return void in populate_efficiency_class()
> > cpufreq: CPPC: Remove forward declaration of
> > cppc_cpufreq_register_em()
> >
> > drivers/cpufreq/cppc_cpufreq.c | 59 +++++++++-------------------------
> > include/acpi/cppc_acpi.h | 1 -
> > 2 files changed, 15 insertions(+), 45 deletions(-)
I've started to process this because it has been sent to linux-acpi
and then I realized that Viresh should take it, but since I've applied
it already, I may as well queue it up for 6.17.
Viresh, please let me know if you have any concerns about it.
Thanks!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c.
2025-05-26 11:30 [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c Lifeng Zheng
` (4 preceding siblings ...)
2025-06-17 2:33 ` zhenglifeng (A)
@ 2025-06-19 5:46 ` Viresh Kumar
5 siblings, 0 replies; 10+ messages in thread
From: Viresh Kumar @ 2025-06-19 5:46 UTC (permalink / raw)
To: Lifeng Zheng
Cc: rafael, robert.moore, lenb, linux-pm, linux-kernel, linux-acpi,
acpica-devel, linuxarm, jonathan.cameron, zhanjie9, lihuisong,
cenxinghai, yubowen8
On 26-05-25, 19:30, Lifeng Zheng wrote:
> This patch series makes some minor optimizations for cppc_cpufreq.c to
> makes codes cleaner.
>
> Lifeng Zheng (3):
> cpufreq: CPPC: Remove cpu_data_list
> cpufreq: CPPC: Return void in populate_efficiency_class()
> cpufreq: CPPC: Remove forward declaration of
> cppc_cpufreq_register_em()
>
> drivers/cpufreq/cppc_cpufreq.c | 59 +++++++++-------------------------
> include/acpi/cppc_acpi.h | 1 -
> 2 files changed, 15 insertions(+), 45 deletions(-)
Applied. Thanks.
--
viresh
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c.
2025-06-18 19:06 ` Rafael J. Wysocki
@ 2025-06-19 5:47 ` Viresh Kumar
0 siblings, 0 replies; 10+ messages in thread
From: Viresh Kumar @ 2025-06-19 5:47 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: zhenglifeng (A), robert.moore, lenb, linux-pm, linux-kernel,
linux-acpi, linuxarm, jonathan.cameron, zhanjie9, lihuisong,
yubowen8
On 18-06-25, 21:06, Rafael J. Wysocki wrote:
> On Tue, Jun 17, 2025 at 4:33 AM zhenglifeng (A) <zhenglifeng1@huawei.com> wrote:
> >
> > Gentle ping.
> >
> > On 2025/5/26 19:30, Lifeng Zheng wrote:
> > > This patch series makes some minor optimizations for cppc_cpufreq.c to
> > > makes codes cleaner.
> > >
> > > Lifeng Zheng (3):
> > > cpufreq: CPPC: Remove cpu_data_list
> > > cpufreq: CPPC: Return void in populate_efficiency_class()
> > > cpufreq: CPPC: Remove forward declaration of
> > > cppc_cpufreq_register_em()
> > >
> > > drivers/cpufreq/cppc_cpufreq.c | 59 +++++++++-------------------------
> > > include/acpi/cppc_acpi.h | 1 -
> > > 2 files changed, 15 insertions(+), 45 deletions(-)
>
> I've started to process this because it has been sent to linux-acpi
> and then I realized that Viresh should take it, but since I've applied
> it already, I may as well queue it up for 6.17.
>
> Viresh, please let me know if you have any concerns about it.
I applied this before I saw your email.. Please keep it, I will drop it. Thanks.
--
viresh
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2025-06-19 5:48 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-26 11:30 [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c Lifeng Zheng
2025-05-26 11:30 ` [PATCH 1/3] cpufreq: CPPC: Remove cpu_data_list Lifeng Zheng
2025-05-26 11:30 ` [PATCH 2/3] cpufreq: CPPC: Return void in populate_efficiency_class() Lifeng Zheng
2025-05-26 11:30 ` [PATCH 3/3] cpufreq: CPPC: Remove forward declaration of cppc_cpufreq_register_em() Lifeng Zheng
2025-05-28 13:26 ` [PATCH 0/3] cpufreq: CPPC: Some optimizations for cppc_cpufreq.c Pierre Gondois
2025-05-29 6:28 ` zhenglifeng (A)
2025-06-17 2:33 ` zhenglifeng (A)
2025-06-18 19:06 ` Rafael J. Wysocki
2025-06-19 5:47 ` Viresh Kumar
2025-06-19 5:46 ` 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).