Skip to content

Commit db06391

Browse files
committed
Merge branches 'pm-cpufreq' and 'pm-cpuidle'
* pm-cpufreq: cpufreq: schedutil: restore cached freq when next_f is not changed acpi-cpufreq: Honor _PSD table setting on new AMD CPUs cpufreq: intel_pstate: Delete intel_pstate sysfs if failed to register the driver cpufreq: Improve code around unlisted freq check * pm-cpuidle: intel_idle: Ignore _CST if control cannot be taken from the platform cpuidle: Remove pointless stub intel_idle: mention assumption that WBINVD is not needed MAINTAINERS: Add section for cpuidle-psci PM domain
3 parents 330e393 + 0070ea2 + 75af76d commit db06391

7 files changed

Lines changed: 50 additions & 23 deletions

File tree

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4588,6 +4588,14 @@ L: linux-arm-kernel@lists.infradead.org
45884588
S: Supported
45894589
F: drivers/cpuidle/cpuidle-psci.c
45904590

4591+
CPUIDLE DRIVER - ARM PSCI PM DOMAIN
4592+
M: Ulf Hansson <ulf.hansson@linaro.org>
4593+
L: linux-pm@vger.kernel.org
4594+
L: linux-arm-kernel@lists.infradead.org
4595+
S: Supported
4596+
F: drivers/cpuidle/cpuidle-psci.h
4597+
F: drivers/cpuidle/cpuidle-psci-domain.c
4598+
45914599
CRAMFS FILESYSTEM
45924600
M: Nicolas Pitre <nico@fluxnic.net>
45934601
S: Maintained

drivers/cpufreq/acpi-cpufreq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
691691
cpumask_copy(policy->cpus, topology_core_cpumask(cpu));
692692
}
693693

