From: david@lang.hm Subject: Re: Hibernation considerations Date: Tue, 17 Jul 2007 14:27:14 -0700 (PDT) Message-ID: References: <200707172217.01890.rjw@sisk.pl> <200707172323.51702.rjw@sisk.pl> <871wf6g1q1.fsf@jbms.ath.cx> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Return-path: In-Reply-To: <871wf6g1q1.fsf@jbms.ath.cx> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org To: Jeremy Maitin-Shepard Cc: LKML , Kyle Moffett , Al Boldi , "Eric W. Biederman" , Pavel Machek , "Huang, Ying" , Andrew Morton , pm list List-Id: linux-pm@vger.kernel.org On Tue, 17 Jul 2007, Jeremy Maitin-Shepard wrote: > david@lang.hm writes: > > [snip] > >>> How do you guarantee that no tasks are scheduled when you get back to the >>> hibernated kernel? > >> just don't schedule any userspace tasks. all you need to do is to execute the >> ACPI sleep functions. you normally do that after stopping userspace >> anyway. > > What does "stopping userspace" mean? You already said it does not mean > disabling interrupts. But using the freezer is also not an option, > since the avoidance of that is the main reason for the kexec approach in > the first place. just don't schedule any non-kernel threads. remember that the normal shutdown/suspend procedure is (from another related thread) > >>sys_reboot(LINUX_REBOOT_CMD_KEXEC) > >> kernel_kexec > >> kernel_restart_prepare > >> device_shutdown > >> machine_shutdown > >> machine_kexec I'm just saying that instead of going back to the normal operation of the kernel you just go directly to the new shutdown routine instead. > [snip] > >>> Well, not exactly. If your battery runs out of power while you're suspended, >>> but you have the image saved, it's still better to restore from the image, >> even >>> if something may not work correctly after the restore, than to risk a loss of >>> data. > >> if things don't work correctly you are still risking the loss of data, the user >> just doesn't know it. > > It should be possible on any system to do a hibernate followed by a > shutdown (and then resume properly, without any problems). Thus, for > handling suspend to both, you resume as if the system had been shutdown, > rather than resuming as if the system came from S4. I agree with this, but according to Rafael if the "hibernated" image is assuming that the devices were put into low-power mode by ACPI and you boot up instead the system doesn't work right. David Lang