mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Len Brown <lenb@kernel.org>,
	One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	Linux PM list <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Len Brown <len.brown@intel.com>
Subject: Re: [PATCH 1/1] suspend: delete sys_sync()
Date: Fri, 08 May 2015 22:30:17 +0200	[thread overview]
Message-ID: <4290667.ZqInAykFGS@vostro.rjw.lan> (raw)
In-Reply-To: <CAJvTdKnoZhworj21Bsdt5ttGK+vQQ0tB_0-2Aok-rdsU8VvNkg@mail.gmail.com>

On Friday, May 08, 2015 03:32:30 PM Len Brown wrote:
> On Fri, May 8, 2015 at 3:13 PM, One Thousand Gnomes
> <gnomes@lxorguk.ukuu.org.uk> wrote:
> >> 2. worst case latency is obscene, there are examples of some
> >>     syncs which take over 3,000 ms to complete.
> >
> > ATA is pretty open ended on this. I believe the vendors use 7 seconds
> > just for the cache flush as their limit because after 7 seconds some non
> > Linux OS's blow up. However if my suspend/resume crashes (as still I'm
> > sorry to say happens far too often) I don't want my last ten minutes of
> > work trashed.
> >
> >> Unfortunately, sys_sync() can be a significant pain point,
> >> even for systems that run Android.
> >
> > Android devices often have slow I/O devices coupled with a lot of memory
> > so yes that is true.
> >
> > There are however some very important reasons for using sync() in a
> > suspend
> >
> > - I can read data off the suspended machines disk volumes even though I
> >   can't write to them. People do this.

Reportedly, for some journaling FSes that may trigger a jornal replay and
therefore on-disk data modifications to happen.  I think we're talking about
FAT mostly here, though.

I guess the concern is about things that autosleep (eg. Android) and so may
not be able to sync() from user space before suspending, but for them we
can just move the sync() to the autosleep thread.

> > - Suspend requires the firmware, drivers and kernel all get it exactly
> >   right. On a lot of machines therefore suspend is still a buggy pile of
> >   crap. Sync is extremely valuable given that you can't be entirely
> >   sure your system will resume.
> >
> > - Users habitually do stupid things like removing USB dongles from
> >   suspended boxes and thinking afterwards. Perception is that the device
> >   is off therefore you can unplug it.
> >
> > So I think its inappropriate to change the default. Allow users to turn
> > it off by all means, and I imagine many phones would use that.
> 
> FWIW, 18-months ago, I proposed a patch to make the sys_sync() optional
> "[PATCH 1/1] suspend: make sync() on suspend-to-RAM optional"
> and feedback was that fewer choices would be better.
> 
> Note that user-space has full license both before and after this patch
> to sync().  Indeed, the s2disk and s2ram utilities do exactly that.
> 
> > Some of this however is crappy suspend/resume handling. If the suspend
> > subsystem was doing its job then for the cases of timeout triggered
> > suspend it would have triggered most of the disk writes ten seconds
> > before it tried to suspend properly ;-)
> 
> No problem, continue to use s2ram on your system -- and to the extent
> that sync works, your data will be on disk.  (sync reliability is a
> different topic...)
> 
> Understand, however, there are systems which suspend/resume reliably
> many times per second, making policy choice of having the kernel hard-code
> a sys_sync() into the suspend path a bad idea.

My current view on that is that whether or not to do a sync() before suspending
ultimately is a policy decision and should belong to user space as such (modulo
the autosleep situation when user space may not know when the suspend is going
to happen).

Moreover, user space is free to do as many sync()s before suspending as it
wants to and the question here is whether or not the *kernel* should sync()
in the suspend code path.

Since we pretty much can demonstrate that having just one sync() in there is
not sufficient in general, should we put two of them in there?  Or just
remove the existing one and leave it to user space entirely?

