All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] why do we need run disk sync before entering S3
@ 2009-05-13  1:20 Zhang Rui
  2009-05-13  2:01 ` [linux-pm] " Alan Stern
  2009-05-13  2:01 ` Alan Stern
  0 siblings, 2 replies; 43+ messages in thread
From: Zhang Rui @ 2009-05-13  1:20 UTC (permalink / raw)
  To: linux-pm, linux-acpi; +Cc: Rafael J. Wysocki, Len Brown

Hi, all,

I did some S3 tests on an eeepc901, the total suspend time(from issue
the suspend command to power down) is about 2.5s~3s.
something interesting is that kernel runs disk sync before entering S3
state, and this takes about 0.7~1.2s.
my question is that, why do we need this for s2ram?
can we remove this and run sys_sync for S4 only?

thanks,
rui


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-13  1:20 [RFC] why do we need run disk sync before entering S3 Zhang Rui
@ 2009-05-13  2:01 ` Alan Stern
  2009-05-13  8:03   ` Rafael J. Wysocki
  2009-05-13  8:03   ` Rafael J. Wysocki
  2009-05-13  2:01 ` Alan Stern
  1 sibling, 2 replies; 43+ messages in thread
From: Alan Stern @ 2009-05-13  2:01 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-pm, linux-acpi

On Wed, 13 May 2009, Zhang Rui wrote:

> Hi, all,
> 
> I did some S3 tests on an eeepc901, the total suspend time(from issue
> the suspend command to power down) is about 2.5s~3s.
> something interesting is that kernel runs disk sync before entering S3
> state, and this takes about 0.7~1.2s.
> my question is that, why do we need this for s2ram?
> can we remove this and run sys_sync for S4 only?

At the risk of sounding foolish, I'd guess that a system in S3 (or more
generally, suspend-to-RAM) is a lot more at risk of losing power or
failing to restore than a normally running system.  (A normally running
system is trivially not at risk of failing to restore!)  Consequently
it makes sense to flush the I/O buffers before entering this state, to
minimize the potential for loss of data.

When you think about it, a system in S4 is actually _less_ likely to 
run into trouble than one in S3, since it can't fail because of loss of 
power.  So if anything, we should remove the disk sync from hibernation 
and leave it in system suspend.

Alan Stern


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-13  1:20 [RFC] why do we need run disk sync before entering S3 Zhang Rui
  2009-05-13  2:01 ` [linux-pm] " Alan Stern
@ 2009-05-13  2:01 ` Alan Stern
  1 sibling, 0 replies; 43+ messages in thread
From: Alan Stern @ 2009-05-13  2:01 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-acpi, linux-pm

On Wed, 13 May 2009, Zhang Rui wrote:

> Hi, all,
> 
> I did some S3 tests on an eeepc901, the total suspend time(from issue
> the suspend command to power down) is about 2.5s~3s.
> something interesting is that kernel runs disk sync before entering S3
> state, and this takes about 0.7~1.2s.
> my question is that, why do we need this for s2ram?
> can we remove this and run sys_sync for S4 only?

At the risk of sounding foolish, I'd guess that a system in S3 (or more
generally, suspend-to-RAM) is a lot more at risk of losing power or
failing to restore than a normally running system.  (A normally running
system is trivially not at risk of failing to restore!)  Consequently
it makes sense to flush the I/O buffers before entering this state, to
minimize the potential for loss of data.

When you think about it, a system in S4 is actually _less_ likely to 
run into trouble than one in S3, since it can't fail because of loss of 
power.  So if anything, we should remove the disk sync from hibernation 
and leave it in system suspend.

Alan Stern

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-13  2:01 ` [linux-pm] " Alan Stern
@ 2009-05-13  8:03   ` Rafael J. Wysocki
  2009-05-13  8:45     ` Pavel Machek
                       ` (2 more replies)
  2009-05-13  8:03   ` Rafael J. Wysocki
  1 sibling, 3 replies; 43+ messages in thread
From: Rafael J. Wysocki @ 2009-05-13  8:03 UTC (permalink / raw)
  To: Alan Stern; +Cc: linux-pm, Zhang Rui, linux-acpi, Len Brown, Pavel Machek

On Wednesday 13 May 2009, Alan Stern wrote:
> On Wed, 13 May 2009, Zhang Rui wrote:
> 
> > Hi, all,
> > 
> > I did some S3 tests on an eeepc901, the total suspend time(from issue
> > the suspend command to power down) is about 2.5s~3s.
> > something interesting is that kernel runs disk sync before entering S3
> > state, and this takes about 0.7~1.2s.
> > my question is that, why do we need this for s2ram?
> > can we remove this and run sys_sync for S4 only?
> 
> At the risk of sounding foolish, I'd guess that a system in S3 (or more
> generally, suspend-to-RAM) is a lot more at risk of losing power or
> failing to restore than a normally running system.  (A normally running
> system is trivially not at risk of failing to restore!)  Consequently
> it makes sense to flush the I/O buffers before entering this state, to
> minimize the potential for loss of data.
> 
> When you think about it, a system in S4 is actually _less_ likely to 
> run into trouble than one in S3, since it can't fail because of loss of 
> power.  So if anything, we should remove the disk sync from hibernation 
> and leave it in system suspend.

I generally agree, but I think we may also leave the syncing to the user space,
in both cases.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-13  2:01 ` [linux-pm] " Alan Stern
  2009-05-13  8:03   ` Rafael J. Wysocki
@ 2009-05-13  8:03   ` Rafael J. Wysocki
  1 sibling, 0 replies; 43+ messages in thread
From: Rafael J. Wysocki @ 2009-05-13  8:03 UTC (permalink / raw)
  To: Alan Stern; +Cc: linux-acpi, linux-pm

On Wednesday 13 May 2009, Alan Stern wrote:
> On Wed, 13 May 2009, Zhang Rui wrote:
> 
> > Hi, all,
> > 
> > I did some S3 tests on an eeepc901, the total suspend time(from issue
> > the suspend command to power down) is about 2.5s~3s.
> > something interesting is that kernel runs disk sync before entering S3
> > state, and this takes about 0.7~1.2s.
> > my question is that, why do we need this for s2ram?
> > can we remove this and run sys_sync for S4 only?
> 
> At the risk of sounding foolish, I'd guess that a system in S3 (or more
> generally, suspend-to-RAM) is a lot more at risk of losing power or
> failing to restore than a normally running system.  (A normally running
> system is trivially not at risk of failing to restore!)  Consequently
> it makes sense to flush the I/O buffers before entering this state, to
> minimize the potential for loss of data.
> 
> When you think about it, a system in S4 is actually _less_ likely to 
> run into trouble than one in S3, since it can't fail because of loss of 
> power.  So if anything, we should remove the disk sync from hibernation 
> and leave it in system suspend.

I generally agree, but I think we may also leave the syncing to the user space,
in both cases.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-13  8:03   ` Rafael J. Wysocki
@ 2009-05-13  8:45     ` Pavel Machek
  2009-05-13  8:53       ` Rafael J. Wysocki
  2009-05-13  8:53       ` Rafael J. Wysocki
  2009-05-13  8:45     ` Pavel Machek
  2009-05-19  1:03     ` Nigel Cunningham
  2 siblings, 2 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-13  8:45 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Alan Stern, linux-pm, Zhang Rui, linux-acpi, Len Brown

On Wed 2009-05-13 10:03:14, Rafael J. Wysocki wrote:
> On Wednesday 13 May 2009, Alan Stern wrote:
> > On Wed, 13 May 2009, Zhang Rui wrote:
> > 
> > > Hi, all,
> > > 
> > > I did some S3 tests on an eeepc901, the total suspend time(from issue
> > > the suspend command to power down) is about 2.5s~3s.
> > > something interesting is that kernel runs disk sync before entering S3
> > > state, and this takes about 0.7~1.2s.
> > > my question is that, why do we need this for s2ram?
> > > can we remove this and run sys_sync for S4 only?
> > 
> > At the risk of sounding foolish, I'd guess that a system in S3 (or more
> > generally, suspend-to-RAM) is a lot more at risk of losing power or
> > failing to restore than a normally running system.  (A normally running
> > system is trivially not at risk of failing to restore!)  Consequently
> > it makes sense to flush the I/O buffers before entering this state, to
> > minimize the potential for loss of data.
> > 
> > When you think about it, a system in S4 is actually _less_ likely to 
> > run into trouble than one in S3, since it can't fail because of loss of 
> > power.  So if anything, we should remove the disk sync from hibernation 
> > and leave it in system suspend.
> 
> I generally agree, but I think we may also leave the syncing to the user space,
> in both cases.

Well...

Normally kernel writes dirty data to disk each 30
seconds. s2ram/s2disk breaks that promise, so it seems fair to add
explicit sync to keep the "promise".

OTOH, I agree it would be more flexible if we left sync to
userspace. In uswsusp case, it actually makes sense. In s2ram
case... if we can do it while keeping compatibility with old
behaviour... why not.
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-13  8:03   ` Rafael J. Wysocki
  2009-05-13  8:45     ` Pavel Machek
