Skip to content

Commit ea4f9c3

Browse files
committed
Merge tag 'pm-6.6-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more power management updates from Rafael Wysocki: "These fix cpufreq core and the pcc cpufreq driver, add per-policy boost support to cpufreq and add Georgian translation Makefile LANGUAGES in cpupower. Specifics: - Add Georgian translation to Makefile LANGUAGES in cpupower (Shuah Khan). - Add support for per-policy performance boost to cpufreq (Jie Zhan). - Fix assorted issues in the cpufreq core, common governor code and in the pcc cpufreq driver (Liao Chang)" * tag 'pm-6.6-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: Support per-policy performance boost cpufreq: pcc: Fix the potentinal scheduling delays in target_index() cpufreq: governor: Free dbs_data directly when gov->init() fails cpufreq: Fix the race condition while updating the transition_task of policy cpufreq: Avoid printing kernel addresses in cpufreq_resume() cpupower: Add Georgian translation to Makefile LANGUAGES
2 parents 0ca4080 + 19a56a6 commit ea4f9c3

File tree

5 files changed

+57
-7
lines changed

5 files changed

+57
-7
lines changed

drivers/cpufreq/cpufreq.c

+49-4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ static void cpufreq_governor_limits(struct cpufreq_policy *policy);
8686
static int cpufreq_set_policy(struct cpufreq_policy *policy,
8787
struct cpufreq_governor *new_gov,
8888
unsigned int new_pol);
89+
static bool cpufreq_boost_supported(void);
8990

9091
/*
9192
* Two notifier lists: the "policy" list is involved in the
@@ -455,8 +456,10 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy,
455456
policy->cur,
456457
policy->cpuinfo.max_freq);
457458

459+
spin_lock(&policy->transition_lock);
458460
policy->transition_ongoing = false;
459461
policy->transition_task = NULL;
462+
spin_unlock(&policy->transition_lock);
460463

461464
wake_up(&policy->transition_wait);
462465
}
@@ -621,6 +624,40 @@ static ssize_t store_boost(struct kobject *kobj, struct kobj_attribute *attr,
621624
}
622625
define_one_global_rw(boost);
623626

627+
static ssize_t show_local_boost(struct cpufreq_policy *policy, char *buf)
628+
{
629+
return sysfs_emit(buf, "%d\n", policy->boost_enabled);
630+
}
631+
632+
static ssize_t store_local_boost(struct cpufreq_policy *policy,
633+
const char *buf, size_t count)
634+
{
635+
int ret, enable;
636+
637+
ret = kstrtoint(buf, 10, &enable);
638+
if (ret || enable < 0 || enable > 1)
639+
return -EINVAL;
640+
641+
if (!cpufreq_driver->boost_enabled)
642+
return -EINVAL;
643+
644+
if (policy->boost_enabled == enable)
645+
return count;
646+
647+
cpus_read_lock();
648+
ret = cpufreq_driver->set_boost(policy, enable);
649+
cpus_read_unlock();
650+
651+
if (ret)
652+
return ret;
653+
654+
policy->boost_enabled = enable;
655+
656+
return count;
657+
}
658+
659+
static struct freq_attr local_boost = __ATTR(boost, 0644, show_local_boost, store_local_boost);
660+
624661
static struct cpufreq_governor *find_governor(const char *str_governor)
625662
{
626663
struct cpufreq_governor *t;
@@ -1055,6 +1092,12 @@ static int cpufreq_add_dev_interface(struct cpufreq_policy *policy)
10551092
return ret;
10561093
}
10571094

1095+
if (cpufreq_boost_supported()) {
1096+
ret = sysfs_create_file(&policy->kobj, &local_boost.attr);
1097+
if (ret)
1098+
return ret;
1099+
}
1100+
10581101
return 0;
10591102
}
10601103

@@ -1943,16 +1986,16 @@ void cpufreq_resume(void)
19431986

19441987
for_each_active_policy(policy) {
19451988
if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) {
1946-
pr_err("%s: Failed to resume driver: %p\n", __func__,
1947-
policy);
1989+
pr_err("%s: Failed to resume driver: %s\n", __func__,
1990+
cpufreq_driver->name);
19481991
} else if (has_target()) {
19491992
down_write(&policy->rwsem);
19501993
ret = cpufreq_start_governor(policy);
19511994
up_write(&policy->rwsem);
19521995

19531996
if (ret)
1954-
pr_err("%s: Failed to start governor for policy: %p\n",
1955-
__func__, policy);
1997+
pr_err("%s: Failed to start governor for CPU%u's policy\n",
1998+
__func__, policy->cpu);
19561999
}
19572000
}
19582001
}
@@ -2716,6 +2759,8 @@ int cpufreq_boost_trigger_state(int state)
27162759
ret = cpufreq_driver->set_boost(policy, state);
27172760
if (ret)
27182761
goto err_reset_state;
2762+
2763+
policy->boost_enabled = state;
27192764
}
27202765
cpus_read_unlock();
27212766

drivers/cpufreq/cpufreq_governor.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)
439439

440440
ret = gov->init(dbs_data);
441441
if (ret)
442-
goto free_policy_dbs_info;
442+
goto free_dbs_data;
443443

444444
/*
445445
* The sampling interval should not be less than the transition latency
@@ -474,6 +474,8 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)
474474
if (!have_governor_per_policy())
475475
gov->gdbs_data = NULL;
476476
gov->exit(dbs_data);
477+
478+
free_dbs_data:
477479
kfree(dbs_data);
478480

479481
free_policy_dbs_info:

drivers/cpufreq/pcc-cpufreq.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy,
232232
status = ioread16(&pcch_hdr->status);
233233
iowrite16(0, &pcch_hdr->status);
234234

235-
cpufreq_freq_transition_end(policy, &freqs, status != CMD_COMPLETE);
236235
spin_unlock(&pcc_lock);
236+
cpufreq_freq_transition_end(policy, &freqs, status != CMD_COMPLETE);
237237

238238
if (status != CMD_COMPLETE) {
239239
pr_debug("target: FAILED for cpu %d, with status: 0x%x\n",

include/linux/cpufreq.h

+3
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ struct cpufreq_policy {
141141
*/
142142
bool dvfs_possible_from_any_cpu;
143143

144+
/* Per policy boost enabled flag. */
145+
bool boost_enabled;
146+
144147
/* Cached frequency lookup from cpufreq_driver_resolve_freq. */
145148
unsigned int cached_target_freq;
146149
unsigned int cached_resolved_idx;

tools/power/cpupower/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ LIB_MIN= 1
5757

5858
PACKAGE = cpupower
5959
PACKAGE_BUGREPORT = [email protected]
60-
LANGUAGES = de fr it cs pt
60+
LANGUAGES = de fr it cs pt ka
6161

6262

6363
# Directory definitions. These are default and most probably

0 commit comments

Comments
 (0)