I had looked into this all before, but lost the link to the project. I just found it again:
http://swsusp.sourceforge.net/
The "Software Suspend" project, as they call it, handles exactly what we're talking about, except that it occurs in the resident OS. This means that they save only process memory and not kernel memory states. They also recommend for some peripheral drivers, that one install them as modules and unload them before saving state. They do, however, compress the memory image and have the option of saving it in swap space.
So, in answer to your question, it may be possible to unload drivers before saving state, then reload them upon restore. However, this could present some difficulty if the module is in use by a process (e.g. vga driver w/ xwindows) or in use by other modules. This is something that would need to be addressed. If you have to shutdown X just to save state, and start X again after restoring state, this wouldn't be nearly as useful.
I guess there are a few options: Try it without re-initializing (for many, this will work, but not all.) Unload/load modules (good for non-critical modules) Figure out way to read/write state to peripheral (messy, many proprietary implementations)
One more question. To do this effectively we'll need a hook into running a BIOS process from inside the OS (trigger to save state and shutdown.) How difficult is this to do?
--Kevin
P.S. I've just subscribed to the swsusp-devel list. I'll be asking questions in there too.
From Antony Stone Antony@Soft-Solutions.co.uk on 10 May 2004:
On Friday 14 May 2004 4:36 pm, lbios_kk@redfenix.com wrote:
I'm not necessarily talking about handling a suspend or low-power
mode.
I'm talking about copying the memory to disk, then powering off.
Then,
upon power-on next time, reload the memory state, re-init peripherals
and
go!
I can't help feeling that it's a bit simplistic to just say "re-init peripherals" like that. Some peripherals can have quite a complex state associated with them, and just re-initialising them as though you were starting from power-up may not make the O/S happy when it finds itself back in control after the hibernation is over?
There has to be some O/S involvement in going into, and returning from, hibernation mode - the question for LinuxBIOS is "how much of a task is left over once you take out what the Linux kernel can already do for itself?"
Regards,
Antony.
-- Microsoft may sell more software than any other company, but McDonald's sell more burgers than any other company, and I think the other similarities are obvious...
Please reply to the
list; please don't CC me.
Linuxbios mailing list Linuxbios@clustermatic.org http://www.clustermatic.org/mailman/listinfo/linuxbios