tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

suspend to disk (was Re: CVS commit: src/sys/arch)



On Sat, Jun 27, 2009 at 07:51:54AM +0200, Christoph Egger wrote:
> David Young wrote:
> > Module Name:        src
> > Committed By:       dyoung
> > Date:               Fri Jun 26 23:40:27 UTC 2009
> > 
> > Modified Files:
> >     src/sys/arch/i386/i386: machdep.c
> >     src/sys/arch/sparc64/sparc64: machdep.c
> > 
> > Log Message:
> > During a normal shutdown, gracefully tear down arbitrary stacks of
> > filesystems and (pseudo-)devices, according to the algorithm at A3
> > and A4, below.
> > 
> > Proposed and discussed at
> > <http://mail-index.netbsd.org/tech-kern/2009/04/20/msg004864.html>.  No
> > objections.
> > 
> > During an emergency shutdown (e.g., shutdown -n, or after a panic),
> > shutdown is simple as always: filesystems are not sync'd or unmounted,
> > and devices are not detached.
> > 
> > It was necessary to change the order of operations during shutdown,
> > but the new order is more sensible: if a core dump is desired, then
> > cpu_reboot(9) dumps it first.  cpu_reboot(9) does not call legacy
> > shutdown hooks any longer: they can interfere with device detachment
> > and PMF shutdown, and very few legacy hooks remain.
> > 
> > Here is the old order of operations:
> > 
> > B1 sync filesystems and TOD clock
> > B2 unmount filesystems
> > B3 dump core
> > B4 detach devices
> > B5 run legacy shutdown hooks
> > B6 run PMF shutdown hooks
> > B7 suspend interrupts
> > B8 MD reboot/shutdown/powerdown
> > 
> > And here is the new order:
> > 
> > A1 dump core
> > A2 sync filesystems and TOD clock
> > A3 unmount one or more filesystems OR
> >    detach one or more devices OR
> >    forcefully unmount one filesystem OR
> >    skip to 5
> > A4 repeat at 3
> > A5 run PMF shutdown hooks
> > A6 suspend interrupts
> > A7 MD reboot/shutdown/powerdown
> > 
> > Tested on Dell Dimension 3000, Dell PowerEdge 1950, Sun Fire V120,
> > Soekris net4521 and net4801.
> > 
> > VS: ----------------------------------------------------------------------
> 
> Will the new order allow Suspend-to-disk (ACPI S4) ?

That's an interesting problem, but it is not within the scope of
problems that I am trying to solve right now.

At the VERY least, I think that suspend-to-disk would require something
like this:

SD1 disconnect file descriptors from their underlying drivers and
    filesystem objects (or SOMETHING)
SD2 sync filesystems and TOD clock
SD3 unmount one or more filesystems OR
    detach one or more devices OR
    forcefully unmount one filesystem OR
    skip to 5
SD4 repeat at 3
SD5 suspend and page out all user processes
SD5 dump the kernel
SD6 mark the kernel core & swap, "this is a suspended NetBSD instance".
SD6 suspend interrupts
SD7 MD reboot/shutdown/powerdown

Dave

-- 
David Young             OJC Technologies
dyoung%ojctech.com@localhost      Urbana, IL * (217) 278-3933


Home | Main Index | Thread Index | Old Index