Subject: Re: MI APM support
To: None <firstname.lastname@example.org>
From: Matt Thomas <email@example.com>
Date: 08/12/1999 08:12:12
At 02:10 PM 8/11/99 , Christoph Badura wrote:
>firstname.lastname@example.org (Matt Thomas) writes:
> >For the Tadpole, it's a fairly good fit. The only thing that doesn't
> >fit is Standby mode. But it can be simulated. The hardest part will
> >be implementing suspend (since the kernel needs to write the contents
> >of physical memory to partition e (almost like a crash dump)).
>Why don't you just reserve some memory in the swap area for the kernel
>data structures and swap all the processes out? Seems to me, that could
>be mostly MI.
Now that's an interesting idea. I was thinking of something entirely
different. I'm thinking of something in the more traditional powerfail
support. Not exactly APM. There would be levels to this. For systems
with battery backup (some large VAX systems allowed memory to be hooked
to batteries for instance), basically all that need to done is to save
the hardware context (CPU regs, internal and normal) and wait for power
to go away. For systems without battery-backup for memory, write the
contents of memory to disk, then the CPU state, and power down or wait
When power is restored, the bootloader looks in a reserved area in
memory for a power-state-block (it will have a certain checksum) and
if present jumps to an entry point in the power-state-block to bring
the system back up (aka resume).
Otherwise, the bootloader reads the first block off the swap partition
to see if it contains a power-state-block. If so, the bootloader will
restore the memory from disk using info in the power-state-block. Then
it will jump to an entry point to bring the system back up.
Since the writing of physical memory is what the crash-dump code does,
it seems natural to extend that code to handle the saving of memory to
disk. But you really don't to save all of memory but only those pages
that save significant data. Also, you want do things like flush all
buffers to disk, drain any mbufs and return any free pages in the mbuf
pools to free memory, turn off or disable devices (so they can free
resources). Once that has been, you want to write active pages with
no backing-store (ie. in memory text pages don't need to be written
nor other data pages that have backing in swap) to disk (but not for
crash dumps since you really all the pages).
The hard part is that since you are using the kernel to do this writing
you can't get an exact copy of the kernel since it is changing (bufs
and/or mbufs). So it would seem that you would want a small pool of
memory to use for the mem-writing structures so you could just skip
them. Either that or have code in power-restore code to cleanup the
There also needs to be a way to override this. (on the sparcbook
one checks to see if the openboot variable no-resume? exists).
But most of this code is MI except for the saving of the CPU state.
(probably need to design this with multiple-CPU systems in mind as
savecore would need to be taught about compressed dumps and then
write a sparse core file.
Matt Thomas Internet: email@example.com
3am Software Foundry WWW URL: http://www.3am-software.com/bio/matt/
Cupertino, CA Disclaimer: I avow all knowledge of this message