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

PM: sleep: Print PM debug messages during hibernation

Commit cdb8c100d8a4 ("include/linux/suspend.h: Only show pm_pr_dbg
messages at suspend/resume") caused PM debug messages to only be
printed during system-wide suspend and resume in progress, but it
forgot about hibernation.

Address this by adding a check for hibernation in progress to
pm_debug_messages_should_print().

Fixes: cdb8c100d8a4 ("include/linux/suspend.h: Only show pm_pr_dbg messages at suspend/resume")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://patch.msgid.link/4998903.GXAFRqVoOG@rjwysocki.net

+11 -1
+5
kernel/power/hibernate.c
··· 90 90 atomic_inc(&hibernate_atomic); 91 91 } 92 92 93 + bool hibernation_in_progress(void) 94 + { 95 + return !atomic_read(&hibernate_atomic); 96 + } 97 + 93 98 bool hibernation_available(void) 94 99 { 95 100 return nohibernate == 0 &&
+2 -1
kernel/power/main.c
··· 613 613 614 614 bool pm_debug_messages_should_print(void) 615 615 { 616 - return pm_debug_messages_on && pm_suspend_target_state != PM_SUSPEND_ON; 616 + return pm_debug_messages_on && (hibernation_in_progress() || 617 + pm_suspend_target_state != PM_SUSPEND_ON); 617 618 } 618 619 EXPORT_SYMBOL_GPL(pm_debug_messages_should_print); 619 620
+4
kernel/power/power.h
··· 71 71 static inline void enable_restore_image_protection(void) {} 72 72 #endif /* CONFIG_STRICT_KERNEL_RWX */ 73 73 74 + extern bool hibernation_in_progress(void); 75 + 74 76 #else /* !CONFIG_HIBERNATION */ 75 77 76 78 static inline void hibernate_reserved_size_init(void) {} 77 79 static inline void hibernate_image_size_init(void) {} 80 + 81 + static inline bool hibernation_in_progress(void) { return false; } 78 82 #endif /* !CONFIG_HIBERNATION */ 79 83 80 84 #define power_attr(_name) \