All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lennart Poettering <lennart@poettering.net>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Hans de Goede <hdegoede@redhat.com>,
	usb-storage@lists.one-eyed-alien.net,
	Matthias Schwarzott <zzam@gentoo.org>,
	linux-usb@vger.kernel.org, systemd-devel@lists.freedesktop.org,
	hirofumi@mail.parknet.co.jp
Subject: Re: [systemd-devel] [usb-storage] Re: Amazon Kindle disconnect after Synchronize Cache
Date: Wed, 17 Mar 2021 17:47:05 +0100	[thread overview]
Message-ID: <YFIyidaZZmDoTevB@gardel-login> (raw)
In-Reply-To: <20210317151746.GB488655@rowland.harvard.edu>

On Mi, 17.03.21 11:17, Alan Stern (stern@rowland.harvard.edu) wrote:

> On Wed, Mar 17, 2021 at 01:21:50PM +0100, Hans de Goede wrote:
> > Hi,
> >
> > On 3/16/21 6:04 PM, Alan Stern wrote:
> > > I think it would be mildly better, but not a whole lot.  Since the
> > > Kindle describes itself as having removable media, the kernel normally
> > > probes it periodically to make sure the media remains present.  The
> > > default probing interval is 2 seconds.  Reducing it to 0.9 seconds
> > > doesn't represent an exorbitant additional load IMO -- especially since
> > > Kindles don't tend to spend huge amounts of time connected to computers.
> >
> > Ah, I did not know that the default polling interval was that low(ish),
> > given that the default indeed is already that low, then changing it to
> > 0.8 seconds would not be a big change.  And we probably have a lot of
> > lower hanging fruit for unnecessary wakeups then that.
>
> So we need to make a decision: Should the patch be merged, or should we
> punt the issue to userspace tools?
>
> On the plus side, the patch is rather small and non-invasive (although
> it does allocate the last remaining bit in the 32-bit fflags field).
> There's also the advantage of sending the extra command only when it is
> needed, as opposed to increasing the overall frequency of TUR polling.
>
> Any opinions?

I'd argue that this should be done in the kernel.

IIUC the issue can actually lead to data corruption, no? i.e. some
program writes 25 different files to different places on such an fs,
then calls fsync() on one of them but not the others. Then quite
possibly the fsync() will trigger a device disconnect sooner or later
at which point the one file surely hit the disk, but there's no
guarantee for the other 24, they might remain cached in memory and are
never written out.

I'd say quirks that are necessary to avoid data corruption should
better be done in the kernel and udev's hwdb stuff is only for stuff
that "fills in gaps", i.e. adds additional tweaks that make things
prettier, cleaner, nicer, more efficient but not things that make the
basic things work, and data integrity sounds pretty basic to me.

Or to give a counter example: the device advertises it can do media
change, but actually cannot, right, it's not a floppy drive or cdrom
driver after all? maybe hwdb would thus actually be the place for the
opposite of the suggested fix: turn off the media change polling to
reduce needless wakeups.

I mean, I'd be more open to this if this was a frequent thing and the
database for devices like this was just tooo large for the kernel to
carry, but that's not the case here either: it's two devices afaik,
and such an issue wasn't seen elswhere.

Lennart

--
Lennart Poettering, Berlin

  reply	other threads:[~2021-03-17 16:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 16:54 Amazon Kindle disconnect after Synchronize Cache Matthias Schwarzott
2021-03-05 19:14 ` Alan Stern
     [not found]   ` <CAL411-qf+c_CB4cL=2349QqCCYimOBCYxXbsOfLbvVYOg0294g@mail.gmail.com>
2021-03-06 16:07     ` Alan Stern
2021-03-07  5:58   ` Matthias Schwarzott
2021-03-07 15:52     ` Alan Stern
2021-03-07 16:52       ` Matthias Schwarzott
2021-03-07 16:58         ` Alan Stern
2021-03-08 21:59           ` Matthias Schwarzott
2021-03-09 15:50             ` [usb-storage] " Alan Stern
2021-03-10 20:56               ` Matthias Schwarzott
2021-03-10 21:46                 ` Alan Stern
2021-03-11  6:05                   ` Matthias Schwarzott
2021-03-11 14:39                     ` Alan Stern
2021-03-16  5:26                       ` Matthias Schwarzott
2021-03-16 16:26                         ` Alan Stern
2021-03-16 16:43                           ` [systemd-devel] " Hans de Goede
2021-03-16 17:04                             ` Alan Stern
2021-03-16 21:52                               ` Matthias Schwarzott
2021-03-17 12:21                               ` Hans de Goede
2021-03-17 15:17                                 ` Alan Stern
2021-03-17 16:47                                   ` Lennart Poettering [this message]
     [not found]                                     ` <F279F9BC020000F5AE14D9EC@gwsmtp.uni-regensburg.de>
     [not found]                                       ` <C63C44570200006665972EEF@gwsmtp.uni-regensburg.de>
     [not found]                                         ` <B960C12A020000A667ECE9F9@gwsmtp.uni-regensburg.de>
     [not found]                                           ` <B72C58530200001565972EEF@gwsmtp.uni-regensburg.de>
     [not found]                                             ` <0F2319EB020000F567ECE9F9@gwsmtp.uni-regensburg.de>
     [not found]                                               ` <DE3F57520200009E65972EEF@gwsmtp.uni-regensburg.de>
     [not found]                                                 ` <52CC0074020000A3D68BC3D5@gwsmtp.uni-regensburg.de>
2021-03-18  7:03                                                   ` Antw: [EXT] " Ulrich Windl
2021-03-18 14:59                                                     ` Alan Stern
     [not found]                                                 ` <474C42CD02000091AE14D9EC@gwsmtp.uni-regensburg.de>
2021-03-18  7:04                                                   ` Ulrich Windl
     [not found]                                                   ` <D43A6F56020000F865972EEF@gwsmtp.uni-regensburg.de>
2021-03-18  7:10                                                     ` Antw: [EXT] [systemd-devel] [PATCH] usb-storage: Add quirk to defeat Kindle's automatic unload Ulrich Windl
2021-03-18 15:03                                                       ` Alan Stern
2021-03-17 17:56                                   ` [systemd-devel] [usb-storage] Re: Amazon Kindle disconnect after Synchronize Cache Matthias Schwarzott
2021-03-17 18:31                                     ` Hans de Goede
2021-03-17 19:06                                     ` [PATCH] usb-storage: Add quirk to defeat Kindle's automatic unload Alan Stern
2021-03-18 11:39                                       ` Hans de Goede
2021-03-18 13:50                                       ` [systemd-devel] " Tomasz Torcz
2021-03-18 15:07                                         ` Alan Stern
2021-03-16 21:43                           ` [usb-storage] Re: Amazon Kindle disconnect after Synchronize Cache Matthias Schwarzott

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=YFIyidaZZmDoTevB@gardel-login \
    --to=lennart@poettering.net \
    --cc=hdegoede@redhat.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=systemd-devel@lists.freedesktop.org \
    --cc=usb-storage@lists.one-eyed-alien.net \
    --cc=zzam@gentoo.org \
    /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 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.