@ 2009-05-13  8:45     ` Pavel Machek
  2009-05-19  1:03     ` Nigel Cunningham
  2 siblings, 0 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-13  8:45 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, linux-pm

On Wed 2009-05-13 10:03:14, Rafael J. Wysocki wrote:
> On Wednesday 13 May 2009, Alan Stern wrote:
> > On Wed, 13 May 2009, Zhang Rui wrote:
> > 
> > > Hi, all,
> > > 
> > > I did some S3 tests on an eeepc901, the total suspend time(from issue
> > > the suspend command to power down) is about 2.5s~3s.
> > > something interesting is that kernel runs disk sync before entering S3
> > > state, and this takes about 0.7~1.2s.
> > > my question is that, why do we need this for s2ram?
> > > can we remove this and run sys_sync for S4 only?
> > 
> > At the risk of sounding foolish, I'd guess that a system in S3 (or more
> > generally, suspend-to-RAM) is a lot more at risk of losing power or
> > failing to restore than a normally running system.  (A normally running
> > system is trivially not at risk of failing to restore!)  Consequently
> > it makes sense to flush the I/O buffers before entering this state, to
> > minimize the potential for loss of data.
> > 
> > When you think about it, a system in S4 is actually _less_ likely to 
> > run into trouble than one in S3, since it can't fail because of loss of 
> > power.  So if anything, we should remove the disk sync from hibernation 
> > and leave it in system suspend.
> 
> I generally agree, but I think we may also leave the syncing to the user space,
> in both cases.

Well...

Normally kernel writes dirty data to disk each 30
seconds. s2ram/s2disk breaks that promise, so it seems fair to add
explicit sync to keep the "promise".

OTOH, I agree it would be more flexible if we left sync to
userspace. In uswsusp case, it actually makes sense. In s2ram
case... if we can do it while keeping compatibility with old
behaviour... why not.
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-13  8:45     ` Pavel Machek
@ 2009-05-13  8:53       ` Rafael J. Wysocki
  2009-05-13  8:57         ` Pavel Machek
                           ` (3 more replies)
  2009-05-13  8:53       ` Rafael J. Wysocki
  1 sibling, 4 replies; 43+ messages in thread
From: Rafael J. Wysocki @ 2009-05-13  8:53 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Alan Stern, linux-pm, Zhang Rui, linux-acpi, Len Brown

On Wednesday 13 May 2009, Pavel Machek wrote:
> On Wed 2009-05-13 10:03:14, Rafael J. Wysocki wrote:
> > On Wednesday 13 May 2009, Alan Stern wrote:
> > > On Wed, 13 May 2009, Zhang Rui wrote:
> > > 
> > > > Hi, all,
> > > > 
> > > > I did some S3 tests on an eeepc901, the total suspend time(from issue
> > > > the suspend command to power down) is about 2.5s~3s.
> > > > something interesting is that kernel runs disk sync before entering S3
> > > > state, and this takes about 0.7~1.2s.
> > > > my question is that, why do we need this for s2ram?
> > > > can we remove this and run sys_sync for S4 only?
> > > 
> > > At the risk of sounding foolish, I'd guess that a system in S3 (or more
> > > generally, suspend-to-RAM) is a lot more at risk of losing power or
> > > failing to restore than a normally running system.  (A normally running
> > > system is trivially not at risk of failing to restore!)  Consequently
> > > it makes sense to flush the I/O buffers before entering this state, to
> > > minimize the potential for loss of data.
> > > 
> > > When you think about it, a system in S4 is actually _less_ likely to 
> > > run into trouble than one in S3, since it can't fail because of loss of 
> > > power.  So if anything, we should remove the disk sync from hibernation 
> > > and leave it in system suspend.
> > 
> > I generally agree, but I think we may also leave the syncing to the user space,
> > in both cases.
> 
> Well...
> 
> Normally kernel writes dirty data to disk each 30
> seconds. s2ram/s2disk breaks that promise, so it seems fair to add
> explicit sync to keep the "promise".
> 
> OTOH, I agree it would be more flexible if we left sync to
> userspace. In uswsusp case, it actually makes sense. In s2ram
> case... if we can do it while keeping compatibility with old
> behaviour... why not.

That really depends on the distrubution.  (open)SUSE always syncs before
suspend/hibernation AFAICS, but I don't know about the other distros.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-13  8:45     ` Pavel Machek
  2009-05-13  8:53       ` Rafael J. Wysocki
@ 2009-05-13  8:53       ` Rafael J. Wysocki
  1 sibling, 0 replies; 43+ messages in thread
From: Rafael J. Wysocki @ 2009-05-13  8:53 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-acpi, linux-pm

On Wednesday 13 May 2009, Pavel Machek wrote:
> On Wed 2009-05-13 10:03:14, Rafael J. Wysocki wrote:
> > On Wednesday 13 May 2009, Alan Stern wrote:
> > > On Wed, 13 May 2009, Zhang Rui wrote:
> > > 
> > > > Hi, all,
> > > > 
> > > > I did some S3 tests on an eeepc901, the total suspend time(from issue
> > > > the suspend command to power down) is about 2.5s~3s.
> > > > something interesting is that kernel runs disk sync before entering S3
> > > > state, and this takes about 0.7~1.2s.
> > > > my question is that, why do we need this for s2ram?
> > > > can we remove this and run sys_sync for S4 only?
> > > 
> > > At the risk of sounding foolish, I'd guess that a system in S3 (or more
> > > generally, suspend-to-RAM) is a lot more at risk of losing power or
> > > failing to restore than a normally running system.  (A normally running
> > > system is trivially not at risk of failing to restore!)  Consequently
> > > it makes sense to flush the I/O buffers before entering this state, to
> > > minimize the potential for loss of data.
> > > 
> > > When you think about it, a system in S4 is actually _less_ likely to 
> > > run into trouble than one in S3, since it can't fail because of loss of 
> > > power.  So if anything, we should remove the disk sync from hibernation 
> > > and leave it in system suspend.
> > 
> > I generally agree, but I think we may also leave the syncing to the user space,
> > in both cases.
> 
> Well...
> 
> Normally kernel writes dirty data to disk each 30
> seconds. s2ram/s2disk breaks that promise, so it seems fair to add
> explicit sync to keep the "promise".
> 
> OTOH, I agree it would be more flexible if we left sync to
> userspace. In uswsusp case, it actually makes sense. In s2ram
> case... if we can do it while keeping compatibility with old
> behaviour... why not.

That really depends on the distrubution.  (open)SUSE always syncs before
suspend/hibernation AFAICS, but I don't know about the other distros.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-13  8:53       ` Rafael J. Wysocki
@ 2009-05-13  8:57         ` Pavel Machek
  2009-05-13  8:57         ` Pavel Machek
                           ` (2 subsequent siblings)
  3 siblings, 0 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-13  8:57 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Alan Stern, linux-pm, Zhang Rui, linux-acpi, Len Brown


> > > > > I did some S3 tests on an eeepc901, the total suspend time(from issue
> > > > > the suspend command to power down) is about 2.5s~3s.
> > > > > something interesting is that kernel runs disk sync before entering S3
> > > > > state, and this takes about 0.7~1.2s.
> > > > > my question is that, why do we need this for s2ram?
> > > > > can we remove this and run sys_sync for S4 only?
> > > > 
> > > > At the risk of sounding foolish, I'd guess that a system in S3 (or more
> > > > generally, suspend-to-RAM) is a lot more at risk of losing power or
> > > > failing to restore than a normally running system.  (A normally running
> > > > system is trivially not at risk of failing to restore!)  Consequently
> > > > it makes sense to flush the I/O buffers before entering this state, to
> > > > minimize the potential for loss of data.
> > > > 
> > > > When you think about it, a system in S4 is actually _less_ likely to 
> > > > run into trouble than one in S3, since it can't fail because of loss of 
> > > > power.  So if anything, we should remove the disk sync from hibernation 
> > > > and leave it in system suspend.
> > > 
> > > I generally agree, but I think we may also leave the syncing to the user space,
> > > in both cases.
> > 
> > Well...
> > 
> > Normally kernel writes dirty data to disk each 30
> > seconds. s2ram/s2disk breaks that promise, so it seems fair to add
> > explicit sync to keep the "promise".
> > 
> > OTOH, I agree it would be more flexible if we left sync to
> > userspace. In uswsusp case, it actually makes sense. In s2ram
> > case... if we can do it while keeping compatibility with old
> > behaviour... why not.
> 
> That really depends on the distrubution.  (open)SUSE always syncs before
> suspend/hibernation AFAICS, but I don't know about the other distros.

At least I ran into habit of running "echo mem > /sys/power/state"
manually on zaurus. I guess nontrivial ammount of people have custom
scripts that may or may not sync...

Anyway, if distro already ran sync, additional one is likely to be
very fast.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-13  8:53       ` Rafael J. Wysocki
  2009-05-13  8:57         ` Pavel Machek
@ 2009-05-13  8:57         ` Pavel Machek
  2009-05-13 14:06         ` [linux-pm] " Alan Stern
  2009-05-13 14:06         ` Alan Stern
  3 siblings, 0 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-13  8:57 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, linux-pm


