Skip to content

Commit 8c76163

Browse files
committed
Merge tag 'pm-6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "Update cpufreq documentation to match the code after recent changes (Christian Loehle), fix a units conversion issue in the CPPC cpufreq driver (liwei), and fix an error check in the dtpm_devfreq power capping driver (Yuan Can)" * tag 'pm-6.12-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: CPPC: fix perf_to_khz/khz_to_perf conversion exception powercap: dtpm_devfreq: Fix error check against dev_pm_qos_add_request() cpufreq: docs: Reflect latency changes in docs
2 parents 48005a5 + 1646a3f commit 8c76163

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

Documentation/admin-guide/pm/cpufreq.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ This governor exposes only one tunable:
425425

426426
``rate_limit_us``
427427
Minimum time (in microseconds) that has to pass between two consecutive
428-
runs of governor computations (default: 1000 times the scaling driver's
429-
transition latency).
428+
runs of governor computations (default: 1.5 times the scaling driver's
429+
transition latency or the maximum 2ms).
430430

431431
The purpose of this tunable is to reduce the scheduler context overhead
432432
of the governor which might be excessive without it.
@@ -474,17 +474,17 @@ This governor exposes the following tunables:
474474
This is how often the governor's worker routine should run, in
475475
microseconds.
476476

477-
Typically, it is set to values of the order of 10000 (10 ms). Its
478-
default value is equal to the value of ``cpuinfo_transition_latency``
479-
for each policy this governor is attached to (but since the unit here
480-
is greater by 1000, this means that the time represented by
481-
``sampling_rate`` is 1000 times greater than the transition latency by
482-
default).
477+
Typically, it is set to values of the order of 2000 (2 ms). Its
478+
default value is to add a 50% breathing room
479+
to ``cpuinfo_transition_latency`` on each policy this governor is
480+
attached to. The minimum is typically the length of two scheduler
481+
ticks.
483482

484483
If this tunable is per-policy, the following shell command sets the time
485-
represented by it to be 750 times as high as the transition latency::
484+
represented by it to be 1.5 times as high as the transition latency
485+
(the default)::
486486

487-
# echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) > ondemand/sampling_rate
487+
# echo `$(($(cat cpuinfo_transition_latency) * 3 / 2)) > ondemand/sampling_rate
488488

489489
``up_threshold``
490490
If the estimated CPU load is above this value (in percent), the governor

drivers/acpi/cppc_acpi.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,9 +1916,15 @@ unsigned int cppc_perf_to_khz(struct cppc_perf_caps *caps, unsigned int perf)
19161916
u64 mul, div;
19171917

19181918
if (caps->lowest_freq && caps->nominal_freq) {
1919-
mul = caps->nominal_freq - caps->lowest_freq;
1919+
/* Avoid special case when nominal_freq is equal to lowest_freq */
1920+
if (caps->lowest_freq == caps->nominal_freq) {
1921+
mul = caps->nominal_freq;
1922+
div = caps->nominal_perf;
1923+
} else {
1924+
mul = caps->nominal_freq - caps->lowest_freq;
1925+
div = caps->nominal_perf - caps->lowest_perf;
1926+
}
19201927
mul *= KHZ_PER_MHZ;
1921-
div = caps->nominal_perf - caps->lowest_perf;
19221928
offset = caps->nominal_freq * KHZ_PER_MHZ -
19231929
div64_u64(caps->nominal_perf * mul, div);
19241930
} else {
@@ -1939,11 +1945,17 @@ unsigned int cppc_khz_to_perf(struct cppc_perf_caps *caps, unsigned int freq)
19391945
{
19401946
s64 retval, offset = 0;
19411947
static u64 max_khz;
1942-
u64 mul, div;
1948+
u64 mul, div;
19431949

19441950
if (caps->lowest_freq && caps->nominal_freq) {
1945-
mul = caps->nominal_perf - caps->lowest_perf;
1946-
div = caps->nominal_freq - caps->lowest_freq;
1951+
/* Avoid special case when nominal_freq is equal to lowest_freq */
1952+
if (caps->lowest_freq == caps->nominal_freq) {
1953+
mul = caps->nominal_perf;
1954+
div = caps->nominal_freq;
1955+
} else {
1956+
mul = caps->nominal_perf - caps->lowest_perf;
1957+
div = caps->nominal_freq - caps->lowest_freq;
1958+
}
19471959
/*
19481960
* We don't need to convert to kHz for computing offset and can
19491961
* directly use nominal_freq and lowest_freq as the div64_u64

drivers/powercap/dtpm_devfreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int __dtpm_devfreq_setup(struct devfreq *devfreq, struct dtpm *parent)
178178
ret = dev_pm_qos_add_request(dev, &dtpm_devfreq->qos_req,
179179
DEV_PM_QOS_MAX_FREQUENCY,
180180
PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE);
181-
if (ret) {
181+
if (ret < 0) {
182182
pr_err("Failed to add QoS request: %d\n", ret);
183183
goto out_dtpm_unregister;
184184
}

0 commit comments

Comments
 (0)