mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@gmail.com>
To: Weitao Wang <WeitaoWang-oc@zhaoxin.com>,
	stern@rowland.harvard.edu, 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
Cc: tonywwang@zhaoxin.com, weitaowang@zhaoxin.com
Subject: Re: [PATCH v2] USB: HCD: Fix URB giveback issue in tasklet function
Date: Mon, 25 Jul 2022 11:29:33 +0300	[thread overview]
Message-ID: <3b9a3fec-7716-3e9d-1e91-cfdac46845f7@gmail.com> (raw)
In-Reply-To: <20220725065251.832087-1-WeitaoWang-oc@zhaoxin.com>

Hello!

On 7/25/22 9:52 AM, Weitao Wang wrote:

> 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.
> 
> 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
[...]
> @@ -2959,6 +2961,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
>  
>  	/* initialize tasklets */
>  	init_giveback_urb_bh(&hcd->high_prio_bh);
> +	hcd->high_prio_bh.high_prio = 1;

   s/1/true/?

>  	init_giveback_urb_bh(&hcd->low_prio_bh);
>  
>  	/* enable irqs just before we start the controller,
> diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
> index 2c1fc9212cf2..98d1921f02b1 100644
> --- a/include/linux/usb/hcd.h
> +++ b/include/linux/usb/hcd.h
> @@ -66,6 +66,7 @@
>  
>  struct giveback_urb_bh {
>  	bool running;
> +	bool high_prio;
>  	spinlock_t lock;
>  	struct list_head  head;
>  	struct tasklet_struct bh;

MBR, Sergey

  reply	other threads:[~2022-07-25  8:29 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 [this message]
2022-07-25  8:52   ` WeitaoWang-oc
2022-07-25 13:58 ` Alan Stern
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=3b9a3fec-7716-3e9d-1e91-cfdac46845f7@gmail.com \
    --to=sergei.shtylyov@gmail.com \
    --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=stern@rowland.harvard.edu \
    --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®