From: Jim Baxter <jim_baxter@mentor.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg KH <gregkh@linuxfoundation.org>,
<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
<linux-usb@vger.kernel.org>,
"Resch Carsten (CM/ESO6)" <Carsten.Resch@de.bosch.com>,
"Rosca, Eugeniu (ADITG/ESB)" <erosca@de.adit-jv.com>
Subject: Re: PROBLEM: Long Workqueue delays.
Date: Tue, 18 Aug 2020 11:54:51 +0100 [thread overview]
Message-ID: <1838f2c3-7915-9e5b-3112-6b082b945410@mentor.com> (raw)
In-Reply-To: <20200817184753.GA120209@rowland.harvard.edu>
On 17/08/2020 19:47, Alan Stern wrote:
>
> Unplugging a R/W USB drive without unmounting it first is a great way to
> corrupt the data.
>
Thank you, post development we will only mount the USB stick as R/O.
>> Using perf Iidentified the hub_events workqueue was spending a lot of time in
>> invalidate_partition(), I have included a cut down the captured data from perf in
>> [2] which shows the additional functions where the kworker spends most of its time.
>
> invalidate_partition() is part of the block layer, not part of USB. It
> gets called whenever a drive is removed from the system, no matter what
> type of drive it is. You should ask the people involved in that
> subsystem why it takes so long.
>
I included the linux-mm list but missed the filesystem, I will ask the question
to the linux-fsdevel too.
>> I realise that not unmounting the USB stick is not ideal, though I wonder what
>> additional work is done when unplugging the USB stick compared to unmounting it.
>
> Unmounting a drive flushes all the dirty buffers from memory back to the
> drive. Obviously that can't be done if the drive is unplugged first.
>
> As far as the USB subsystem is concerned, exactly the same amount of
> work is done during disconnect regardless of whether or not the drive is
> mounted. (In fact, the USB subsystem doesn't even know whether a drive
> is mounted; that concept is part of the block and filesystem layers.)
>>> I guess it may be waiting for a time-out during the operation without the unmount.
>
> That seems very unlikely. When a USB device gets unplugged the system
> realizes it. Any I/O meant for that device is immediately cancelled;
> there are no timeouts.
>
> (Okay, not strictly true; there is a fraction-of-a-second timeout during
> which the system waits to see whether the disconnect was permanent or
> just a temporary glitch. But you're talking about 6-second long
> delays.)
>
Thank you, no I don't expect that to cause the issue and it is very likely the delay
is in another subsystem.
Regards,
Jim Baxter
> Alan Stern
>
next prev parent reply other threads:[~2020-08-18 10:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-17 11:40 Jim Baxter
2020-08-17 11:57 ` Greg KH
2020-08-17 18:24 ` Jim Baxter
2020-08-17 18:47 ` Alan Stern
2020-08-18 10:54 ` Jim Baxter [this message]
2020-08-18 14:48 ` Alan Stern
2020-08-17 15:25 ` Alan Stern
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=1838f2c3-7915-9e5b-3112-6b082b945410@mentor.com \
--to=jim_baxter@mentor.com \
--cc=Carsten.Resch@de.bosch.com \
--cc=erosca@de.adit-jv.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-usb@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