Skip to content

Commit bddce1c

Browse files
committed
Merge branches 'pm-sleep' and 'pm-em'
Merge a hibernation regression fix and an fix related to energy model management for 6.17-rc6 * pm-sleep: PM: hibernate: Restrict GFP mask in hibernation_snapshot() * pm-em: PM: EM: Add function for registering a PD without capacity update
3 parents 971e2c8 + 449c9c0 + e042354 commit bddce1c

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,8 +1034,8 @@ static bool hybrid_register_perf_domain(unsigned int cpu)
10341034
if (!cpu_dev)
10351035
return false;
10361036

1037-
if (em_dev_register_perf_domain(cpu_dev, HYBRID_EM_STATE_COUNT, &cb,
1038-
cpumask_of(cpu), false))
1037+
if (em_dev_register_pd_no_update(cpu_dev, HYBRID_EM_STATE_COUNT, &cb,
1038+
cpumask_of(cpu), false))
10391039
return false;
10401040

10411041
cpudata->pd_registered = true;

include/linux/energy_model.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ int em_dev_update_perf_domain(struct device *dev,
171171
int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
172172
const struct em_data_callback *cb,
173173
const cpumask_t *cpus, bool microwatts);
174+
int em_dev_register_pd_no_update(struct device *dev, unsigned int nr_states,
175+
const struct em_data_callback *cb,
176+
const cpumask_t *cpus, bool microwatts);
174177
void em_dev_unregister_perf_domain(struct device *dev);
175178
struct em_perf_table *em_table_alloc(struct em_perf_domain *pd);
176179
void em_table_free(struct em_perf_table *table);
@@ -350,6 +353,13 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
350353
{
351354
return -EINVAL;
352355
}
356+
static inline
357+
int em_dev_register_pd_no_update(struct device *dev, unsigned int nr_states,
358+
const struct em_data_callback *cb,
359+
const cpumask_t *cpus, bool microwatts)
360+
{
361+
return -EINVAL;
362+
}
353363
static inline void em_dev_unregister_perf_domain(struct device *dev)
354364
{
355365
}

kernel/power/energy_model.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,30 @@ EXPORT_SYMBOL_GPL(em_cpu_get);
552552
int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
553553
const struct em_data_callback *cb,
554554
const cpumask_t *cpus, bool microwatts)
555+
{
556+
int ret = em_dev_register_pd_no_update(dev, nr_states, cb, cpus, microwatts);
557+
558+
if (_is_cpu_device(dev))
559+
em_check_capacity_update();
560+
561+
return ret;
562+
}
563+
EXPORT_SYMBOL_GPL(em_dev_register_perf_domain);
564+
565+
/**
566+
* em_dev_register_pd_no_update() - Register a perf domain for a device
567+
* @dev : Device to register the PD for
568+
* @nr_states : Number of performance states in the new PD
569+
* @cb : Callback functions for populating the energy model
570+
* @cpus : CPUs to include in the new PD (mandatory if @dev is a CPU device)
571+
* @microwatts : Whether or not the power values in the EM will be in uW
572+
*
573+
* Like em_dev_register_perf_domain(), but does not trigger a CPU capacity
574+
* update after registering the PD, even if @dev is a CPU device.
575+
*/
576+
int em_dev_register_pd_no_update(struct device *dev, unsigned int nr_states,
577+
const struct em_data_callback *cb,
578+
const cpumask_t *cpus, bool microwatts)
555579
{
556580
struct em_perf_table *em_table;
557581
unsigned long cap, prev_cap = 0;
@@ -636,12 +660,9 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
636660
unlock:
637661
mutex_unlock(&em_pd_mutex);
638662

639-
if (_is_cpu_device(dev))
640-
em_check_capacity_update();
641-
642663
return ret;
643664
}
644-
EXPORT_SYMBOL_GPL(em_dev_register_perf_domain);
665+
EXPORT_SYMBOL_GPL(em_dev_register_pd_no_update);
645666

646667
/**
647668
* em_dev_unregister_perf_domain() - Unregister Energy Model (EM) for a device

kernel/power/hibernate.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ int hibernation_snapshot(int platform_mode)
449449
shrink_shmem_memory();
450450

451451
console_suspend_all();
452+
pm_restrict_gfp_mask();
452453

453454
error = dpm_suspend(PMSG_FREEZE);
454455

0 commit comments

Comments
 (0)