From: Alan Stern <stern@rowland.harvard.edu>
To: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Cc: gregkh@linuxfoundation.org, kishon@ti.com, dianders@chromium.org,
s.shtylyov@omp.ru, mka@chromium.org, ming.lei@canonical.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
tonywwang@zhaoxin.com, weitaowang@zhaoxin.com
Subject: Re: [PATCH v2] USB: HCD: Fix URB giveback issue in tasklet function
Date: Mon, 25 Jul 2022 09:58:01 -0400 [thread overview]
Message-ID: <Yt6haeQBseJOEx1r@rowland.harvard.edu> (raw)
In-Reply-To: <20220725065251.832087-1-WeitaoWang-oc@zhaoxin.com>
On Mon, Jul 25, 2022 at 02:52:51PM +0800, Weitao Wang wrote:
This is basically okay. Just a couple of small comments...
> Usb core introduce the mechanism of giveback of URB in tasklet context to
> reduce hardware interrupt handling time. On some test situation(such as
> FIO with 4KB block size), when tasklet callback function called to
> giveback URB, interrupt handler add URB node to the bh->head list also.
> If check bh->head list again after finish all URB giveback of local_list,
> then it may introduce a "dynamic balance" between giveback URB and add URB
> to bh->head list. This tasklet callback function may not exit for a long
> time, which will cause other tasklet function calls to be delayed. Some
> real-time applications(such as KB and Mouse) will see noticeable lag.
>
> Fix this issue by taking new URBs giveback in next tasklet function call.
> Add a member high_prio for structure giveback_urb_bh and replace the local
> high_prio_bh variable with this structure member in usb_hcd_giveback_urb.
The patch description should do more than say what the new code _is_ --
we can see that easily enough by reading the patch. The description
should explain _why_ the code was changed.
> Fixes: 94dfd7edfd5c ("USB: HCD: support giveback of URB in tasklet context")
> Signed-off-by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
> ---
> v1->v2:
> - Fix compile warning by remove label "restart".
> - Modify the patch description info.
> - Change structure member from hi_priority to high_prio.
>
> drivers/usb/core/hcd.c | 25 ++++++++++++++-----------
> include/linux/usb/hcd.h | 1 +
> 2 files changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index 06eea8848ccc..1feb9a604380 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -1691,7 +1691,6 @@ static void usb_giveback_urb_bh(struct tasklet_struct *t)
>
> spin_lock_irq(&bh->lock);
> bh->running = true;
> - restart:
> list_replace_init(&bh->head, &local_list);
> spin_unlock_irq(&bh->lock);
>
> @@ -1705,10 +1704,16 @@ static void usb_giveback_urb_bh(struct tasklet_struct *t)
> bh->completing_ep = NULL;
> }
>
> - /* check if there are new URBs to giveback */
> + /* giveback new URBs next time to prevent this function from
> + * not exiting for a long time.
> + */
Minor stylistic issue: The currently accepted format for multi-line
comments is like this:
/*
* Blah blah blah
* Blah blah blah
*/
Alan Stern
next prev parent reply other threads:[~2022-07-25 13:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-25 6:52 Weitao Wang
2022-07-25 8:29 ` Sergei Shtylyov
2022-07-25 8:52 ` WeitaoWang-oc
2022-07-25 13:58 ` Alan Stern [this message]
2022-07-26 6:46 ` WeitaoWang-oc
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=Yt6haeQBseJOEx1r@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=WeitaoWang-oc@zhaoxin.com \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ming.lei@canonical.com \
--cc=mka@chromium.org \
--cc=s.shtylyov@omp.ru \
--cc=tonywwang@zhaoxin.com \
--cc=weitaowang@zhaoxin.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
all inboxes | Powered by JetHome®