forked from Minki/linux
Power management fixes for 5.15-rc2
- Prevent intel_pstate from avoiding to use HWP, even if instructed to do so via the kernel command line, when HWP has been enabled already by the platform firmware (Doug Smythies). - Prevent use-after-free from occurring in the schedutil cpufreq governor on exit by fixing a core helper function that attempts to access memory associated with a kobject after calling kobject_put() on it (James Morse). -----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmFE2wsSHHJqd0Byand5 c29ja2kubmV0AAoJEILEb/54YlRx050P/0tsaaPhfNuguwORa/rV6UCWOmFtIuSA Td9tmkwee7ff3WKDCOFqMU+peKC443C/jVGLy7lPs/v9vDfD5QaJTcfL4Ua1ifjP gW+2Rf1omOdFQuB31JZNO9HV3/FRgo5KX0hUA+3qh+MsPGOF9BlWf96N1rDrwtyA Vsgx66LcOmAJg67YX0MZhtNm/RMBV4aFVArU6GgEGaURoHH5OgVg4yuRgeKarZin weyVPqY7rOEMCUq5gXl5qpMlLw6O8P89lsQJrqoIWeOh1zmz5CPrzcE5QT0pVWcd 6m704TYC5ajpqUc6XaMkgkQXSIwHbcPe3IDB5SvP1eQE/duhD+gw2osyHKqE5C3c pVtS2z1PFnhByVnRbUP53znwaYyyp63vriyq7zGxs5SwNmgENEavMMu6/C0loTOp fpfGvwZbVItxrRVHm+Y49pzSoSwy+aNQq5wTT0rVD670TqpZREKl/HcACihyZLQO E23zvOH4OyAW5j8SdPmZMU9m/aJqjfVCduapf5iLe72pOhB28rVQ+DWupJ5395RP 5qoLKeGxPewy1qtc2PF41lztSfah9pDSrtxBv5ebVDu5uOLt71svaF1fdsixWBlo +MHMS+njeJzq5C0iXbfLvUBGw7XCUauax6CkkNl5ooYaFZFp0Gb+YHEs6fiXA8Oh ZlkT9hVE9ARj =ytGW -----END PGP SIGNATURE----- Merge tag 'pm-5.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull power management fixes from Rafael Wysocki: "These fix two cpufreq issues, one in the intel_pstate driver and one in the core. Specifics: - Prevent intel_pstate from avoiding to use HWP, even if instructed to do so via the kernel command line, when HWP has been enabled already by the platform firmware (Doug Smythies). - Prevent use-after-free from occurring in the schedutil cpufreq governor on exit by fixing a core helper function that attempts to access memory associated with a kobject after calling kobject_put() on it (James Morse)" * tag 'pm-5.15-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: schedutil: Destroy mutex before kobject_put() frees the memory cpufreq: intel_pstate: Override parameters if HWP forced by BIOS
This commit is contained in:
commit
4357f03d66
@ -74,8 +74,8 @@ unsigned int gov_attr_set_put(struct gov_attr_set *attr_set, struct list_head *l
|
||||
if (count)
|
||||
return count;
|
||||
|
||||
kobject_put(&attr_set->kobj);
|
||||
mutex_destroy(&attr_set->update_lock);
|
||||
kobject_put(&attr_set->kobj);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gov_attr_set_put);
|
||||
|
@ -3205,11 +3205,15 @@ static int __init intel_pstate_init(void)
|
||||
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
|
||||
return -ENODEV;
|
||||
|
||||
if (no_load)
|
||||
return -ENODEV;
|
||||
|
||||
id = x86_match_cpu(hwp_support_ids);
|
||||
if (id) {
|
||||
bool hwp_forced = intel_pstate_hwp_is_enabled();
|
||||
|
||||
if (hwp_forced)
|
||||
pr_info("HWP enabled by BIOS\n");
|
||||
else if (no_load)
|
||||
return -ENODEV;
|
||||
|
||||
copy_cpu_funcs(&core_funcs);
|
||||
/*
|
||||
* Avoid enabling HWP for processors without EPP support,
|
||||
@ -3219,8 +3223,7 @@ static int __init intel_pstate_init(void)
|
||||
* If HWP is enabled already, though, there is no choice but to
|
||||
* deal with it.
|
||||
*/
|
||||
if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) ||
|
||||
intel_pstate_hwp_is_enabled()) {
|
||||
if ((!no_hwp && boot_cpu_has(X86_FEATURE_HWP_EPP)) || hwp_forced) {
|
||||
hwp_active++;
|
||||
hwp_mode_bdw = id->driver_data;
|
||||
intel_pstate.attr = hwp_cpufreq_attrs;
|
||||
@ -3235,7 +3238,11 @@ static int __init intel_pstate_init(void)
|
||||
|
||||
goto hwp_cpu_matched;
|
||||
}
|
||||
pr_info("HWP not enabled\n");
|
||||
} else {
|
||||
if (no_load)
|
||||
return -ENODEV;
|
||||
|
||||
id = x86_match_cpu(intel_pstate_cpu_ids);
|
||||
if (!id) {
|
||||
pr_info("CPU model not supported\n");
|
||||
@ -3314,10 +3321,9 @@ static int __init intel_pstate_setup(char *str)
|
||||
else if (!strcmp(str, "passive"))
|
||||
default_driver = &intel_cpufreq;
|
||||
|
||||
if (!strcmp(str, "no_hwp")) {
|
||||
pr_info("HWP disabled\n");
|
||||
if (!strcmp(str, "no_hwp"))
|
||||
no_hwp = 1;
|
||||
}
|
||||
|
||||
if (!strcmp(str, "force"))
|
||||
force_load = 1;
|
||||
if (!strcmp(str, "hwp_only"))
|
||||
|
Loading…
Reference in New Issue
Block a user