Skip to content

Commit fba038b

Browse files
committed
Merge branch 'pm-cpufreq' into linux-next
* pm-cpufreq: cpufreq: docs: userspace: Explain HW coordination influence cpufreq: userspace: set CPUFREQ_GOV_STRICT_TARGET flag cpufreq: CPPC: Remove forward declaration of cppc_cpufreq_register_em() cpufreq: CPPC: Do not return a value from populate_efficiency_class() cpufreq: CPPC: Remove cpu_data_list
2 parents 8bcda62 + 221504a commit fba038b

4 files changed

Lines changed: 19 additions & 46 deletions

File tree

Documentation/admin-guide/pm/cpufreq.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ policy limits change after that.
398398

399399
This governor does not do anything by itself. Instead, it allows user space
400400
to set the CPU frequency for the policy it is attached to by writing to the
401-
``scaling_setspeed`` attribute of that policy.
401+
``scaling_setspeed`` attribute of that policy. Though the intention may be to
402+
set an exact frequency for the policy, the actual frequency may vary depending
403+
on hardware coordination, thermal and power limits, and other factors.
402404

403405
``schedutil``
404406
-------------

drivers/cpufreq/cppc_cpufreq.c

Lines changed: 15 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@
2626

2727
#include <acpi/cppc_acpi.h>
2828

29-
/*
30-
* This list contains information parsed from per CPU ACPI _CPC and _PSD
31-
* structures: e.g. the highest and lowest supported performance, capabilities,
32-
* desired performance, level requested etc. Depending on the share_type, not
33-
* all CPUs will have an entry in the list.
34-
*/
35-
static LIST_HEAD(cpu_data_list);
36-
3729
static struct cpufreq_driver cppc_cpufreq_driver;
3830

3931
#ifdef CONFIG_ACPI_CPPC_CPUFREQ_FIE
@@ -352,7 +344,6 @@ static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu)
352344
#if defined(CONFIG_ARM64) && defined(CONFIG_ENERGY_MODEL)
353345

354346
static DEFINE_PER_CPU(unsigned int, efficiency_class);
355-
static void cppc_cpufreq_register_em(struct cpufreq_policy *policy);
356347

357348
/* Create an artificial performance state every CPPC_EM_CAP_STEP capacity unit. */
358349
#define CPPC_EM_CAP_STEP (20)
@@ -488,7 +479,19 @@ static int cppc_get_cpu_cost(struct device *cpu_dev, unsigned long KHz,
488479
return 0;
489480
}
490481

491-
static int populate_efficiency_class(void)
482+
static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
483+
{
484+
struct cppc_cpudata *cpu_data;
485+
struct em_data_callback em_cb =
486+
EM_ADV_DATA_CB(cppc_get_cpu_power, cppc_get_cpu_cost);
487+
488+
cpu_data = policy->driver_data;
489+
em_dev_register_perf_domain(get_cpu_device(policy->cpu),
490+
get_perf_level_count(policy), &em_cb,
491+
cpu_data->shared_cpu_map, 0);
492+
}
493+
494+
static void populate_efficiency_class(void)
492495
{
493496
struct acpi_madt_generic_interrupt *gicc;
494497
DECLARE_BITMAP(used_classes, 256) = {};
@@ -503,7 +506,7 @@ static int populate_efficiency_class(void)
503506
if (bitmap_weight(used_classes, 256) <= 1) {
504507
pr_debug("Efficiency classes are all equal (=%d). "
505508
"No EM registered", class);
506-
return -EINVAL;
509+
return;
507510
}
508511

509512
/*
@@ -520,26 +523,11 @@ static int populate_efficiency_class(void)
520523
index++;
521524
}
522525
cppc_cpufreq_driver.register_em = cppc_cpufreq_register_em;
523-
524-
return 0;
525-
}
526-
527-
static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
528-
{
529-
struct cppc_cpudata *cpu_data;
530-
struct em_data_callback em_cb =
531-
EM_ADV_DATA_CB(cppc_get_cpu_power, cppc_get_cpu_cost);
532-
533-
cpu_data = policy->driver_data;
534-
em_dev_register_perf_domain(get_cpu_device(policy->cpu),
535-
get_perf_level_count(policy), &em_cb,
536-
cpu_data->shared_cpu_map, 0);
537526
}
538527

539528
#else
540-
static int populate_efficiency_class(void)
529+
static void populate_efficiency_class(void)
541530
{
542-
return 0;
543531
}
544532
#endif
545533

@@ -567,8 +555,6 @@ static struct cppc_cpudata *cppc_cpufreq_get_cpu_data(unsigned int cpu)
567555
goto free_mask;
568556
}
569557

570-
list_add(&cpu_data->node, &cpu_data_list);
571-
572558
return cpu_data;
573559

574560
free_mask:
@@ -583,7 +569,6 @@ static void cppc_cpufreq_put_cpu_data(struct cpufreq_policy *policy)
583569
{
584570
struct cppc_cpudata *cpu_data = policy->driver_data;
585571

586-
list_del(&cpu_data->node);
587572
free_cpumask_var(cpu_data->shared_cpu_map);
588573
kfree(cpu_data);
589574
policy->driver_data = NULL;
@@ -954,24 +939,10 @@ static int __init cppc_cpufreq_init(void)
954939
return ret;
955940
}
956941

957-
static inline void free_cpu_data(void)
958-
{
959-
struct cppc_cpudata *iter, *tmp;
960-
961-
list_for_each_entry_safe(iter, tmp, &cpu_data_list, node) {
962-
free_cpumask_var(iter->shared_cpu_map);
963-
list_del(&iter->node);
964-
kfree(iter);
965-
}
966-
967-
}
968-
969942
static void __exit cppc_cpufreq_exit(void)
970943
{
971944
cpufreq_unregister_driver(&cppc_cpufreq_driver);
972945
cppc_freq_invariance_exit();
973-
974-
free_cpu_data();
975946
}
976947

977948
module_exit(cppc_cpufreq_exit);

drivers/cpufreq/cpufreq_userspace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ static struct cpufreq_governor cpufreq_gov_userspace = {
134134
.store_setspeed = cpufreq_set,
135135
.show_setspeed = show_speed,
136136
.owner = THIS_MODULE,
137+
.flags = CPUFREQ_GOV_STRICT_TARGET,
137138
};
138139

139140
MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>, "

include/acpi/cppc_acpi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ struct cppc_perf_fb_ctrs {
139139

140140
/* Per CPU container for runtime CPPC management. */
141141
struct cppc_cpudata {
142-
struct list_head node;
143142
struct cppc_perf_caps perf_caps;
144143
struct cppc_perf_ctrls perf_ctrls;
145144
struct cppc_perf_fb_ctrs perf_fb_ctrs;

0 commit comments

Comments
 (0)