[linux-pm] Re: [PATCH] swsusp: do not use pm_ops (was: Re:
suspend2 merge (was: Re: CFS and suspend2: hang in atomic copy))
Alan Stern
stern at rowland.harvard.edu
Sun May 6 15:01:16 PDT 2007
On Sun, 6 May 2007, Rafael J. Wysocki wrote:
> > > I think we may need yet another callback, executed before pre_snapshot()
> > > and before we shrink memory during the hibernation, to be used by drivers
> > > that need a lot of additional memory in pre_snapshot().
> >
> > pre_snapshot_early()
>
> OK
I changed my mind -- pre_hibernate() seems like a better name. There
could be a matching post_hibernate(), if anyone finds it necessary. I
considered pre_freeze(), but that's not such a good choice since the
freezer can be used for other things in addition to hibernation.
> So, I think the hibernation code ordering should be like this (let's forget
> about ACPI for now):
>
> 1) tasks are frozen
> 2) pre_snapshot_early()
Or rather: 2) pre_hibernate()
> 3) memory is freed for the snapshot image
> 4) pre_snapshod()
> 5) nonboot CPUs are offlined
> 6) IRQs are disabled
> 7) pre_snapshot_late()
> 8) sysdev_pre_snapshot()
> 9) snapshot image is created
> 10) sysdev_post_snapshot()
> 11) post_snapshot_early()
> 12) IRQs are enabled
> 13) nonboot CPUs are enabled
> 14) post_snapshot()
> 15) snapshot image is saved
> 16) device_shutdown()
> 17) system is powered off
>
> Apart from this, we may need notifiers for subsystems that should do something
> before the freezing and after the thawing of tasks (like FUSE etc.).
Quite so.
> Also, if there's an error, we have to be able to thaw tasks after
> post_snapshot() and continue running.
>
> The restore code, IMO, should be like this (again, let's ignore ACPI for now):
>
> 1) boot kernel is started, initrd is loaded etc.
> 2) tasks are frozen
> 3) snapshot image is loaded
> 4) pre_restore()
> 5) nonboot CPUs are offlined
> 6) IRQs are disabled
> 7) pre_restore_late()
> 8) sysdev_pre_restore()
> 9) boot kernel is replaced with the 'hibernated' kernel
> 10) sysdev_post_restore()
> 11) post_restore_early()
> 12) IRQs are enabled
> 13) nonboot CPUs are enabled
> 14) post_restore()
> 15) tasks are thawed
> 16) system is running
>
> and we may need a notifier for subsystems that should do something after
> tasks have been thawed.
It sounds good to me. Now if only it were possible to get rid of those
pesky sysdevs...
Alan Stern
More information about the linux-pm
mailing list