> > > > > I did some S3 tests on an eeepc901, the total suspend time(from issue
> > > > > the suspend command to power down) is about 2.5s~3s.
> > > > > something interesting is that kernel runs disk sync before entering S3
> > > > > state, and this takes about 0.7~1.2s.
> > > > > my question is that, why do we need this for s2ram?
> > > > > can we remove this and run sys_sync for S4 only?
> > > > 
> > > > At the risk of sounding foolish, I'd guess that a system in S3 (or more
> > > > generally, suspend-to-RAM) is a lot more at risk of losing power or
> > > > failing to restore than a normally running system.  (A normally running
> > > > system is trivially not at risk of failing to restore!)  Consequently
> > > > it makes sense to flush the I/O buffers before entering this state, to
> > > > minimize the potential for loss of data.
> > > > 
> > > > When you think about it, a system in S4 is actually _less_ likely to 
> > > > run into trouble than one in S3, since it can't fail because of loss of 
> > > > power.  So if anything, we should remove the disk sync from hibernation 
> > > > and leave it in system suspend.
> > > 
> > > I generally agree, but I think we may also leave the syncing to the user space,
> > > in both cases.
> > 
> > Well...
> > 
> > Normally kernel writes dirty data to disk each 30
> > seconds. s2ram/s2disk breaks that promise, so it seems fair to add
> > explicit sync to keep the "promise".
> > 
> > OTOH, I agree it would be more flexible if we left sync to
> > userspace. In uswsusp case, it actually makes sense. In s2ram
> > case... if we can do it while keeping compatibility with old
> > behaviour... why not.
> 
> That really depends on the distrubution.  (open)SUSE always syncs before
> suspend/hibernation AFAICS, but I don't know about the other distros.

At least I ran into habit of running "echo mem > /sys/power/state"
manually on zaurus. I guess nontrivial ammount of people have custom
scripts that may or may not sync...

Anyway, if distro already ran sync, additional one is likely to be
very fast.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-13  8:53       ` Rafael J. Wysocki
  2009-05-13  8:57         ` Pavel Machek
  2009-05-13  8:57         ` Pavel Machek
@ 2009-05-13 14:06         ` Alan Stern
  2009-05-13 14:16           ` Rafael J. Wysocki
  2009-05-13 14:16           ` [linux-pm] " Rafael J. Wysocki
  2009-05-13 14:06         ` Alan Stern
  3 siblings, 2 replies; 43+ messages in thread
From: Alan Stern @ 2009-05-13 14:06 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Pavel Machek, linux-pm, Zhang Rui, linux-acpi, Len Brown

On Wed, 13 May 2009, Rafael J. Wysocki wrote:

> > > I generally agree, but I think we may also leave the syncing to the user space,
> > > in both cases.
> > 
> > Well...
> > 
> > Normally kernel writes dirty data to disk each 30
> > seconds. s2ram/s2disk breaks that promise, so it seems fair to add
> > explicit sync to keep the "promise".
> > 
> > OTOH, I agree it would be more flexible if we left sync to
> > userspace. In uswsusp case, it actually makes sense. In s2ram
> > case... if we can do it while keeping compatibility with old
> > behaviour... why not.
> 
> That really depends on the distrubution.  (open)SUSE always syncs before
> suspend/hibernation AFAICS, but I don't know about the other distros.

This doesn't address the real question: Should the system be allowed to 
go into S3 without doing a sync first?

Whether the sync is initiated by userspace or by the kernel doesn't 
make any difference.  Likewise, it doesn't matter if there are two 
syncs (because the second will be very fast, as Pavel said).

If you really wanted to speed up the suspend transition then you would
leave out the sync entirely.  But IMO this would be a mistake; the risk
of data loss is too great.  Which means the time overhead is necessary,
one way or another.  If userspace does a sync first then the suspend
transition will be faster, but this is just an accounting artifact (do
you count the time required for the sync toward the time required for
the suspend or not).

Alan Stern


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-13  8:53       ` Rafael J. Wysocki
                           ` (2 preceding siblings ...)
  2009-05-13 14:06         ` [linux-pm] " Alan Stern
@ 2009-05-13 14:06         ` Alan Stern
  3 siblings, 0 replies; 43+ messages in thread
From: Alan Stern @ 2009-05-13 14:06 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, linux-pm

On Wed, 13 May 2009, Rafael J. Wysocki wrote:

> > > I generally agree, but I think we may also leave the syncing to the user space,
> > > in both cases.
> > 
> > Well...
> > 
> > Normally kernel writes dirty data to disk each 30
> > seconds. s2ram/s2disk breaks that promise, so it seems fair to add
> > explicit sync to keep the "promise".
> > 
> > OTOH, I agree it would be more flexible if we left sync to
> > userspace. In uswsusp case, it actually makes sense. In s2ram
> > case... if we can do it while keeping compatibility with old
> > behaviour... why not.
> 
> That really depends on the distrubution.  (open)SUSE always syncs before
> suspend/hibernation AFAICS, but I don't know about the other distros.

This doesn't address the real question: Should the system be allowed to 
go into S3 without doing a sync first?

Whether the sync is initiated by userspace or by the kernel doesn't 
make any difference.  Likewise, it doesn't matter if there are two 
syncs (because the second will be very fast, as Pavel said).

If you really wanted to speed up the suspend transition then you would
leave out the sync entirely.  But IMO this would be a mistake; the risk
of data loss is too great.  Which means the time overhead is necessary,
one way or another.  If userspace does a sync first then the suspend
transition will be faster, but this is just an accounting artifact (do
you count the time required for the sync toward the time required for
the suspend or not).

Alan Stern

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-13 14:06         ` [linux-pm] " Alan Stern
  2009-05-13 14:16           ` Rafael J. Wysocki
@ 2009-05-13 14:16           ` Rafael J. Wysocki
  2009-05-14  9:42             ` Pavel Machek
  2009-05-14  9:42             ` [linux-pm] " Pavel Machek
  1 sibling, 2 replies; 43+ messages in thread
From: Rafael J. Wysocki @ 2009-05-13 14:16 UTC (permalink / raw)
  To: Alan Stern; +Cc: Pavel Machek, linux-pm, Zhang Rui, linux-acpi, Len Brown

On Wednesday 13 May 2009, Alan Stern wrote:
> On Wed, 13 May 2009, Rafael J. Wysocki wrote:
> 
> > > > I generally agree, but I think we may also leave the syncing to the user space,
> > > > in both cases.
> > > 
> > > Well...
> > > 
> > > Normally kernel writes dirty data to disk each 30
> > > seconds. s2ram/s2disk breaks that promise, so it seems fair to add
> > > explicit sync to keep the "promise".
> > > 
> > > OTOH, I agree it would be more flexible if we left sync to
> > > userspace. In uswsusp case, it actually makes sense. In s2ram
> > > case... if we can do it while keeping compatibility with old
> > > behaviour... why not.
> > 
> > That really depends on the distrubution.  (open)SUSE always syncs before
> > suspend/hibernation AFAICS, but I don't know about the other distros.
> 
> This doesn't address the real question: Should the system be allowed to 
> go into S3 without doing a sync first?
> 
> Whether the sync is initiated by userspace or by the kernel doesn't 
> make any difference.  Likewise, it doesn't matter if there are two 
> syncs (because the second will be very fast, as Pavel said).
> 
> If you really wanted to speed up the suspend transition then you would
> leave out the sync entirely.  But IMO this would be a mistake; the risk
> of data loss is too great.  Which means the time overhead is necessary,
> one way or another.  If userspace does a sync first then the suspend
> transition will be faster, but this is just an accounting artifact (do
> you count the time required for the sync toward the time required for
> the suspend or not).

