Re: Memory image save/restore

From: Paulo Marques
Date: Tue Apr 13 2004 - 14:29:15 EST


Chris Lalancette wrote:

Paulo,
Thanks for responding. You are right in that the state of memory isn't the state of the entire machine; however, for instance, the swsusp2 project can save the contents of memory out to disk, go to sleep, and then resume to it later. Basically, what I am trying to do is something like swsusp2, with less restrictions; I know I have another region the size of physical memory to work with, I know I am executing from an interrupt handler, and at the end I don't want to go to sleep, just continue on. Then I might want to use that memory image later.


That is not *all* the swsusp2 project does. Probably the biggest challenge in the software suspend project is to get all the devices to acknowledge that they are being "suspended" and to have them resume properly.

Just as an example, imagine that the usb host controller is currently dispatching an urb to a device. The kernel in-memory structures reflect this occurrence. The kernel is ready for the interrupt the controller will generate to update these structures.

You now interrupt, and save the memory contents. You let everything proceed, and after a while try to recover the previous memory contents.

Now the kernel is expecting the interrupt from the controller, regarding an urb that the controller has dispatched a long time ago. The state of the controller and the kernel in-memory structures is out of sync.

This is just a small example. I could think of this sort of examples for disk reads/writes and IDE/SCSI controllers, accelerated graphics adapters, etc., etc. Even much simpler examples, like keyboard state (a scancode was just received to press a key, and the corresponding release is lost), internal timer/clock, etc. will cause you problems just the same.

However, I'm not an expert in this area. Maybe someone like Nigel Cunningham or Pavel Machek can explain better the problems that arise from trying to save the complete *state* of the system. I just wrote this to try to save these guys the trouble, since they can occupy their time better in developing the damn thing :)

--
Paulo Marques - www.grupopie.com
"In a world without walls and fences who needs windows and gates?"

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/