From: Bart Van Assche bvanassche@acm.org Sent: Sunday, April 26, 2020 11:34 AM To: Rafael J. Wysocki rjw@rjwysocki.net; Dexuan Cui decui@microsoft.com
--- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c @@ -898,6 +898,13 @@ static int software_resume(void) error = freeze_processes(); if (error) goto Close_Finish;
- error = freeze_kernel_threads();
- if (error) {
thaw_processes();
goto Close_Finish;
- }
- error = load_image_and_restore(); thaw_processes(); Finish:
Applied as a fix for 5.7-rc4, thanks!
Hi Rafael,
What is not clear to me is how kernel threads are thawed after load_image_and_restore() has finished? Should a comment perhaps be added above the freeze_kernel_threads() call that explains how thaw_kernel_threads() is invoked after load_image_and_restore() has finished?
Bart.
Hi Bart, Rafael, I would suggest the below comment:
If load_image_and_restore() succeeds, it won't return, and the execution will be restored from the 'old' kernel's hibernate() -> hibernation_snapshot() -> create_image() -> swsusp_arch_suspend(), and later hibernate() -> thaw_processes() will thaw every frozen kernel process and userspace process of the 'old' kernel.
Thanks, -- Dexuan