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

Merge tag 'pm-6.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
"These address system suspend failures under memory pressure in some
configurations, fix up RAPL handling on platforms where PL1 cannot be
disabled, and fix a documentation typo:

- Prevent the Intel RAPL power capping driver from allowing PL1 to be
exceeded by mistake on systems when PL1 cannot be disabled (Zhang
Rui)

- Fix a typo in the ABI documentation (Sumanth Gavini)

- Allow swap to be used a bit longer during system suspend and
hibernation to avoid suspend failures under memory pressure (Mario
Limonciello)"

* tag 'pm-6.16-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
PM: sleep: docs: Replace "diasble" with "disable"
powercap: intel_rapl: Do not change CLAMPING bit if ENABLE bit cannot be changed
PM: Restrict swap use to later in the suspend sequence

+29 -13
+1 -1
Documentation/ABI/testing/sysfs-devices-power
··· 56 56 Contact: Rafael J. Wysocki <rjw@rjwysocki.net> 57 57 Description: 58 58 The /sys/devices/.../async attribute allows the user space to 59 - enable or diasble the device's suspend and resume callbacks to 59 + enable or disable the device's suspend and resume callbacks to 60 60 be executed asynchronously (ie. in separate threads, in parallel 61 61 with the main suspend/resume thread) during system-wide power 62 62 transitions (eg. suspend to RAM, hibernation).
+4 -1
drivers/base/power/main.c
··· 1236 1236 */ 1237 1237 void dpm_resume_end(pm_message_t state) 1238 1238 { 1239 + pm_restore_gfp_mask(); 1239 1240 dpm_resume(state); 1240 1241 dpm_complete(state); 1241 1242 } ··· 2177 2176 error = dpm_prepare(state); 2178 2177 if (error) 2179 2178 dpm_save_failed_step(SUSPEND_PREPARE); 2180 - else 2179 + else { 2180 + pm_restrict_gfp_mask(); 2181 2181 error = dpm_suspend(state); 2182 + } 2182 2183 2183 2184 dpm_show_time(starttime, state, error, "start"); 2184 2185 return error;
+17 -1
drivers/powercap/intel_rapl_common.c
··· 341 341 { 342 342 struct rapl_domain *rd = power_zone_to_rapl_domain(power_zone); 343 343 struct rapl_defaults *defaults = get_defaults(rd->rp); 344 + u64 val; 344 345 int ret; 345 346 346 347 cpus_read_lock(); 347 348 ret = rapl_write_pl_data(rd, POWER_LIMIT1, PL_ENABLE, mode); 348 - if (!ret && defaults->set_floor_freq) 349 + if (ret) 350 + goto end; 351 + 352 + ret = rapl_read_pl_data(rd, POWER_LIMIT1, PL_ENABLE, false, &val); 353 + if (ret) 354 + goto end; 355 + 356 + if (mode != val) { 357 + pr_debug("%s cannot be %s\n", power_zone->name, 358 + str_enabled_disabled(mode)); 359 + goto end; 360 + } 361 + 362 + if (defaults->set_floor_freq) 349 363 defaults->set_floor_freq(rd, mode); 364 + 365 + end: 350 366 cpus_read_unlock(); 351 367 352 368 return ret;
+5
include/linux/suspend.h
··· 446 446 extern void ksys_sync_helper(void); 447 447 extern void pm_report_hw_sleep_time(u64 t); 448 448 extern void pm_report_max_hw_sleep(u64 t); 449 + void pm_restrict_gfp_mask(void); 450 + void pm_restore_gfp_mask(void); 449 451 450 452 #define pm_notifier(fn, pri) { \ 451 453 static struct notifier_block fn##_nb = \ ··· 493 491 494 492 static inline void pm_report_hw_sleep_time(u64 t) {}; 495 493 static inline void pm_report_max_hw_sleep(u64 t) {}; 494 + 495 + static inline void pm_restrict_gfp_mask(void) {} 496 + static inline void pm_restore_gfp_mask(void) {} 496 497 497 498 static inline void ksys_sync_helper(void) {} 498 499
+1
kernel/kexec_core.c
··· 1136 1136 Resume_devices: 1137 1137 dpm_resume_end(PMSG_RESTORE); 1138 1138 Resume_console: 1139 + pm_restore_gfp_mask(); 1139 1140 console_resume_all(); 1140 1141 thaw_processes(); 1141 1142 Restore_console:
-3
kernel/power/hibernate.c
··· 423 423 } 424 424 425 425 console_suspend_all(); 426 - pm_restrict_gfp_mask(); 427 426 428 427 error = dpm_suspend(PMSG_FREEZE); 429 428 ··· 558 559 559 560 pm_prepare_console(); 560 561 console_suspend_all(); 561 - pm_restrict_gfp_mask(); 562 562 error = dpm_suspend_start(PMSG_QUIESCE); 563 563 if (!error) { 564 564 error = resume_target_kernel(platform_mode); ··· 569 571 BUG_ON(!error); 570 572 } 571 573 dpm_resume_end(PMSG_RECOVER); 572 - pm_restore_gfp_mask(); 573 574 console_resume_all(); 574 575 pm_restore_console(); 575 576 return error;
-5
kernel/power/power.h
··· 239 239 /* kernel/power/main.c */ 240 240 extern int pm_notifier_call_chain_robust(unsigned long val_up, unsigned long val_down); 241 241 extern int pm_notifier_call_chain(unsigned long val); 242 - void pm_restrict_gfp_mask(void); 243 - void pm_restore_gfp_mask(void); 244 - #else 245 - static inline void pm_restrict_gfp_mask(void) {} 246 - static inline void pm_restore_gfp_mask(void) {} 247 242 #endif 248 243 249 244 #ifdef CONFIG_HIGHMEM
+1 -2
kernel/power/suspend.c
··· 540 540 return error; 541 541 542 542 Recover_platform: 543 + pm_restore_gfp_mask(); 543 544 platform_recover(state); 544 545 goto Resume_devices; 545 546 } ··· 607 606 608 607 trace_suspend_resume(TPS("suspend_enter"), state, false); 609 608 pm_pr_dbg("Suspending system (%s)\n", mem_sleep_labels[state]); 610 - pm_restrict_gfp_mask(); 611 609 error = suspend_devices_and_enter(state); 612 - pm_restore_gfp_mask(); 613 610 614 611 Finish: 615 612 events_check_enabled = false;