Skip to content

Commit 367dc4a

Browse files
Dirk Brandewierafaeljw
authored andcommitted
cpufreq: Add stop CPU callback to cpufreq_driver interface
This callback allows the driver to do clean up before the CPU is completely down and its state cannot be modified. This is used by the intel_pstate driver to reduce the requested P state prior to the core going away. This is required because the requested P state of the offline core is used to select the package P state. This effectively sets the floor package P state to the requested P state on the offline core. Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com> [rjw: Minor modifications] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent bda9f55 commit 367dc4a

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎Documentation/cpu-freq/cpu-drivers.txt‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ target_index - See below on the differences.
6161

6262
And optionally
6363

64-
cpufreq_driver.exit - A pointer to a per-CPU cleanup function.
64+
cpufreq_driver.exit - A pointer to a per-CPU cleanup
65+
function called during CPU_POST_DEAD
66+
phase of cpu hotplug process.
67+
68+
cpufreq_driver.stop_cpu - A pointer to a per-CPU stop function
69+
called during CPU_DOWN_PREPARE phase of
70+
cpu hotplug process.
6571

6672
cpufreq_driver.resume - A pointer to a per-CPU resume function
6773
which is called with interrupts disabled

‎drivers/cpufreq/cpufreq.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,8 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
13371337
pr_debug("%s: policy Kobject moved to cpu: %d from: %d\n",
13381338
__func__, new_cpu, cpu);
13391339
}
1340+
} else if (cpufreq_driver->stop_cpu && cpufreq_driver->setpolicy) {
1341+
cpufreq_driver->stop_cpu(policy);
13401342
}
13411343

13421344
return 0;

‎include/linux/cpufreq.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ struct cpufreq_driver {
227227
int (*bios_limit) (int cpu, unsigned int *limit);
228228

229229
int (*exit) (struct cpufreq_policy *policy);
230+
void (*stop_cpu) (struct cpufreq_policy *policy);
230231
int (*suspend) (struct cpufreq_policy *policy);
231232
int (*resume) (struct cpufreq_policy *policy);
232233
struct freq_attr **attr;

0 commit comments

Comments
 (0)