Am Donnerstag, 23. September 2004 21:56 schrieb Alan Stern:
> On Thu, 23 Sep 2004, Oliver Neukum wrote:
> 
> > Swsusp goes through a sync - suspend - resume - write image - suspend
> > cycle to bring down the machine. There's a certain logic to that because
> > after a reboot all devices will be running.
> 
> Can you give me a pointer to the swsusp code?
> 
> Also, why the first suspend?  Why not sync - resume - write image - 
> suspend?  After all, any devices that get suspended there will wake up 
> immediately during the resume step.

Ok. The meat of swsusp is in kernel/power::swsusp.c.
The call trace of the core is: (comments are mine)
free_some_memory(); // this would require anything that is in the page out path to be 
active
device_suspend(3) // this causes device state to be saved in ram
        device_power_down(3); // as above, for those that need interrupts off
        is_problem = suspend_prepare_image(); //the image is generated
        device_power_up(); // wake everything up
                suspend_save_image(); // write out the image at least swap device 
needs to be active
                suspend_power_down(); // kill all power

IMO the crucial part here is the placement of suspend_prepare_image().
It ensures that the system image that will be written is an image of all
devices powered down and all state (like IP assigned to a network interface)
is saved.
The resume will power down the devices again, unpack the image, and
restore all state. I see no reason the first call to device_suspend()
actually needs to do actually switch power levels. As far as I can tell,
the requirements are:
- no DMA
- no interrupts
- saved state
The trick is decoupling taking the image from writing it out.

> > This cannot make a difference. Consider that one of the lists may be
> > empty. I fail to see the logic. Please elaborate. You can have systems
> > where you can shut down nothing without shutting down the swap
> > device.
> 
> I _said_ that I don't fully grasp all the implications and requirements 
> here.

Neither do I >:-> 

[..]
> Now let's suppose we're doing the second suspend on your list, the actual 
> power-off suspend.  Since the memory image has already been written, 
> there's nothing wrong with shutting down the swap device.

Actually, it is a requirement.

        Regards
                Oliver


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to