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
  0 siblings, 0 replies; 21+ 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] 21+ 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
  0 siblings, 0 replies; 21+ 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] 21+ 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; 21+ 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] 21+ 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; 21+ 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] 21+ 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; 21+ 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] 21+ 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; 21+ 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] 21+ 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; 21+ 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] 21+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  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, 0 replies; 21+ 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] 21+ 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; 21+ 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] 21+ 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       ` Zhang Rui
  1 sibling, 0 replies; 21+ 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] 21+ 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 14:36     ` [linux-pm] " Rafael J. Wysocki
@ 2009-05-15 14:36     ` Rafael J. Wysocki
  2 siblings, 0 replies; 21+ 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] 21+ 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 14:36     ` [linux-pm] " Rafael J. Wysocki
  2009-05-15 14:36     ` Rafael J. Wysocki
  2 siblings, 0 replies; 21+ 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] 21+ 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; 21+ 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] 21+ 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; 21+ 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] 21+ 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 14:06       ` Alan Stern
  1 sibling, 0 replies; 21+ 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] 21+ 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 14:06       ` Alan Stern
  1 sibling, 0 replies; 21+ 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] 21+ 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; 21+ 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] 21+ 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; 21+ 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] 21+ 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; 21+ 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] 21+ messages in thread

* Re: [RFC] why do we need run disk sync before entering S3
  2009-05-13  1:20 Zhang Rui
@ 2009-05-13  2:01 ` Alan Stern
  0 siblings, 0 replies; 21+ 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] 21+ messages in thread

* [RFC] why do we need run disk sync before entering S3
@ 2009-05-13  1:20 Zhang Rui
  2009-05-13  2:01 ` Alan Stern
  0 siblings, 1 reply; 21+ 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] 21+ messages in thread

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

Thread overview: 21+ 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  1:20 Zhang Rui
2009-05-13  2:01 ` Alan Stern
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 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 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 14:36     ` [linux-pm] " Rafael J. Wysocki
2009-05-18  7:25       ` 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: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-18  7:25       ` [RFC] why do we need run disk sync before entering S3 Zhang Rui
2009-05-15 14:36     ` Rafael J. Wysocki

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.