My point was in fact that if we left the syncing to the user space, then the
user would be able to decide not to sync risking data loss.  At the moment the
user has no choice. :-)

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-13 14:06         ` [linux-pm] " Alan Stern
@ 2009-05-13 14:16           ` Rafael J. Wysocki
  2009-05-13 14:16           ` [linux-pm] " Rafael J. Wysocki
  1 sibling, 0 replies; 43+ messages in thread
From: Rafael J. Wysocki @ 2009-05-13 14:16 UTC (permalink / raw)
  To: Alan Stern; +Cc: linux-acpi, linux-pm

On Wednesday 13 May 2009, Alan Stern wrote:
> On Wed, 13 May 2009, Rafael J. Wysocki wrote:
> 
> > > > I generally agree, but I think we may also leave the syncing to the user space,
> > > > in both cases.
> > > 
> > > Well...
> > > 
> > > Normally kernel writes dirty data to disk each 30
> > > seconds. s2ram/s2disk breaks that promise, so it seems fair to add
> > > explicit sync to keep the "promise".
> > > 
> > > OTOH, I agree it would be more flexible if we left sync to
> > > userspace. In uswsusp case, it actually makes sense. In s2ram
> > > case... if we can do it while keeping compatibility with old
> > > behaviour... why not.
> > 
> > That really depends on the distrubution.  (open)SUSE always syncs before
> > suspend/hibernation AFAICS, but I don't know about the other distros.
> 
> This doesn't address the real question: Should the system be allowed to 
> go into S3 without doing a sync first?
> 
> Whether the sync is initiated by userspace or by the kernel doesn't 
> make any difference.  Likewise, it doesn't matter if there are two 
> syncs (because the second will be very fast, as Pavel said).
> 
> If you really wanted to speed up the suspend transition then you would
> leave out the sync entirely.  But IMO this would be a mistake; the risk
> of data loss is too great.  Which means the time overhead is necessary,
> one way or another.  If userspace does a sync first then the suspend
> transition will be faster, but this is just an accounting artifact (do
> you count the time required for the sync toward the time required for
> the suspend or not).

My point was in fact that if we left the syncing to the user space, then the
user would be able to decide not to sync risking data loss.  At the moment the
user has no choice. :-)

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-13 14:16           ` [linux-pm] " Rafael J. Wysocki
  2009-05-14  9:42             ` Pavel Machek
@ 2009-05-14  9:42             ` Pavel Machek
  2009-05-15  1:00               ` Henrique de Moraes Holschuh
                                 ` (3 more replies)
  1 sibling, 4 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-14  9:42 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Alan Stern, linux-pm, Zhang Rui, linux-acpi, Len Brown


> > > That really depends on the distrubution.  (open)SUSE always syncs before
> > > suspend/hibernation AFAICS, but I don't know about the other distros.
> > 
> > This doesn't address the real question: Should the system be allowed to 
> > go into S3 without doing a sync first?
> > 
> > Whether the sync is initiated by userspace or by the kernel doesn't 
> > make any difference.  Likewise, it doesn't matter if there are two 
> > syncs (because the second will be very fast, as Pavel said).
> > 
> > If you really wanted to speed up the suspend transition then you would
> > leave out the sync entirely.  But IMO this would be a mistake; the risk
> > of data loss is too great.  Which means the time overhead is necessary,
> > one way or another.  If userspace does a sync first then the suspend
> > transition will be faster, but this is just an accounting artifact (do
> > you count the time required for the sync toward the time required for
> > the suspend or not).
> 
> My point was in fact that if we left the syncing to the user space, then the
> user would be able to decide not to sync risking data loss.  At the moment the
> user has no choice. :-)

Well, if you can add the choice, without adding anything ugly and with
staying back-compatible, why not. (sync has to stay by default). I
believe ioctls() on /dev/snapshot may already enable you to do s2ram
without sync; if not they could be extended.

But remember there are even in-kernel s2ram triggers, for example on
zaurus when battery goes critical.

(And s2ram without sync _is_ "wrong": writeback timeouts are not
honored).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-13 14:16           ` [linux-pm] " Rafael J. Wysocki
@ 2009-05-14  9:42             ` Pavel Machek
  2009-05-14  9:42             ` [linux-pm] " Pavel Machek
  1 sibling, 0 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-14  9:42 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, linux-pm


> > > That really depends on the distrubution.  (open)SUSE always syncs before
> > > suspend/hibernation AFAICS, but I don't know about the other distros.
> > 
> > This doesn't address the real question: Should the system be allowed to 
> > go into S3 without doing a sync first?
> > 
> > Whether the sync is initiated by userspace or by the kernel doesn't 
> > make any difference.  Likewise, it doesn't matter if there are two 
> > syncs (because the second will be very fast, as Pavel said).
> > 
> > If you really wanted to speed up the suspend transition then you would
> > leave out the sync entirely.  But IMO this would be a mistake; the risk
> > of data loss is too great.  Which means the time overhead is necessary,
> > one way or another.  If userspace does a sync first then the suspend
> > transition will be faster, but this is just an accounting artifact (do
> > you count the time required for the sync toward the time required for
> > the suspend or not).
> 
> My point was in fact that if we left the syncing to the user space, then the
> user would be able to decide not to sync risking data loss.  At the moment the
> user has no choice. :-)

Well, if you can add the choice, without adding anything ugly and with
staying back-compatible, why not. (sync has to stay by default). I
believe ioctls() on /dev/snapshot may already enable you to do s2ram
without sync; if not they could be extended.

But remember there are even in-kernel s2ram triggers, for example on
zaurus when battery goes critical.

(And s2ram without sync _is_ "wrong": writeback timeouts are not
honored).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-14  9:42             ` [linux-pm] " Pavel Machek
@ 2009-05-15  1:00               ` Henrique de Moraes Holschuh
  2009-05-15  9:08                 ` suspending machine from kernel (was Re: [linux-pm] [RFC] why do we need run disk sync before entering S3) Pavel Machek
  2009-05-15  9:08                 ` Pavel Machek
  2009-05-15  1:00               ` [RFC] why do we need run disk sync before entering S3 Henrique de Moraes Holschuh
                                 ` (2 subsequent siblings)
  3 siblings, 2 replies; 43+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-05-15  1:00 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Rafael J. Wysocki, Alan Stern, linux-pm, Zhang Rui, linux-acpi,
	Len Brown

On Thu, 14 May 2009, Pavel Machek wrote:
> But remember there are even in-kernel s2ram triggers, for example on
> zaurus when battery goes critical.

Are there?  I am quite interested on this!

Are they safe on x86?

thinkpad-acpi receives some critical alarms from the firmware, for which the
recommended action by the vendor is to go into S3 immediately.  There is
also one which requires S4 as the recommended damage control measure.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-14  9:42             ` [linux-pm] " Pavel Machek
  2009-05-15  1:00               ` Henrique de Moraes Holschuh
@ 2009-05-15  1:00               ` Henrique de Moraes Holschuh
  2009-05-15 14:36               ` [linux-pm] " Rafael J. Wysocki
  2009-05-15 14:36               ` [RFC] why do we need run disk sync before entering S3 Rafael J. Wysocki
  3 siblings, 0 replies; 43+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-05-15  1:00 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-acpi, linux-pm

On Thu, 14 May 2009, Pavel Machek wrote:
> But remember there are even in-kernel s2ram triggers, for example on
> zaurus when battery goes critical.

Are there?  I am quite interested on this!

Are they safe on x86?

thinkpad-acpi receives some critical alarms from the firmware, for which the
recommended action by the vendor is to go into S3 immediately.  There is
also one which requires S4 as the recommended damage control measure.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

^ permalink raw reply	[flat|nested] 43+ messages in thread

* suspending machine from kernel (was Re: [linux-pm] [RFC] why do we need run disk sync before entering S3)
  2009-05-15  1:00               ` Henrique de Moraes Holschuh
@ 2009-05-15  9:08                 ` Pavel Machek
  2009-05-15 21:15                   ` Henrique de Moraes Holschuh
  2009-05-15 21:15                   ` suspending machine from kernel (was " Henrique de Moraes Holschuh
  2009-05-15  9:08                 ` Pavel Machek
  1 sibling, 2 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-15  9:08 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh; +Cc: kernel list, linux-pm, linux-acpi

On Thu 2009-05-14 22:00:56, Henrique de Moraes Holschuh wrote:
> On Thu, 14 May 2009, Pavel Machek wrote:
> > But remember there are even in-kernel s2ram triggers, for example on
> > zaurus when battery goes critical.
> 
> Are there?  I am quite interested on this!

Yes.

It is a bit of mess, but see

common/sharpsl_pm.c:

   /* Suspend if critical battery level */
        if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
                        && (sharpsl_pm.battstat.mainbat_status ==
APM_BATTERY_STATUS_CRITICAL)
                        && !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) {
                sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
                dev_err(sharpsl_pm.dev, "Fatal Off\n");
                apm_queue_event(APM_CRITICAL_SUSPEND);
        }

it eventually triggers regular s2ram paths.

Older versions did suspend on power button press. (You can't really
turn zaurus _off_, AFAICT.)

> Are they safe on x86?

Well, probably safe but definitely would need some cleanup.

> thinkpad-acpi receives some critical alarms from the firmware, for which the
> recommended action by the vendor is to go into S3 immediately.  There is
> also one which requires S4 as the recommended damage control measure.

While s2ram should always work on hardware that supports it (zaurus),
S4 is more tricky. It needs swap to be configured, and userspace
cooperation in uswsusp case.

I guess sending signal to init would be right solution in that
case. (ACPI already does that on overheat.)

								Pavel
(Sorry about breaking Ccs)
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* suspending machine from kernel (was Re: [RFC] why do we need run disk sync before entering S3)
  2009-05-15  1:00               ` Henrique de Moraes Holschuh
  2009-05-15  9:08                 ` suspending machine from kernel (was Re: [linux-pm] [RFC] why do we need run disk sync before entering S3) Pavel Machek
@ 2009-05-15  9:08                 ` Pavel Machek
  1 sibling, 0 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-15  9:08 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh; +Cc: linux-acpi, linux-pm, kernel list

On Thu 2009-05-14 22:00:56, Henrique de Moraes Holschuh wrote:
> On Thu, 14 May 2009, Pavel Machek wrote:
> > But remember there are even in-kernel s2ram triggers, for example on
> > zaurus when battery goes critical.
> 
> Are there?  I am quite interested on this!

Yes.

It is a bit of mess, but see

common/sharpsl_pm.c:

   /* Suspend if critical battery level */
        if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
                        && (sharpsl_pm.battstat.mainbat_status ==
APM_BATTERY_STATUS_CRITICAL)
                        && !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) {
                sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
                dev_err(sharpsl_pm.dev, "Fatal Off\n");
                apm_queue_event(APM_CRITICAL_SUSPEND);
        }