Rafael


  parent reply	other threads:[~2015-05-08 20:05 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08  7:08 Len Brown
2015-05-08 14:34 ` Alan Stern
2015-05-08 16:36   ` Len Brown
2015-05-08 19:13     ` One Thousand Gnomes
2015-05-08 19:32       ` Len Brown
2015-05-08 19:52         ` One Thousand Gnomes
2015-05-08 20:39           ` Rafael J. Wysocki
2015-05-08 20:30         ` Rafael J. Wysocki [this message]
2015-05-09 19:59           ` Alan Stern
2015-05-09 20:25             ` Henrique de Moraes Holschuh
2015-05-11 20:34               ` Len Brown
2015-05-12  6:11                 ` Oliver Neukum
2015-06-25 17:11                 ` Henrique de Moraes Holschuh
2015-06-30 20:04                   ` Len Brown
2015-07-01 12:21                     ` Henrique de Moraes Holschuh
2015-07-02  3:07                       ` Len Brown
2015-07-03  1:42                         ` Dave Chinner
2015-07-04  1:03                           ` Rafael J. Wysocki
2015-07-04  8:50                             ` Geert Uytterhoeven
2015-07-05 23:25                               ` Rafael J. Wysocki
2015-07-04 14:19                             ` Alan Stern
2015-07-05 23:28                               ` Rafael J. Wysocki
2015-07-06 11:06                                 ` Pavel Machek
2015-07-06 13:59                                   ` Rafael J. Wysocki
2015-07-07 10:25                                     ` Pavel Machek
2015-07-07 12:22                                       ` Rafael J. Wysocki
2015-07-06  0:06                             ` Dave Chinner
2015-07-06 11:11                               ` Pavel Machek
2015-07-06 13:52                               ` Rafael J. Wysocki
2015-07-07  1:17                                 ` Dave Chinner
2015-07-07 12:14                                   ` Rafael J. Wysocki
2015-07-07 13:16                                     ` Oliver Neukum
2015-07-07 14:32                                       ` Rafael J. Wysocki
2015-07-07 14:38                                         ` Oliver Neukum
2015-07-07 15:03                                           ` Alan Stern
2015-07-07 22:20                                             ` Rafael J. Wysocki
2015-07-08 11:20                                               ` Pavel Machek
2015-07-08 14:40                                                 ` Alan Stern
2015-07-08 22:04                                                   ` Rafael J. Wysocki
2015-07-07 22:11                                           ` Rafael J. Wysocki
2015-07-08  7:51                                             ` Oliver Neukum
2015-07-08 22:03                                               ` Rafael J. Wysocki
2015-07-09  7:32                                                 ` Oliver Neukum
2015-07-09 23:22                                                   ` Rafael J. Wysocki
2015-08-04 19:54                                                     ` Pavel Machek
2015-07-08 11:17                                         ` Pavel Machek
2015-07-07 13:42                                   ` Takashi Iwai
2015-07-06 10:15                             ` Ming Lei
2015-07-06 10:03           ` Pavel Machek
2015-05-11  1:44 ` Dave Chinner
2015-05-11 20:22   ` Len Brown
2015-05-12 22:34     ` Dave Chinner
2015-05-13 23:22   ` NeilBrown
2015-05-14 23:54     ` Dave Chinner
2015-05-15  0:34       ` Rafael J. Wysocki
2015-05-15  0:40         ` Ming Lei
2015-05-15  0:59           ` Rafael J. Wysocki
2015-05-15  5:13             ` Ming Lei
2015-05-15 10:35             ` One Thousand Gnomes
2015-05-18  1:57               ` NeilBrown
     [not found]                 ` <CAJvTdKn_0EZ0ZuqO2e4+ExD8kFWcy78fse4zHr3uFZODOroXEg@mail.gmail.com>
2015-06-19  1:09                   ` Dave Chinner
2015-06-19  2:35                     ` Len Brown
2015-06-19  4:31                       ` Dave Chinner
2015-06-19  6:34                         ` Len Brown
2015-06-19 23:07                           ` Dave Chinner
2015-06-20  5:26                             ` Len Brown
2015-05-15  1:04       ` NeilBrown
2015-05-15 14:20         ` Alan Stern
2015-05-15 14:32           ` Alan Stern
2015-05-15 14:19       ` Alan Stern
2015-07-06 10:07   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4290667.ZqInAykFGS@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=len.brown@intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome