lkml.org 
[lkml]   [2020]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] PM: hibernate: Freeze kernel threads in software_resume()
Date
> 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
\
 
 \ /
  Last update: 2020-04-27 02:58    [W:0.067 / U:2.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site