Skip to content

Commit 0ce629b

Browse files
committed
Merge tag 'pm-5.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "These address three issues in the intel_pstate driver and fix two problems related to hibernation. Specifics: - Make intel_pstate work correctly on Ice Lake server systems with out-of-band performance control enabled (Adamos Ttofari). - Fix EPP handling in intel_pstate during CPU offline and online in the active mode (Rafael Wysocki). - Make intel_pstate support ITMT on asymmetric systems with overclocking enabled (Srinivas Pandruvada). - Fix hibernation image saving when using the user space interface based on the snapshot special device file (Evan Green). - Make the hibernation code release the snapshot block device using the same mode that was used when acquiring it (Thomas Zeitlhofer)" * tag 'pm-5.16-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PM: hibernate: Fix snapshot partial write lengths PM: hibernate: use correct mode for swsusp_close() cpufreq: intel_pstate: ITMT support for overclocked system cpufreq: intel_pstate: Fix active mode offline/online EPP handling cpufreq: intel_pstate: Add Ice Lake server to out-of-band IDs
2 parents 925c943 + 7803516 commit 0ce629b

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ static void intel_pstste_sched_itmt_work_fn(struct work_struct *work)
338338

339339
static DECLARE_WORK(sched_itmt_work, intel_pstste_sched_itmt_work_fn);
340340

341+
#define CPPC_MAX_PERF U8_MAX
342+
341343
static void intel_pstate_set_itmt_prio(int cpu)
342344
{
343345
struct cppc_perf_caps cppc_perf;
@@ -348,6 +350,14 @@ static void intel_pstate_set_itmt_prio(int cpu)
348350
if (ret)
349351
return;
350352

353+
/*
354+
* On some systems with overclocking enabled, CPPC.highest_perf is hardcoded to 0xff.
355+
* In this case we can't use CPPC.highest_perf to enable ITMT.
356+
* In this case we can look at MSR_HWP_CAPABILITIES bits [8:0] to decide.
357+
*/
358+
if (cppc_perf.highest_perf == CPPC_MAX_PERF)
359+
cppc_perf.highest_perf = HWP_HIGHEST_PERF(READ_ONCE(all_cpu_data[cpu]->hwp_cap_cached));
360+
351361
/*
352362
* The priorities can be set regardless of whether or not
353363
* sched_set_itmt_support(true) has been called and it is valid to
@@ -1006,6 +1016,12 @@ static void intel_pstate_hwp_offline(struct cpudata *cpu)
10061016
*/
10071017
value &= ~GENMASK_ULL(31, 24);
10081018
value |= HWP_ENERGY_PERF_PREFERENCE(cpu->epp_cached);
1019+
/*
1020+
* However, make sure that EPP will be set to "performance" when
1021+
* the CPU is brought back online again and the "performance"
1022+
* scaling algorithm is still in effect.
1023+
*/
1024+
cpu->epp_policy = CPUFREQ_POLICY_UNKNOWN;
10091025
}
10101026

10111027
/*
@@ -2353,6 +2369,7 @@ static const struct x86_cpu_id intel_pstate_cpu_oob_ids[] __initconst = {
23532369
X86_MATCH(BROADWELL_D, core_funcs),
23542370
X86_MATCH(BROADWELL_X, core_funcs),
23552371
X86_MATCH(SKYLAKE_X, core_funcs),
2372+
X86_MATCH(ICELAKE_X, core_funcs),
23562373
{}
23572374
};
23582375

kernel/power/hibernate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ static int load_image_and_restore(void)
693693
goto Unlock;
694694

695695
error = swsusp_read(&flags);
696-
swsusp_close(FMODE_READ);
696+
swsusp_close(FMODE_READ | FMODE_EXCL);
697697
if (!error)
698698
error = hibernation_restore(flags & SF_PLATFORM_MODE);
699699

@@ -983,7 +983,7 @@ static int software_resume(void)
983983
/* The snapshot device should not be opened while we're running */
984984
if (!hibernate_acquire()) {
985985
error = -EBUSY;
986-
swsusp_close(FMODE_READ);
986+
swsusp_close(FMODE_READ | FMODE_EXCL);
987987
goto Unlock;
988988
}
989989

@@ -1018,7 +1018,7 @@ static int software_resume(void)
10181018
pm_pr_dbg("Hibernation image not present or could not be loaded.\n");
10191019
return error;
10201020
Close_Finish:
1021-
swsusp_close(FMODE_READ);
1021+
swsusp_close(FMODE_READ | FMODE_EXCL);
10221022
goto Finish;
10231023
}
10241024

kernel/power/user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,
177177
if (res <= 0)
178178
goto unlock;
179179
} else {
180-
res = PAGE_SIZE - pg_offp;
180+
res = PAGE_SIZE;
181181
}
182182

183183
if (!data_of(data->handle)) {

0 commit comments

Comments
 (0)