694-
if (check_amd_hwpstate_cpu(cpu) && !acpi_pstate_strict) {
694+
if (check_amd_hwpstate_cpu(cpu) && boot_cpu_data.x86 < 0x19 &&
695+
!acpi_pstate_strict) {
695696
cpumask_clear(policy->cpus);
696697
cpumask_set_cpu(cpu, policy->cpus);
697698
cpumask_copy(data->freqdomain_cpus,

drivers/cpufreq/cpufreq.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,23 +1454,22 @@ static int cpufreq_online(unsigned int cpu)
14541454
*/
14551455
if ((cpufreq_driver->flags & CPUFREQ_NEED_INITIAL_FREQ_CHECK)
14561456
&& has_target()) {
1457+
unsigned int old_freq = policy->cur;
1458+
14571459
/* Are we running at unknown frequency ? */
1458-
ret = cpufreq_frequency_table_get_index(policy, policy->cur);
1460+
ret = cpufreq_frequency_table_get_index(policy, old_freq);
14591461
if (ret == -EINVAL) {
1460-
/* Warn user and fix it */
1461-
pr_warn("%s: CPU%d: Running at unlisted freq: %u KHz\n",
1462-
__func__, policy->cpu, policy->cur);
1463-
ret = __cpufreq_driver_target(policy, policy->cur - 1,
1464-
CPUFREQ_RELATION_L);
1462+
ret = __cpufreq_driver_target(policy, old_freq - 1,
1463+
CPUFREQ_RELATION_L);
14651464

14661465
/*
14671466
* Reaching here after boot in a few seconds may not
14681467
* mean that system will remain stable at "unknown"
14691468
* frequency for longer duration. Hence, a BUG_ON().
14701469
*/
14711470
BUG_ON(ret);
1472-
pr_warn("%s: CPU%d: Unlisted initial frequency changed to: %u KHz\n",
1473-
__func__, policy->cpu, policy->cur);
1471+
pr_info("%s: CPU%d: Running at unlisted initial frequency: %u KHz, changing to: %u KHz\n",
1472+
__func__, policy->cpu, old_freq, policy->cur);
14741473
}
14751474
}
14761475

drivers/cpufreq/intel_pstate.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,24 @@ static void __init intel_pstate_sysfs_expose_params(void)
14201420
}
14211421
}
14221422

1423+
static void __init intel_pstate_sysfs_remove(void)
1424+
{
1425+
if (!intel_pstate_kobject)
1426+
return;
1427+
1428+
sysfs_remove_group(intel_pstate_kobject, &intel_pstate_attr_group);
1429+
1430+
if (!per_cpu_limits) {
1431+
sysfs_remove_file(intel_pstate_kobject, &max_perf_pct.attr);
1432+
sysfs_remove_file(intel_pstate_kobject, &min_perf_pct.attr);
1433+
1434+
if (x86_match_cpu(intel_pstate_cpu_ee_disable_ids))
1435+
sysfs_remove_file(intel_pstate_kobject, &energy_efficiency.attr);
1436+
}
1437+
1438+
kobject_put(intel_pstate_kobject);
1439+
}
1440+
14231441
static void intel_pstate_sysfs_expose_hwp_dynamic_boost(void)
14241442
{
14251443
int rc;
@@ -3063,8 +3081,10 @@ static int __init intel_pstate_init(void)
30633081
mutex_lock(&intel_pstate_driver_lock);
30643082
rc = intel_pstate_register_driver(default_driver);
30653083
mutex_unlock(&intel_pstate_driver_lock);
3066-
if (rc)
3084+
if (rc) {
3085+
intel_pstate_sysfs_remove();
30673086
return rc;
3087+
}
30683088

30693089
if (hwp_active) {
30703090
const struct x86_cpu_id *id;

drivers/idle/intel_idle.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
/*
11-
* intel_idle is a cpuidle driver that loads on specific Intel processors
11+
* intel_idle is a cpuidle driver that loads on all Intel CPUs with MWAIT
1212
* in lieu of the legacy ACPI processor_idle driver. The intent is to
1313
* make Linux more efficient on these processors, as intel_idle knows
1414
* more than ACPI, as well as make Linux more immune to ACPI BIOS bugs.
@@ -20,7 +20,11 @@
2020
* All CPUs have same idle states as boot CPU
2121
*
2222
* Chipset BM_STS (bus master status) bit is a NOP
23-
* for preventing entry into deep C-stats
23+
* for preventing entry into deep C-states
24+
*
25+
* CPU will flush caches as needed when entering a C-state via MWAIT
26+
* (in contrast to entering ACPI C3, in which case the WBINVD
27+
* instruction needs to be executed to flush the caches)
2428
*/
2529

2630
/*
@@ -1212,14 +1216,13 @@ static bool __init intel_idle_acpi_cst_extract(void)
12121216
if (!intel_idle_cst_usable())
12131217
continue;
12141218

1215-
if (!acpi_processor_claim_cst_control()) {
1216-
acpi_state_table.count = 0;
1217-
return false;
1218-
}
1219+
if (!acpi_processor_claim_cst_control())
1220+
break;
12191221

12201222
return true;
12211223
}
12221224

1225+
acpi_state_table.count = 0;
12231226
pr_debug("ACPI _CST not found or not usable\n");
12241227
return false;
12251228
}

include/linux/cpuidle.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,8 @@ struct cpuidle_governor {
271271
void (*reflect) (struct cpuidle_device *dev, int index);
272272
};
273273

274-
#ifdef CONFIG_CPU_IDLE
275274
extern int cpuidle_register_governor(struct cpuidle_governor *gov);
276275
extern s64 cpuidle_governor_latency_req(unsigned int cpu);
277-
#else
278-
static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
279-
{return 0;}
280-
#endif
281276

282277
#define __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, \
283278
idx, \

kernel/sched/cpufreq_schedutil.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
441441
unsigned long util, max;
442442
unsigned int next_f;
443443
bool busy;
444+
unsigned int cached_freq = sg_policy->cached_raw_freq;
444445

445446
sugov_iowait_boost(sg_cpu, time, flags);
446447
sg_cpu->last_update = time;
@@ -464,8 +465,8 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
464465
if (busy && next_f < sg_policy->next_freq) {
465466
next_f = sg_policy->next_freq;
466467

467-
/* Reset cached freq as next_freq has changed */
468-
sg_policy->cached_raw_freq = 0;
468+
/* Restore cached freq as next_freq has changed */
469+
sg_policy->cached_raw_freq = cached_freq;
469470
}
470471

471472
/*

0 commit comments

Comments
 (0)