From: Greg KH <gregkh@linuxfoundation.org>
To: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
Cc: stern@rowland.harvard.edu, linux-usb@vger.kernel.org,
usb-storage@lists.one-eyed-alien.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb-storage: Optimize scan delay more precisely
Date: Wed, 27 Mar 2024 06:53:49 +0100 [thread overview]
Message-ID: <2024032757-surcharge-grime-d3dd@gregkh> (raw)
In-Reply-To: <20240327055130.43206-1-Norihiko.Hama@alpsalpine.com>
On Wed, Mar 27, 2024 at 02:51:30PM +0900, Norihiko Hama wrote:
> Current storage scan delay is reduced by the following old commit.
>
> a4a47bc03fe5 ("Lower USB storage settling delay to something more reasonable")
>
> It means that delay is at least 'one second', or zero with delay_use=0.
> 'one second' is still long delay especially for embedded system but
> when delay_use is set to 0 (no delay), error still observed on some USB drives.
>
> So delay_use should not be set to 0 but 'one second' is quite long.
>
> This patch optimizes scan delay more precisely
> to minimize delay time but not to have any problems on USB drives
> by adding module parameter 'delay_scale' of delay-time divisor.
> By default, delay time is 'one second' for backward compatibility.
> For example, it seems to be good by changing delay_scale=100,
> that is 100 millisecond delay.
>
> Signed-off-by: Norihiko Hama <Norihiko.Hama@alpsalpine.com>
> ---
> drivers/usb/storage/usb.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
> index 90aa9c12ffac..f4a755e364da 100644
> --- a/drivers/usb/storage/usb.c
> +++ b/drivers/usb/storage/usb.c
> @@ -70,6 +70,9 @@ MODULE_LICENSE("GPL");
> static unsigned int delay_use = 1;
> module_param(delay_use, uint, S_IRUGO | S_IWUSR);
> MODULE_PARM_DESC(delay_use, "seconds to delay before using a new device");
> +static unsigned int delay_scale = MSEC_PER_SEC;
> +module_param(delay_scale, uint, 0644);
> +MODULE_PARM_DESC(delay_scale, "time scale of delay_use");
Sorry, but module parameters are from the 1990's, we will not go back to
that if at all possible as it's not easy to maintain and will not work
properly for multiple devices.
I can understand wanting something between 1 and 0 seconds, but adding
yet-another-option isn't probably the best way, sorry.
thanks,
greg k-h
next prev parent reply other threads:[~2024-03-27 5:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-27 5:51 [PATCH] usb-storage: Optimize scan delay more precisely Norihiko Hama
2024-03-27 5:53 ` Greg KH [this message]
2024-03-27 7:39 ` Norihiko Hama
2024-03-27 7:44 ` Greg KH
2024-03-27 7:57 ` Norihiko Hama
2024-03-27 8:15 ` Greg KH
2024-03-28 2:52 ` Norihiko Hama
2024-03-27 14:10 ` Alan Stern
2024-03-28 3:04 ` Norihiko Hama
2024-03-28 14:51 ` Alan Stern
2024-03-28 15:21 ` [usb-storage] " Matthew Dharm
2024-03-28 16:18 ` Alan Stern
2024-03-28 23:38 ` Norihiko Hama
2024-03-29 1:45 ` Matthew Dharm
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=2024032757-surcharge-grime-d3dd@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=Norihiko.Hama@alpsalpine.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=usb-storage@lists.one-eyed-alien.net \
/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