Skip to content

Commit

Permalink
Merge branches 'pm-cpufreq' and 'pm-cpuidle'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rafaeljw committed Oct 23, 2020
3 parents 330e393 + 0070ea2 + 75af76d commit db06391
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 23 deletions.
8 changes: 8 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4588,6 +4588,14 @@ L: [email protected]
S: Supported
F: drivers/cpuidle/cpuidle-psci.c

CPUIDLE DRIVER - ARM PSCI PM DOMAIN
M: Ulf Hansson <[email protected]>
L: [email protected]
L: [email protected]
S: Supported
F: drivers/cpuidle/cpuidle-psci.h
F: drivers/cpuidle/cpuidle-psci-domain.c

CRAMFS FILESYSTEM
M: Nicolas Pitre <[email protected]>
S: Maintained
Expand Down
3 changes: 2 additions & 1 deletion drivers/cpufreq/acpi-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
cpumask_copy(policy->cpus, topology_core_cpumask(cpu));
}

if (check_amd_hwpstate_cpu(cpu) && !acpi_pstate_strict) {
if (check_amd_hwpstate_cpu(cpu) && boot_cpu_data.x86 < 0x19 &&
!acpi_pstate_strict) {
cpumask_clear(policy->cpus);
cpumask_set_cpu(cpu, policy->cpus);
cpumask_copy(data->freqdomain_cpus,
Expand Down
15 changes: 7 additions & 8 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1454,23 +1454,22 @@ static int cpufreq_online(unsigned int cpu)
*/
if ((cpufreq_driver->flags & CPUFREQ_NEED_INITIAL_FREQ_CHECK)
&& has_target()) {
unsigned int old_freq = policy->cur;

/* Are we running at unknown frequency ? */
ret = cpufreq_frequency_table_get_index(policy, policy->cur);
ret = cpufreq_frequency_table_get_index(policy, old_freq);
if (ret == -EINVAL) {
/* Warn user and fix it */
pr_warn("%s: CPU%d: Running at unlisted freq: %u KHz\n",
__func__, policy->cpu, policy->cur);
ret = __cpufreq_driver_target(policy, policy->cur - 1,
CPUFREQ_RELATION_L);
ret = __cpufreq_driver_target(policy, old_freq - 1,
CPUFREQ_RELATION_L);

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

Expand Down
22 changes: 21 additions & 1 deletion drivers/cpufreq/intel_pstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1420,6 +1420,24 @@ static void __init intel_pstate_sysfs_expose_params(void)
}
}

static void __init intel_pstate_sysfs_remove(void)
{
if (!intel_pstate_kobject)
return;

sysfs_remove_group(intel_pstate_kobject, &intel_pstate_attr_group);

if (!per_cpu_limits) {
sysfs_remove_file(intel_pstate_kobject, &max_perf_pct.attr);
sysfs_remove_file(intel_pstate_kobject, &min_perf_pct.attr);

if (x86_match_cpu(intel_pstate_cpu_ee_disable_ids))
sysfs_remove_file(intel_pstate_kobject, &energy_efficiency.attr);
}

kobject_put(intel_pstate_kobject);
}

static void intel_pstate_sysfs_expose_hwp_dynamic_boost(void)
{
int rc;
Expand Down Expand Up @@ -3063,8 +3081,10 @@ static int __init intel_pstate_init(void)
mutex_lock(&intel_pstate_driver_lock);
rc = intel_pstate_register_driver(default_driver);
mutex_unlock(&intel_pstate_driver_lock);
if (rc)
if (rc) {
intel_pstate_sysfs_remove();
return rc;
}

if (hwp_active) {
const struct x86_cpu_id *id;
Expand Down
15 changes: 9 additions & 6 deletions drivers/idle/intel_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

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

/*
Expand Down Expand Up @@ -1212,14 +1216,13 @@ static bool __init intel_idle_acpi_cst_extract(void)
if (!intel_idle_cst_usable())
continue;

if (!acpi_processor_claim_cst_control()) {
acpi_state_table.count = 0;
return false;
}
if (!acpi_processor_claim_cst_control())
break;

return true;
}

acpi_state_table.count = 0;
pr_debug("ACPI _CST not found or not usable\n");
return false;
}
Expand Down
5 changes: 0 additions & 5 deletions include/linux/cpuidle.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,8 @@ struct cpuidle_governor {
void (*reflect) (struct cpuidle_device *dev, int index);
};

#ifdef CONFIG_CPU_IDLE
extern int cpuidle_register_governor(struct cpuidle_governor *gov);
extern s64 cpuidle_governor_latency_req(unsigned int cpu);
#else
static inline int cpuidle_register_governor(struct cpuidle_governor *gov)
{return 0;}
#endif

#define __CPU_PM_CPU_IDLE_ENTER(low_level_idle_enter, \
idx, \
Expand Down
5 changes: 3 additions & 2 deletions kernel/sched/cpufreq_schedutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
unsigned long util, max;
unsigned int next_f;
bool busy;
unsigned int cached_freq = sg_policy->cached_raw_freq;

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

/* Reset cached freq as next_freq has changed */
sg_policy->cached_raw_freq = 0;
/* Restore cached freq as next_freq has changed */
sg_policy->cached_raw_freq = cached_freq;
}

/*
Expand Down

0 comments on commit db06391

Please sign in to comment.