it eventually triggers regular s2ram paths.

Older versions did suspend on power button press. (You can't really
turn zaurus _off_, AFAICT.)

> Are they safe on x86?

Well, probably safe but definitely would need some cleanup.

> thinkpad-acpi receives some critical alarms from the firmware, for which the
> recommended action by the vendor is to go into S3 immediately.  There is
> also one which requires S4 as the recommended damage control measure.

While s2ram should always work on hardware that supports it (zaurus),
S4 is more tricky. It needs swap to be configured, and userspace
cooperation in uswsusp case.

I guess sending signal to init would be right solution in that
case. (ACPI already does that on overheat.)

								Pavel
(Sorry about breaking Ccs)
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-14  9:42             ` [linux-pm] " Pavel Machek
  2009-05-15  1:00               ` Henrique de Moraes Holschuh
  2009-05-15  1:00               ` [RFC] why do we need run disk sync before entering S3 Henrique de Moraes Holschuh
@ 2009-05-15 14:36               ` Rafael J. Wysocki
  2009-05-18  7:25                 ` Zhang Rui
  2009-05-18  7:25                 ` [linux-pm] " Zhang Rui
  2009-05-15 14:36               ` [RFC] why do we need run disk sync before entering S3 Rafael J. Wysocki
  3 siblings, 2 replies; 43+ messages in thread
From: Rafael J. Wysocki @ 2009-05-15 14:36 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Alan Stern, linux-pm, Zhang Rui, linux-acpi, Len Brown

On Thursday 14 May 2009, Pavel Machek wrote:
> 
> > > > That really depends on the distrubution.  (open)SUSE always syncs before
> > > > suspend/hibernation AFAICS, but I don't know about the other distros.
> > > 
> > > This doesn't address the real question: Should the system be allowed to 
> > > go into S3 without doing a sync first?
> > > 
> > > Whether the sync is initiated by userspace or by the kernel doesn't 
> > > make any difference.  Likewise, it doesn't matter if there are two 
> > > syncs (because the second will be very fast, as Pavel said).
> > > 
> > > If you really wanted to speed up the suspend transition then you would
> > > leave out the sync entirely.  But IMO this would be a mistake; the risk
> > > of data loss is too great.  Which means the time overhead is necessary,
> > > one way or another.  If userspace does a sync first then the suspend
> > > transition will be faster, but this is just an accounting artifact (do
> > > you count the time required for the sync toward the time required for
> > > the suspend or not).
> > 
> > My point was in fact that if we left the syncing to the user space, then the
> > user would be able to decide not to sync risking data loss.  At the moment the
> > user has no choice. :-)
> 
> Well, if you can add the choice, without adding anything ugly and with
> staying back-compatible, why not. (sync has to stay by default). I
> believe ioctls() on /dev/snapshot may already enable you to do s2ram
> without sync; if not they could be extended.
> 
> But remember there are even in-kernel s2ram triggers, for example on
> zaurus when battery goes critical.
> 
> (And s2ram without sync _is_ "wrong": writeback timeouts are not
> honored).

OK, so I think the answer is we need the sync() as long as our filesystems
don't support suspend-resume directly.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-14  9:42             ` [linux-pm] " Pavel Machek
                                 ` (2 preceding siblings ...)
  2009-05-15 14:36               ` [linux-pm] " Rafael J. Wysocki
@ 2009-05-15 14:36               ` Rafael J. Wysocki
  3 siblings, 0 replies; 43+ messages in thread
From: Rafael J. Wysocki @ 2009-05-15 14:36 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-acpi, linux-pm

On Thursday 14 May 2009, Pavel Machek wrote:
> 
> > > > That really depends on the distrubution.  (open)SUSE always syncs before
> > > > suspend/hibernation AFAICS, but I don't know about the other distros.
> > > 
> > > This doesn't address the real question: Should the system be allowed to 
> > > go into S3 without doing a sync first?
> > > 
> > > Whether the sync is initiated by userspace or by the kernel doesn't 
> > > make any difference.  Likewise, it doesn't matter if there are two 
> > > syncs (because the second will be very fast, as Pavel said).
> > > 
> > > If you really wanted to speed up the suspend transition then you would
> > > leave out the sync entirely.  But IMO this would be a mistake; the risk
> > > of data loss is too great.  Which means the time overhead is necessary,
> > > one way or another.  If userspace does a sync first then the suspend
> > > transition will be faster, but this is just an accounting artifact (do
> > > you count the time required for the sync toward the time required for
> > > the suspend or not).
> > 
> > My point was in fact that if we left the syncing to the user space, then the
> > user would be able to decide not to sync risking data loss.  At the moment the
> > user has no choice. :-)
> 
> Well, if you can add the choice, without adding anything ugly and with
> staying back-compatible, why not. (sync has to stay by default). I
> believe ioctls() on /dev/snapshot may already enable you to do s2ram
> without sync; if not they could be extended.
> 
> But remember there are even in-kernel s2ram triggers, for example on
> zaurus when battery goes critical.
> 
> (And s2ram without sync _is_ "wrong": writeback timeouts are not
> honored).

OK, so I think the answer is we need the sync() as long as our filesystems
don't support suspend-resume directly.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: suspending machine from kernel (was Re: [linux-pm] [RFC] why do we need run disk sync before entering S3)
  2009-05-15  9:08                 ` suspending machine from kernel (was Re: [linux-pm] [RFC] why do we need run disk sync before entering S3) Pavel Machek
@ 2009-05-15 21:15                   ` Henrique de Moraes Holschuh
  2009-05-15 21:15                   ` suspending machine from kernel (was " Henrique de Moraes Holschuh
  1 sibling, 0 replies; 43+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-05-15 21:15 UTC (permalink / raw)
  To: Pavel Machek; +Cc: kernel list, linux-pm, linux-acpi

On Fri, 15 May 2009, Pavel Machek wrote:
> > thinkpad-acpi receives some critical alarms from the firmware, for which the
> > recommended action by the vendor is to go into S3 immediately.  There is
> > also one which requires S4 as the recommended damage control measure.
> 
> While s2ram should always work on hardware that supports it (zaurus),
> S4 is more tricky. It needs swap to be configured, and userspace
> cooperation in uswsusp case.

Yeah, this really calls for issuing some sort of event to userspace that has
the "emergency" connotation, so that desktop enviromnents don't start doing
retarted things like asking the user stupid questions when the machine has
30 seconds left of battery juice, or got waken up from S3 due to a
critically hot thermal alarm.

> I guess sending signal to init would be right solution in that
> case. (ACPI already does that on overheat.)

I will look into this.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: suspending machine from kernel (was Re: [RFC] why do we need run disk sync before entering S3)
  2009-05-15  9:08                 ` suspending machine from kernel (was Re: [linux-pm] [RFC] why do we need run disk sync before entering S3) Pavel Machek
  2009-05-15 21:15                   ` Henrique de Moraes Holschuh
@ 2009-05-15 21:15                   ` Henrique de Moraes Holschuh
  1 sibling, 0 replies; 43+ messages in thread
From: Henrique de Moraes Holschuh @ 2009-05-15 21:15 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-acpi, linux-pm, kernel list

On Fri, 15 May 2009, Pavel Machek wrote:
> > thinkpad-acpi receives some critical alarms from the firmware, for which the
> > recommended action by the vendor is to go into S3 immediately.  There is
> > also one which requires S4 as the recommended damage control measure.
> 
> While s2ram should always work on hardware that supports it (zaurus),
> S4 is more tricky. It needs swap to be configured, and userspace
> cooperation in uswsusp case.

Yeah, this really calls for issuing some sort of event to userspace that has
the "emergency" connotation, so that desktop enviromnents don't start doing
retarted things like asking the user stupid questions when the machine has
30 seconds left of battery juice, or got waken up from S3 due to a
critically hot thermal alarm.

> I guess sending signal to init would be right solution in that
> case. (ACPI already does that on overheat.)

I will look into this.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-15 14:36               ` [linux-pm] " Rafael J. Wysocki
  2009-05-18  7:25                 ` Zhang Rui
@ 2009-05-18  7:25                 ` Zhang Rui
  2009-05-22 15:33                   ` Pavel Machek
  2009-05-22 15:33                   ` [linux-pm] " Pavel Machek
  1 sibling, 2 replies; 43+ messages in thread
From: Zhang Rui @ 2009-05-18  7:25 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Pavel Machek, Alan Stern, linux-pm, linux-acpi, Len Brown

On Fri, 2009-05-15 at 22:36 +0800, Rafael J. Wysocki wrote:
> On Thursday 14 May 2009, Pavel Machek wrote:
> > 
> > > > > That really depends on the distrubution.  (open)SUSE always syncs before
> > > > > suspend/hibernation AFAICS, but I don't know about the other distros.
> > > > 
> > > > This doesn't address the real question: Should the system be allowed to 
> > > > go into S3 without doing a sync first?
> > > > 
> > > > Whether the sync is initiated by userspace or by the kernel doesn't 
> > > > make any difference.  Likewise, it doesn't matter if there are two 
> > > > syncs (because the second will be very fast, as Pavel said).
> > > > 
> > > > If you really wanted to speed up the suspend transition then you would
> > > > leave out the sync entirely.  But IMO this would be a mistake; the risk
> > > > of data loss is too great.  Which means the time overhead is necessary,
> > > > one way or another.  If userspace does a sync first then the suspend
> > > > transition will be faster, but this is just an accounting artifact (do
> > > > you count the time required for the sync toward the time required for
> > > > the suspend or not).
> > > 
> > > My point was in fact that if we left the syncing to the user space, then the
> > > user would be able to decide not to sync risking data loss.  At the moment the
> > > user has no choice. :-)
> > 
agree, and this is the purpose of my original post.

