From: Alan Stern <stern@rowland.harvard.edu>
To: Yasushi Asano <yazzep@gmail.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
erosca@de.adit-jv.com, andrew_gabbasov@mentor.com,
jim_baxter@mentor.com, wnatsume@jp.adit-jv.com,
nnishiguchi@jp.adit-jv.com, yasano@jp.adit-jv.com
Subject: Re: [PATCH] [RFC] USB: hub.c: Add the retry count module parameter for usbcore
Date: Mon, 3 Aug 2020 14:37:32 -0400 [thread overview]
Message-ID: <20200803183732.GA112453@rowland.harvard.edu> (raw)
In-Reply-To: <20200730104226.3537-1-yazzep@gmail.com>
On Thu, Jul 30, 2020 at 07:42:26PM +0900, Yasushi Asano wrote:
> From: Yasushi Asano <yasano@jp.adit-jv.com>
>
> Dear Alan
> Dear Greg
>
> I would like to have a consultation with you. The customer's product
> board needs to get a USB certification and compliance, but it can not
> pass the test using the current USB hub driver. According to the USB
> compliance plan[1], the“6.7.22 Device No Response” test requires the
> detection of device enumeration failure within 30 seconds. The
> kernel(USB hub driver) must notify userspace of the enumeration failure
> within 30 seconds.
>
> In the current hub driver, the place to detect device enumeration
> failure is [2]. I have modified the hub driver to issue a uevent here,
> but the procedure of device enumeration (new_scheme+old_scheme) takes
> too long to execute, it couldn't reach [2] within 30 seconds after
> starting the test. According to the result of PETtool [3], the state of
> "Device No response" is that usb_control_msg(USB_REQ_GET_DESCRIPTOR) [4]
> in hub_port_initn times out. That means r == -ETIMEDOUT. because of the
> default setting of initial_descriptor_timeout is 5000 msec[5],
> usb_control_msg() took 5000msec until -ETIMEDOUT.
>
> I will try to describe the flow of device enumeration processing
> below[6]. If my understanding is correct, the enumeration failure [2]
> will be reached after performing all the loops of [7][8][9]+[7][10]. In
> the new scheme, 12 times check will be performed ([7]/2*[8]*[9] => 2*2*3
> => 12). In the old scheme , 4 times check will be performed ([7]/2*[10]
> => 2*2 => 4). In total, it checks 16 times, and it took 5000msec to
> ETIMEDOUT every time. Therefore, It takes about 80 seconds(16*5000msec)
> to reach [2]. This does not pass the "Device No response" test.
I agree with Greg, we don't want to add module parameters.
The problem is that we make up to 16 attempts, and each attempt can take
5 seconds. We need to decrease the number of attempts to 6; then the
total time will be 30 seconds. We also need to keep both the old and
new schemes.
So let's change the code to do 3 tries with each scheme. For example,
3 * new scheme, then 3 * old scheme, or else
3 * old scheme, then 3 * new_scheme,
depending on the old_scheme_first parameter. Change the loops in [7],
[8], [9], and [10] so that each iteration does the next item on this
list instead of starting back at the beginning.
(Or maybe it would work better with
2 * scheme, then 2 * old scheme, then 1 * new scheme,
then 1 * old scheme
with old and new swapped if old_scheme_first is set. I don't know.)
Anyway, can you write a patch to do this?
Alan Stern
next prev parent reply other threads:[~2020-08-03 18:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-30 10:42 [PATCH] [RFC] USB: hub.c: Add the retry count module parameter for usbcore Yasushi Asano
2020-07-31 6:44 ` Greg KH
2020-08-03 18:37 ` Alan Stern [this message]
2020-08-06 5:43 ` Asano, Yasushi (ADITJ/SWG)
2020-08-06 15:10 ` Alan Stern
2020-08-08 6:57 ` [PATCH] [RFC] USB: hub.c: decrease the number of attempts of enumeration scheme Yasushi Asano
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=20200803183732.GA112453@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=andrew_gabbasov@mentor.com \
--cc=erosca@de.adit-jv.com \
--cc=gregkh@linuxfoundation.org \
--cc=jim_baxter@mentor.com \
--cc=linux-usb@vger.kernel.org \
--cc=nnishiguchi@jp.adit-jv.com \
--cc=wnatsume@jp.adit-jv.com \
--cc=yasano@jp.adit-jv.com \
--cc=yazzep@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).