Skip to content

Commit 8c14577

Browse files
committed
Merge branches 'pm-cpufreq', 'pm-cpuidle', 'pm-opp' and 'powercap'
* pm-cpufreq: cpufreq: schedutil: Don't skip freq update if need_freq_update is set * pm-cpuidle: Documentation: PM: cpuidle: correct path name Documentation: PM: cpuidle: correct typo * pm-opp: opp: Reduce the size of critical section in _opp_table_kref_release() opp: Fix early exit from dev_pm_opp_register_set_opp_helper() opp: Don't always remove static OPPs in _of_add_opp_table_v1() * powercap: powercap/intel_rapl: remove unneeded semicolon
5 parents 9226c50 + 23a8818 + 23d18dc + e213cd8 + a8193af commit 8c14577

5 files changed

Lines changed: 20 additions & 19 deletions

File tree

Documentation/admin-guide/pm/cpuidle.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ order to ask the hardware to enter that state. Also, for each
478478
statistics of the given idle state. That information is exposed by the kernel
479479
via ``sysfs``.
480480

481-
For each CPU in the system, there is a :file:`/sys/devices/system/cpu<N>/cpuidle/`
481+
For each CPU in the system, there is a :file:`/sys/devices/system/cpu/cpu<N>/cpuidle/`
482482
directory in ``sysfs``, where the number ``<N>`` is assigned to the given
483483
CPU at the initialization time. That directory contains a set of subdirectories
484484
called :file:`state0`, :file:`state1` and so on, up to the number of idle state
@@ -494,7 +494,7 @@ object corresponding to it, as follows:
494494
residency.
495495

496496
``below``
497-
Total number of times this idle state had been asked for, but cerainly
497+
Total number of times this idle state had been asked for, but certainly
498498
a deeper idle state would have been a better match for the observed idle
499499
duration.
500500

drivers/opp/core.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,10 @@ static void _opp_table_kref_release(struct kref *kref)
11811181
struct opp_device *opp_dev, *temp;
11821182
int i;
11831183

1184+
/* Drop the lock as soon as we can */
1185+
list_del(&opp_table->node);
1186+
mutex_unlock(&opp_table_lock);
1187+
11841188
_of_clear_opp_table(opp_table);
11851189

11861190
/* Release clk */
@@ -1208,10 +1212,7 @@ static void _opp_table_kref_release(struct kref *kref)
12081212

12091213
mutex_destroy(&opp_table->genpd_virt_dev_lock);
12101214
mutex_destroy(&opp_table->lock);
1211-
list_del(&opp_table->node);
12121215
kfree(opp_table);
1213-
1214-
mutex_unlock(&opp_table_lock);
12151216
}
12161217

12171218
void dev_pm_opp_put_opp_table(struct opp_table *opp_table)
@@ -1930,7 +1931,7 @@ struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev,
19301931
return ERR_PTR(-EINVAL);
19311932

19321933
opp_table = dev_pm_opp_get_opp_table(dev);
1933-
if (!IS_ERR(opp_table))
1934+
if (IS_ERR(opp_table))
19341935
return opp_table;
19351936

19361937
/* This should be called before OPPs are initialized */

drivers/opp/of.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -944,6 +944,8 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
944944
nr -= 2;
945945
}
946946

947+
return 0;
948+
947949
remove_static_opp:
948950
_opp_remove_all_static(opp_table);
949951

drivers/powercap/intel_rapl_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ static u64 rapl_unit_xlate(struct rapl_domain *rd, enum unit_type type,
620620
case ARBITRARY_UNIT:
621621
default:
622622
return value;
623-
};
623+
}
624624

625625
if (to_raw)
626626
return div64_u64(value, units) * scale;

kernel/sched/cpufreq_schedutil.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,12 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
102102
static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time,
103103
unsigned int next_freq)
104104
{
105-
if (sg_policy->next_freq == next_freq &&
106-
!cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS))
107-
return false;
105+
if (!sg_policy->need_freq_update) {
106+
if (sg_policy->next_freq == next_freq)
107+
return false;
108+
} else {
109+
sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
110+
}
108111

109112
sg_policy->next_freq = next_freq;
110113
sg_policy->last_freq_update_time = time;
@@ -162,11 +165,9 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
162165

163166
freq = map_util_freq(util, freq, max);
164167

165-
if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update &&
166-
!cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS))
168+
if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update)
167169
return sg_policy->next_freq;
168170

169-
sg_policy->need_freq_update = false;
170171
sg_policy->cached_raw_freq = freq;
171172
return cpufreq_driver_resolve_freq(policy, freq);
172173
}
@@ -442,7 +443,6 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
442443
struct sugov_policy *sg_policy = sg_cpu->sg_policy;
443444
unsigned long util, max;
444445
unsigned int next_f;
445-
bool busy;
446446
unsigned int cached_freq = sg_policy->cached_raw_freq;
447447

448448
sugov_iowait_boost(sg_cpu, time, flags);
@@ -453,9 +453,6 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
453453
if (!sugov_should_update_freq(sg_policy, time))
454454
return;
455455

456-
/* Limits may have changed, don't skip frequency update */
457-
busy = !sg_policy->need_freq_update && sugov_cpu_is_busy(sg_cpu);
458-
459456
util = sugov_get_util(sg_cpu);
460457
max = sg_cpu->max;
461458
util = sugov_iowait_apply(sg_cpu, time, util, max);
@@ -464,7 +461,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
464461
* Do not reduce the frequency if the CPU has not been idle
465462
* recently, as the reduction is likely to be premature then.
466463
*/
467-
if (busy && next_f < sg_policy->next_freq) {
464+
if (sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq) {
468465
next_f = sg_policy->next_freq;
469466

470467
/* Restore cached freq as next_freq has changed */
@@ -829,9 +826,10 @@ static int sugov_start(struct cpufreq_policy *policy)
829826
sg_policy->next_freq = 0;
830827
sg_policy->work_in_progress = false;
831828
sg_policy->limits_changed = false;
832-
sg_policy->need_freq_update = false;
833829
sg_policy->cached_raw_freq = 0;
834830

831+
sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
832+
835833
for_each_cpu(cpu, policy->cpus) {
836834
struct sugov_cpu *sg_cpu = &per_cpu(sugov_cpu, cpu);
837835

0 commit comments

Comments
 (0)