> > Well, if you can add the choice, without adding anything ugly and with
> > staying back-compatible, why not. (sync has to stay by default). I
> > believe ioctls() on /dev/snapshot may already enable you to do s2ram
> > without sync; if not they could be extended.
> > 
> > But remember there are even in-kernel s2ram triggers, for example on
> > zaurus when battery goes critical.
> > 

Take ACPI for example, ACPI defines two ACPI battery states, one is
"low" and another is "critical".
OS enters S3/S4 when battery is low, while it performs an emergency
shutdown when battery is in critical state. (ACPI spec 3.0b 3.9.4)
So I'm wondering if it's right to enter S3 when we know that the system
may lost power at anytime.

> > (And s2ram without sync _is_ "wrong": writeback timeouts are not
> > honored).
> 
any kind of suspend can't meet this requirement. Even sys_sync is
called, there is a small window that some pages are dirtied, but are not
synced to disk in max expire interval, right?

thanks,
rui

> OK, so I think the answer is we need the sync() as long as our filesystems
> don't support suspend-resume directly.
> 
> Thanks,
> Rafael


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-15 14:36               ` [linux-pm] " Rafael J. Wysocki
@ 2009-05-18  7:25                 ` Zhang Rui
  2009-05-18  7:25                 ` [linux-pm] " Zhang Rui
  1 sibling, 0 replies; 43+ messages in thread
From: Zhang Rui @ 2009-05-18  7:25 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, linux-pm

On Fri, 2009-05-15 at 22:36 +0800, Rafael J. Wysocki wrote:
> On Thursday 14 May 2009, Pavel Machek wrote:
> > 
> > > > > That really depends on the distrubution.  (open)SUSE always syncs before
> > > > > suspend/hibernation AFAICS, but I don't know about the other distros.
> > > > 
> > > > This doesn't address the real question: Should the system be allowed to 
> > > > go into S3 without doing a sync first?
> > > > 
> > > > Whether the sync is initiated by userspace or by the kernel doesn't 
> > > > make any difference.  Likewise, it doesn't matter if there are two 
> > > > syncs (because the second will be very fast, as Pavel said).
> > > > 
> > > > If you really wanted to speed up the suspend transition then you would
> > > > leave out the sync entirely.  But IMO this would be a mistake; the risk
> > > > of data loss is too great.  Which means the time overhead is necessary,
> > > > one way or another.  If userspace does a sync first then the suspend
> > > > transition will be faster, but this is just an accounting artifact (do
> > > > you count the time required for the sync toward the time required for
> > > > the suspend or not).
> > > 
> > > My point was in fact that if we left the syncing to the user space, then the
> > > user would be able to decide not to sync risking data loss.  At the moment the
> > > user has no choice. :-)
> > 
agree, and this is the purpose of my original post.

> > Well, if you can add the choice, without adding anything ugly and with
> > staying back-compatible, why not. (sync has to stay by default). I
> > believe ioctls() on /dev/snapshot may already enable you to do s2ram
> > without sync; if not they could be extended.
> > 
> > But remember there are even in-kernel s2ram triggers, for example on
> > zaurus when battery goes critical.
> > 

Take ACPI for example, ACPI defines two ACPI battery states, one is
"low" and another is "critical".
OS enters S3/S4 when battery is low, while it performs an emergency
shutdown when battery is in critical state. (ACPI spec 3.0b 3.9.4)
So I'm wondering if it's right to enter S3 when we know that the system
may lost power at anytime.

> > (And s2ram without sync _is_ "wrong": writeback timeouts are not
> > honored).
> 
any kind of suspend can't meet this requirement. Even sys_sync is
called, there is a small window that some pages are dirtied, but are not
synced to disk in max expire interval, right?

thanks,
rui

> OK, so I think the answer is we need the sync() as long as our filesystems
> don't support suspend-resume directly.
> 
> Thanks,
> Rafael

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-13  8:03   ` Rafael J. Wysocki
  2009-05-13  8:45     ` Pavel Machek
  2009-05-13  8:45     ` Pavel Machek
@ 2009-05-19  1:03     ` Nigel Cunningham
  2 siblings, 0 replies; 43+ messages in thread
From: Nigel Cunningham @ 2009-05-19  1:03 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, linux-pm

Hi.

On Wed, 2009-05-13 at 10:03 +0200, Rafael J. Wysocki wrote:
> On Wednesday 13 May 2009, Alan Stern wrote:
> > On Wed, 13 May 2009, Zhang Rui wrote:
> > 
> > > Hi, all,
> > > 
> > > I did some S3 tests on an eeepc901, the total suspend time(from issue
> > > the suspend command to power down) is about 2.5s~3s.
> > > something interesting is that kernel runs disk sync before entering S3
> > > state, and this takes about 0.7~1.2s.
> > > my question is that, why do we need this for s2ram?
> > > can we remove this and run sys_sync for S4 only?
> > 
> > At the risk of sounding foolish, I'd guess that a system in S3 (or more
> > generally, suspend-to-RAM) is a lot more at risk of losing power or
> > failing to restore than a normally running system.  (A normally running
> > system is trivially not at risk of failing to restore!)  Consequently
> > it makes sense to flush the I/O buffers before entering this state, to
> > minimize the potential for loss of data.
> > 
> > When you think about it, a system in S4 is actually _less_ likely to 
> > run into trouble than one in S3, since it can't fail because of loss of 
> > power.  So if anything, we should remove the disk sync from hibernation 
> > and leave it in system suspend.
> 
> I generally agree, but I think we may also leave the syncing to the user space,
> in both cases.

Sorry for coming into this discussion late - I was unavailable most of
last week.

Another point to remember is that syncing from userspace will not be
guaranteed to stop data loss. To be sure that all of userspace's writes
are synced, we need to do the syncing after userspace has stopped
submitting the writes, which implies after userspace has been frozen.

Regards,

Nigel

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-18  7:25                 ` [linux-pm] " Zhang Rui
  2009-05-22 15:33                   ` Pavel Machek
@ 2009-05-22 15:33                   ` Pavel Machek
  2009-05-23  7:59                     ` Oliver Neukum
  2009-05-23  7:59                     ` [linux-pm] " Oliver Neukum
  1 sibling, 2 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-22 15:33 UTC (permalink / raw)
  To: Zhang Rui; +Cc: Rafael J. Wysocki, Alan Stern, linux-pm, linux-acpi, Len Brown

Hi!

> > > But remember there are even in-kernel s2ram triggers, for example on
> > > zaurus when battery goes critical.
> > > 
> 
> Take ACPI for example, ACPI defines two ACPI battery states, one is
> "low" and another is "critical".
> OS enters S3/S4 when battery is low, while it performs an emergency
> shutdown when battery is in critical state. (ACPI spec 3.0b 3.9.4)
> So I'm wondering if it's right to enter S3 when we know that the system
> may lost power at anytime.

Well, battery only lasts like 30 hours in S3. So if you leave your
notebook unattended for 30 hours, you'll loose recent changes.

> > > (And s2ram without sync _is_ "wrong": writeback timeouts are not
> > > honored).

> any kind of suspend can't meet this requirement. Even sys_sync is
> called, there is a small window that some pages are dirtied, but are not
> synced to disk in max expire interval, right?

