Power management fixes for 6.12-rc5

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).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmcbu+YSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxnD8QAKEuSwuaLSppb1lhXgXdab3YjBoMDgGn
 n3DGX+eo5Yms9hpdDLq95z3I11DlZzSbZeZkXniTjugp46sm3PWQAaXQR4EZOcoh
 1UYQ9qEVPBdsdcB/oobxbPDfhF89YanZNzKVWFDaT54QJjXcspfwccutRw2xZhgB
 Gwl0HdKdpptuD00iKtA5mLuztNxgEGrErAVwuIbcMnn+w5aGiyU57qVJj6GBXmAz
 4CBHWEO8fok8jPNIrXCULBkdGddYhoR05S7El6PS/CjiUuOZQAKhqgsGMMqOw4VI
 Jm0AYa4rGT4nk9/kkklfIvQqprD8x6PyCN63iMadbkT+nXfTP9hn6nYd3zNW5biJ
 ERTZ7uIIwHkire73XJYyheZqG0xMm0Xox0uMpLvSpldCz/WqOlAkyF5PgFN2O4NX
 qmXRkdy4RLbAWcIXWjYwlM90uyqR0utHdGf6Yr0bN+FuD2DP807iNCe7ysoozcVO
 Mp8c2H2crQwoxIVuWorqKSqeVa8Q5jkk9INhFQ5QflLhV3Dz2h5tnG4jlDo3AU0x
 LNyAURwyPy45q9DYZva1ORGTa+hMausV2MtqZw76Z28RWn6I42kVZcJNCKxOMiob
 OfeLOZWmIeOZK92g10CuLu94M0Wi+fuRcn1U52srnFfwTBRKhGFNryfszYlk7h+f
 G/QX3AlNnstH
 =6+Ra
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2024-10-25 11:00:50 -07:00
commit 8c76163fff
3 changed files with 28 additions and 16 deletions

View File

@ -425,8 +425,8 @@ This governor exposes only one tunable:
``rate_limit_us``
Minimum time (in microseconds) that has to pass between two consecutive
runs of governor computations (default: 1000 times the scaling driver's
transition latency).
runs of governor computations (default: 1.5 times the scaling driver's
transition latency or the maximum 2ms).
The purpose of this tunable is to reduce the scheduler context overhead
of the governor which might be excessive without it.
@ -474,17 +474,17 @@ This governor exposes the following tunables:
This is how often the governor's worker routine should run, in
microseconds.
Typically, it is set to values of the order of 10000 (10 ms). Its
default value is equal to the value of ``cpuinfo_transition_latency``
for each policy this governor is attached to (but since the unit here
is greater by 1000, this means that the time represented by
``sampling_rate`` is 1000 times greater than the transition latency by
default).
Typically, it is set to values of the order of 2000 (2 ms). Its
default value is to add a 50% breathing room
to ``cpuinfo_transition_latency`` on each policy this governor is
attached to. The minimum is typically the length of two scheduler
ticks.
If this tunable is per-policy, the following shell command sets the time
represented by it to be 750 times as high as the transition latency::
represented by it to be 1.5 times as high as the transition latency
(the default)::
# echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) > ondemand/sampling_rate
# echo `$(($(cat cpuinfo_transition_latency) * 3 / 2)) > ondemand/sampling_rate
``up_threshold``
If the estimated CPU load is above this value (in percent), the governor

View File

@ -1916,9 +1916,15 @@ unsigned int cppc_perf_to_khz(struct cppc_perf_caps *caps, unsigned int perf)
u64 mul, div;
if (caps->lowest_freq && caps->nominal_freq) {
mul = caps->nominal_freq - caps->lowest_freq;
/* Avoid special case when nominal_freq is equal to lowest_freq */
if (caps->lowest_freq == caps->nominal_freq) {
mul = caps->nominal_freq;
div = caps->nominal_perf;
} else {
mul = caps->nominal_freq - caps->lowest_freq;
div = caps->nominal_perf - caps->lowest_perf;
}
mul *= KHZ_PER_MHZ;
div = caps->nominal_perf - caps->lowest_perf;
offset = caps->nominal_freq * KHZ_PER_MHZ -
div64_u64(caps->nominal_perf * mul, div);
} else {
@ -1939,11 +1945,17 @@ unsigned int cppc_khz_to_perf(struct cppc_perf_caps *caps, unsigned int freq)
{
s64 retval, offset = 0;
static u64 max_khz;
u64 mul, div;
u64 mul, div;
if (caps->lowest_freq && caps->nominal_freq) {
mul = caps->nominal_perf - caps->lowest_perf;
div = caps->nominal_freq - caps->lowest_freq;
/* Avoid special case when nominal_freq is equal to lowest_freq */
if (caps->lowest_freq == caps->nominal_freq) {
mul = caps->nominal_perf;
div = caps->nominal_freq;
} else {
mul = caps->nominal_perf - caps->lowest_perf;
div = caps->nominal_freq - caps->lowest_freq;
}
/*
* We don't need to convert to kHz for computing offset and can
* directly use nominal_freq and lowest_freq as the div64_u64

View File

@ -178,7 +178,7 @@ static int __dtpm_devfreq_setup(struct devfreq *devfreq, struct dtpm *parent)
ret = dev_pm_qos_add_request(dev, &dtpm_devfreq->qos_req,
DEV_PM_QOS_MAX_FREQUENCY,
PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE);
if (ret) {
if (ret < 0) {
pr_err("Failed to add QoS request: %d\n", ret);
goto out_dtpm_unregister;
}