Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pm-7.0-rc6' 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 core and one in the
conservative governor, and two issues related to system sleep:

- Restore the cpufreq core behavior changed inadvertently during the
6.19 development cycle to call cpufreq_frequency_table_cpuinfo()
for cpufreq policies getting re-initialized which ensures that
policy->max and policy->cpuinfo_max_freq will be valid going
forward (Viresh Kumar)

- Adjust the cached requested frequency in the conservative cpufreq
governor on policy limits changes to prevent it from becoming stale
in some cases (Viresh Kumar)

- Prevent pm_restore_gfp_mask() from triggering a WARN_ON() in some
code paths in which it is legitimately called without invoking
pm_restrict_gfp_mask() previously (Youngjun Park)

- Update snapshot_write_finalize() to take trailing zero pages into
account properly which prevents user space restore from failing
subsequently in some cases (Alberto Garcia)"

* tag 'pm-7.0-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
PM: sleep: Drop spurious WARN_ON() from pm_restore_gfp_mask()
PM: hibernate: Drain trailing zero pages on userspace restore
cpufreq: conservative: Reset requested_freq on limits change
cpufreq: Don't skip cpufreq_frequency_table_cpuinfo()

+35 -7
+3 -6
drivers/cpufreq/cpufreq.c
··· 1427 1427 * If there is a problem with its frequency table, take it 1428 1428 * offline and drop it. 1429 1429 */ 1430 - if (policy->freq_table_sorted != CPUFREQ_TABLE_SORTED_ASCENDING && 1431 - policy->freq_table_sorted != CPUFREQ_TABLE_SORTED_DESCENDING) { 1432 - ret = cpufreq_table_validate_and_sort(policy); 1433 - if (ret) 1434 - goto out_offline_policy; 1435 - } 1430 + ret = cpufreq_table_validate_and_sort(policy); 1431 + if (ret) 1432 + goto out_offline_policy; 1436 1433 1437 1434 /* related_cpus should at least include policy->cpus. */ 1438 1435 cpumask_copy(policy->related_cpus, policy->cpus);
+12
drivers/cpufreq/cpufreq_conservative.c
··· 313 313 dbs_info->requested_freq = policy->cur; 314 314 } 315 315 316 + static void cs_limits(struct cpufreq_policy *policy) 317 + { 318 + struct cs_policy_dbs_info *dbs_info = to_dbs_info(policy->governor_data); 319 + 320 + /* 321 + * The limits have changed, so may have the current frequency. Reset 322 + * requested_freq to avoid any unintended outcomes due to the mismatch. 323 + */ 324 + dbs_info->requested_freq = policy->cur; 325 + } 326 + 316 327 static struct dbs_governor cs_governor = { 317 328 .gov = CPUFREQ_DBS_GOVERNOR_INITIALIZER("conservative"), 318 329 .kobj_type = { .default_groups = cs_groups }, ··· 333 322 .init = cs_init, 334 323 .exit = cs_exit, 335 324 .start = cs_start, 325 + .limits = cs_limits, 336 326 }; 337 327 338 328 #define CPU_FREQ_GOV_CONSERVATIVE (cs_governor.gov)
+3
drivers/cpufreq/cpufreq_governor.c
··· 563 563 564 564 void cpufreq_dbs_governor_limits(struct cpufreq_policy *policy) 565 565 { 566 + struct dbs_governor *gov = dbs_governor_of(policy); 566 567 struct policy_dbs_info *policy_dbs; 567 568 568 569 /* Protect gov->gdbs_data against cpufreq_dbs_governor_exit() */ ··· 575 574 mutex_lock(&policy_dbs->update_mutex); 576 575 cpufreq_policy_apply_limits(policy); 577 576 gov_update_sample_delay(policy_dbs, 0); 577 + if (gov->limits) 578 + gov->limits(policy); 578 579 mutex_unlock(&policy_dbs->update_mutex); 579 580 580 581 out:
+1
drivers/cpufreq/cpufreq_governor.h
··· 138 138 int (*init)(struct dbs_data *dbs_data); 139 139 void (*exit)(struct dbs_data *dbs_data); 140 140 void (*start)(struct cpufreq_policy *policy); 141 + void (*limits)(struct cpufreq_policy *policy); 141 142 }; 142 143 143 144 static inline struct dbs_governor *dbs_governor_of(struct cpufreq_policy *policy)
+4
drivers/cpufreq/freq_table.c
··· 360 360 if (policy_has_boost_freq(policy)) 361 361 policy->boost_supported = true; 362 362 363 + if (policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_ASCENDING || 364 + policy->freq_table_sorted == CPUFREQ_TABLE_SORTED_DESCENDING) 365 + return 0; 366 + 363 367 return set_freq_table_sorted(policy); 364 368 } 365 369
+1 -1
kernel/power/main.c
··· 40 40 { 41 41 WARN_ON(!mutex_is_locked(&system_transition_mutex)); 42 42 43 - if (WARN_ON(!saved_gfp_count) || --saved_gfp_count) 43 + if (!saved_gfp_count || --saved_gfp_count) 44 44 return; 45 45 46 46 gfp_allowed_mask = saved_gfp_mask;
+11
kernel/power/snapshot.c
··· 2855 2855 { 2856 2856 int error; 2857 2857 2858 + /* 2859 + * Call snapshot_write_next() to drain any trailing zero pages, 2860 + * but make sure we're in the data page region first. 2861 + * This function can return PAGE_SIZE if the kernel was expecting 2862 + * another copy page. Return -ENODATA in that situation. 2863 + */ 2864 + if (handle->cur > nr_meta_pages + 1) { 2865 + error = snapshot_write_next(handle); 2866 + if (error) 2867 + return error > 0 ? -ENODATA : error; 2868 + } 2858 2869 copy_last_highmem_page(); 2859 2870 error = hibernate_restore_protect_page(handle->buffer); 2860 2871 /* Do that only if we have loaded the image entirely */