Not if you do sys_sync() after freeze of userspace. (I'm not 100% sure
there's no race in there somewhere, but I'd prefer not to make the
race bigger.)
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-18  7:25                 ` [linux-pm] " Zhang Rui
@ 2009-05-22 15:33                   ` Pavel Machek
  2009-05-22 15:33                   ` [linux-pm] " Pavel Machek
  1 sibling, 0 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-22 15:33 UTC (permalink / raw)
  To: Zhang Rui; +Cc: linux-acpi, linux-pm

Hi!

> > > But remember there are even in-kernel s2ram triggers, for example on
> > > zaurus when battery goes critical.
> > > 
> 
> Take ACPI for example, ACPI defines two ACPI battery states, one is
> "low" and another is "critical".
> OS enters S3/S4 when battery is low, while it performs an emergency
> shutdown when battery is in critical state. (ACPI spec 3.0b 3.9.4)
> So I'm wondering if it's right to enter S3 when we know that the system
> may lost power at anytime.

Well, battery only lasts like 30 hours in S3. So if you leave your
notebook unattended for 30 hours, you'll loose recent changes.

> > > (And s2ram without sync _is_ "wrong": writeback timeouts are not
> > > honored).

> any kind of suspend can't meet this requirement. Even sys_sync is
> called, there is a small window that some pages are dirtied, but are not
> synced to disk in max expire interval, right?

Not if you do sys_sync() after freeze of userspace. (I'm not 100% sure
there's no race in there somewhere, but I'd prefer not to make the
race bigger.)
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering S3
  2009-05-22 15:33                   ` [linux-pm] " Pavel Machek
  2009-05-23  7:59                     ` Oliver Neukum
@ 2009-05-23  7:59                     ` Oliver Neukum
  2009-05-23  8:50                       ` [linux-pm] [RFC] why do we need run disk sync before entering?S3 Pavel Machek
  2009-05-23  8:50                       ` Pavel Machek
  1 sibling, 2 replies; 43+ messages in thread
From: Oliver Neukum @ 2009-05-23  7:59 UTC (permalink / raw)
  To: linux-pm; +Cc: Pavel Machek, Zhang Rui, linux-acpi

Am Freitag, 22. Mai 2009 17:33:57 schrieb Pavel Machek:
> > Take ACPI for example, ACPI defines two ACPI battery states, one is
> > "low" and another is "critical".
> > OS enters S3/S4 when battery is low, while it performs an emergency
> > shutdown when battery is in critical state. (ACPI spec 3.0b 3.9.4)
> > So I'm wondering if it's right to enter S3 when we know that the system
> > may lost power at anytime.
>
> Well, battery only lasts like 30 hours in S3. So if you leave your
> notebook unattended for 30 hours, you'll loose recent changes.

Even if the battery is very low you get 30 hours?

	Regards
		Oliver


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-22 15:33                   ` [linux-pm] " Pavel Machek
@ 2009-05-23  7:59                     ` Oliver Neukum
  2009-05-23  7:59                     ` [linux-pm] " Oliver Neukum
  1 sibling, 0 replies; 43+ messages in thread
From: Oliver Neukum @ 2009-05-23  7:59 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-acpi

Am Freitag, 22. Mai 2009 17:33:57 schrieb Pavel Machek:
> > Take ACPI for example, ACPI defines two ACPI battery states, one is
> > "low" and another is "critical".
> > OS enters S3/S4 when battery is low, while it performs an emergency
> > shutdown when battery is in critical state. (ACPI spec 3.0b 3.9.4)
> > So I'm wondering if it's right to enter S3 when we know that the system
> > may lost power at anytime.
>
> Well, battery only lasts like 30 hours in S3. So if you leave your
> notebook unattended for 30 hours, you'll loose recent changes.

Even if the battery is very low you get 30 hours?

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering?S3
  2009-05-23  7:59                     ` [linux-pm] " Oliver Neukum
@ 2009-05-23  8:50                       ` Pavel Machek
  2009-05-23  9:05                         ` Oliver Neukum
  2009-05-23  9:05                         ` Oliver Neukum
  2009-05-23  8:50                       ` Pavel Machek
  1 sibling, 2 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-23  8:50 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-pm, Zhang Rui, linux-acpi

On Sat 2009-05-23 09:59:22, Oliver Neukum wrote:
> Am Freitag, 22. Mai 2009 17:33:57 schrieb Pavel Machek:
> > > Take ACPI for example, ACPI defines two ACPI battery states, one is
> > > "low" and another is "critical".
> > > OS enters S3/S4 when battery is low, while it performs an emergency
> > > shutdown when battery is in critical state. (ACPI spec 3.0b 3.9.4)
> > > So I'm wondering if it's right to enter S3 when we know that the system
> > > may lost power at anytime.
> >
> > Well, battery only lasts like 30 hours in S3. So if you leave your
> > notebook unattended for 30 hours, you'll loose recent changes.
> 
> Even if the battery is very low you get 30 hours?

That will of course be less. 30 hours is really best case, on "good"
notebook.

What I was trying to point out is that even if you go into s3 with
machine fully charged, you'll loose your data after like 30 hours.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering?S3
  2009-05-23  7:59                     ` [linux-pm] " Oliver Neukum
  2009-05-23  8:50                       ` [linux-pm] [RFC] why do we need run disk sync before entering?S3 Pavel Machek
@ 2009-05-23  8:50                       ` Pavel Machek
  1 sibling, 0 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-23  8:50 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-acpi, linux-pm

On Sat 2009-05-23 09:59:22, Oliver Neukum wrote:
> Am Freitag, 22. Mai 2009 17:33:57 schrieb Pavel Machek:
> > > Take ACPI for example, ACPI defines two ACPI battery states, one is
> > > "low" and another is "critical".
> > > OS enters S3/S4 when battery is low, while it performs an emergency
> > > shutdown when battery is in critical state. (ACPI spec 3.0b 3.9.4)
> > > So I'm wondering if it's right to enter S3 when we know that the system
> > > may lost power at anytime.
> >
> > Well, battery only lasts like 30 hours in S3. So if you leave your
> > notebook unattended for 30 hours, you'll loose recent changes.
> 
> Even if the battery is very low you get 30 hours?

That will of course be less. 30 hours is really best case, on "good"
notebook.

What I was trying to point out is that even if you go into s3 with
machine fully charged, you'll loose your data after like 30 hours.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering?S3
  2009-05-23  8:50                       ` [linux-pm] [RFC] why do we need run disk sync before entering?S3 Pavel Machek
@ 2009-05-23  9:05                         ` Oliver Neukum
  2009-05-23  9:45                           ` Pavel Machek
  2009-05-23  9:45                           ` Pavel Machek
  2009-05-23  9:05                         ` Oliver Neukum
  1 sibling, 2 replies; 43+ messages in thread
From: Oliver Neukum @ 2009-05-23  9:05 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-pm, Zhang Rui, linux-acpi

Am Samstag, 23. Mai 2009 10:50:18 schrieb Pavel Machek:
> On Sat 2009-05-23 09:59:22, Oliver Neukum wrote:
> > Am Freitag, 22. Mai 2009 17:33:57 schrieb Pavel Machek:
> > > > Take ACPI for example, ACPI defines two ACPI battery states, one is
> > > > "low" and another is "critical".
> > > > OS enters S3/S4 when battery is low, while it performs an emergency
> > > > shutdown when battery is in critical state. (ACPI spec 3.0b 3.9.4)
> > > > So I'm wondering if it's right to enter S3 when we know that the
> > > > system may lost power at anytime.
> > >
> > > Well, battery only lasts like 30 hours in S3. So if you leave your
> > > notebook unattended for 30 hours, you'll loose recent changes.
> >
> > Even if the battery is very low you get 30 hours?
>
> That will of course be less. 30 hours is really best case, on "good"
> notebook.
>
> What I was trying to point out is that even if you go into s3 with
> machine fully charged, you'll loose your data after like 30 hours.
> 									Pavel

Hi,

OK, I see so this was an argument for syncing. Sorry for misunderstanding.
But we'd still loose RAM. Which makes me wonder whether S3 and STD
really need to be mutually exclusive. Couldn't we write a snapshot to disk
just in case. All it would take is the STR code to mark the snapshot invalid
before any alteration of the filesystems.

	Regards
		Oliver



^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering?S3
  2009-05-23  8:50                       ` [linux-pm] [RFC] why do we need run disk sync before entering?S3 Pavel Machek
  2009-05-23  9:05                         ` Oliver Neukum
@ 2009-05-23  9:05                         ` Oliver Neukum
  1 sibling, 0 replies; 43+ messages in thread
From: Oliver Neukum @ 2009-05-23  9:05 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-acpi, linux-pm

Am Samstag, 23. Mai 2009 10:50:18 schrieb Pavel Machek:
> On Sat 2009-05-23 09:59:22, Oliver Neukum wrote:
> > Am Freitag, 22. Mai 2009 17:33:57 schrieb Pavel Machek:
> > > > Take ACPI for example, ACPI defines two ACPI battery states, one is
> > > > "low" and another is "critical".
> > > > OS enters S3/S4 when battery is low, while it performs an emergency
> > > > shutdown when battery is in critical state. (ACPI spec 3.0b 3.9.4)
> > > > So I'm wondering if it's right to enter S3 when we know that the
> > > > system may lost power at anytime.
> > >
> > > Well, battery only lasts like 30 hours in S3. So if you leave your
> > > notebook unattended for 30 hours, you'll loose recent changes.
> >
> > Even if the battery is very low you get 30 hours?
>
> That will of course be less. 30 hours is really best case, on "good"
> notebook.
>
> What I was trying to point out is that even if you go into s3 with
> machine fully charged, you'll loose your data after like 30 hours.
> 									Pavel

Hi,

OK, I see so this was an argument for syncing. Sorry for misunderstanding.
But we'd still loose RAM. Which makes me wonder whether S3 and STD
really need to be mutually exclusive. Couldn't we write a snapshot to disk
just in case. All it would take is the STR code to mark the snapshot invalid
before any alteration of the filesystems.

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering?S3
  2009-05-23  9:05                         ` Oliver Neukum
@ 2009-05-23  9:45                           ` Pavel Machek
  2009-05-24 21:02                             ` Oliver Neukum
  2009-05-24 21:02                             ` Oliver Neukum
  2009-05-23  9:45                           ` Pavel Machek
  1 sibling, 2 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-23  9:45 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-pm, Zhang Rui, linux-acpi

Hi!

> > That will of course be less. 30 hours is really best case, on "good"
> > notebook.
> >
> > What I was trying to point out is that even if you go into s3 with
> > machine fully charged, you'll loose your data after like 30 hours.
> 
> OK, I see so this was an argument for syncing. Sorry for
> misunderstanding.

Yes; we need to sync.

> But we'd still loose RAM. Which makes me wonder whether S3 and STD
> really need to be mutually exclusive. Couldn't we write a snapshot to disk
> just in case. All it would take is the STR code to mark the snapshot invalid
> before any alteration of the filesystems.

suspend.sf.net, program s2both :-).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering?S3
  2009-05-23  9:05                         ` Oliver Neukum
  2009-05-23  9:45                           ` Pavel Machek
@ 2009-05-23  9:45                           ` Pavel Machek
  1 sibling, 0 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-23  9:45 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-acpi, linux-pm

Hi!

> > That will of course be less. 30 hours is really best case, on "good"
> > notebook.
> >
> > What I was trying to point out is that even if you go into s3 with
> > machine fully charged, you'll loose your data after like 30 hours.
> 
> OK, I see so this was an argument for syncing. Sorry for
> misunderstanding.

Yes; we need to sync.

> But we'd still loose RAM. Which makes me wonder whether S3 and STD
> really need to be mutually exclusive. Couldn't we write a snapshot to disk
> just in case. All it would take is the STR code to mark the snapshot invalid
> before any alteration of the filesystems.

suspend.sf.net, program s2both :-).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering?S3
  2009-05-23  9:45                           ` Pavel Machek
@ 2009-05-24 21:02                             ` Oliver Neukum
  2009-05-24 21:14                               ` Pavel Machek
  2009-05-24 21:14                               ` [linux-pm] " Pavel Machek
  2009-05-24 21:02                             ` Oliver Neukum
  1 sibling, 2 replies; 43+ messages in thread
From: Oliver Neukum @ 2009-05-24 21:02 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-pm, Zhang Rui, linux-acpi

Am Samstag, 23. Mai 2009 11:45:18 schrieb Pavel Machek:
> suspend.sf.net, program s2both :-).

Cool. What happens if you crash after unfreezing user space but before you
declare the image invalid?

	Regards
		Oliver


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering?S3
  2009-05-23  9:45                           ` Pavel Machek
  2009-05-24 21:02                             ` Oliver Neukum
@ 2009-05-24 21:02                             ` Oliver Neukum
  1 sibling, 0 replies; 43+ messages in thread
From: Oliver Neukum @ 2009-05-24 21:02 UTC (permalink / raw)
  To: Pavel Machek; +Cc: linux-acpi, linux-pm

Am Samstag, 23. Mai 2009 11:45:18 schrieb Pavel Machek:
> suspend.sf.net, program s2both :-).

Cool. What happens if you crash after unfreezing user space but before you
declare the image invalid?

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [linux-pm] [RFC] why do we need run disk sync before entering?S3
  2009-05-24 21:02                             ` Oliver Neukum
  2009-05-24 21:14                               ` Pavel Machek
@ 2009-05-24 21:14                               ` Pavel Machek
  1 sibling, 0 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-24 21:14 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-pm, Zhang Rui, linux-acpi

On Sun 2009-05-24 23:02:55, Oliver Neukum wrote:
> Am Samstag, 23. Mai 2009 11:45:18 schrieb Pavel Machek:
> > suspend.sf.net, program s2both :-).
> 
> Cool. What happens if you crash after unfreezing user space but before you
> declare the image invalid?

I'd have to check the code to make sure, but it should first kill the
image and then unfreeze :-).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [RFC] why do we need run disk sync before entering?S3
  2009-05-24 21:02                             ` Oliver Neukum
@ 2009-05-24 21:14                               ` Pavel Machek
  2009-05-24 21:14                               ` [linux-pm] " Pavel Machek
  1 sibling, 0 replies; 43+ messages in thread
From: Pavel Machek @ 2009-05-24 21:14 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-acpi, linux-pm

On Sun 2009-05-24 23:02:55, Oliver Neukum wrote:
> Am Samstag, 23. Mai 2009 11:45:18 schrieb Pavel Machek:
> > suspend.sf.net, program s2both :-).
> 
> Cool. What happens if you crash after unfreezing user space but before you
> declare the image invalid?

I'd have to check the code to make sure, but it should first kill the
image and then unfreeze :-).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [RFC] why do we need run disk sync before entering S3
@ 2009-05-13  1:20 Zhang Rui
  0 siblings, 0 replies; 43+ messages in thread
From: Zhang Rui @ 2009-05-13  1:20 UTC (permalink / raw)
  To: linux-pm, linux-acpi

Hi, all,

I did some S3 tests on an eeepc901, the total suspend time(from issue
the suspend command to power down) is about 2.5s~3s.
something interesting is that kernel runs disk sync before entering S3
state, and this takes about 0.7~1.2s.
my question is that, why do we need this for s2ram?
can we remove this and run sys_sync for S4 only?

thanks,
rui

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2009-05-24 21:14 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-13  1:20 [RFC] why do we need run disk sync before entering S3 Zhang Rui
2009-05-13  2:01 ` [linux-pm] " Alan Stern
2009-05-13  8:03   ` Rafael J. Wysocki
2009-05-13  8:45     ` Pavel Machek
2009-05-13  8:53       ` Rafael J. Wysocki
2009-05-13  8:57         ` Pavel Machek
2009-05-13  8:57         ` Pavel Machek
2009-05-13 14:06         ` [linux-pm] " Alan Stern
2009-05-13 14:16           ` Rafael J. Wysocki
2009-05-13 14:16           ` [linux-pm] " Rafael J. Wysocki
2009-05-14  9:42             ` Pavel Machek
2009-05-14  9:42             ` [linux-pm] " Pavel Machek
2009-05-15  1:00               ` Henrique de Moraes Holschuh
2009-05-15  9:08                 ` suspending machine from kernel (was Re: [linux-pm] [RFC] why do we need run disk sync before entering S3) Pavel Machek
2009-05-15 21:15                   ` Henrique de Moraes Holschuh
2009-05-15 21:15                   ` suspending machine from kernel (was " Henrique de Moraes Holschuh
2009-05-15  9:08                 ` Pavel Machek
2009-05-15  1:00               ` [RFC] why do we need run disk sync before entering S3 Henrique de Moraes Holschuh
2009-05-15 14:36               ` [linux-pm] " Rafael J. Wysocki
2009-05-18  7:25                 ` Zhang Rui
2009-05-18  7:25                 ` [linux-pm] " Zhang Rui
2009-05-22 15:33                   ` Pavel Machek
2009-05-22 15:33                   ` [linux-pm] " Pavel Machek
2009-05-23  7:59                     ` Oliver Neukum
2009-05-23  7:59                     ` [linux-pm] " Oliver Neukum
2009-05-23  8:50                       ` [linux-pm] [RFC] why do we need run disk sync before entering?S3 Pavel Machek
2009-05-23  9:05                         ` Oliver Neukum
2009-05-23  9:45                           ` Pavel Machek
2009-05-24 21:02                             ` Oliver Neukum
2009-05-24 21:14                               ` Pavel Machek
2009-05-24 21:14                               ` [linux-pm] " Pavel Machek
2009-05-24 21:02                             ` Oliver Neukum
2009-05-23  9:45                           ` Pavel Machek
2009-05-23  9:05                         ` Oliver Neukum
2009-05-23  8:50                       ` Pavel Machek
2009-05-15 14:36               ` [RFC] why do we need run disk sync before entering S3 Rafael J. Wysocki
2009-05-13 14:06         ` Alan Stern
2009-05-13  8:53       ` Rafael J. Wysocki
2009-05-13  8:45     ` Pavel Machek
2009-05-19  1:03     ` Nigel Cunningham
2009-05-13  8:03   ` Rafael J. Wysocki
2009-05-13  2:01 ` Alan Stern
  -- strict thread matches above, loose matches on Subject: below --
2009-05-13  1:20 Zhang Rui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.