Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mateusz Sikora" <ms1qaz@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH 2/2] USB: serial: ch341: use more read urbs
Date: Sun, 06 Dec 2026 00:32:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-252017@kernel.org> (raw)
In-Reply-To: <20261206001844.14858-3-ms1qaz@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] USB: serial: ch341: 32 read URBs serialize HCD unlinks on
  close and suspend
--

commit 013e0416b1d1c563b2c9b985e82a5ab90d4fa11e
Author: Mateusz Sikora <ms1qaz@gmail.com>

USB: serial: ch341: use more read urbs

This commit increases the number of bulk-in read URBs used by the ch341
driver from the default of 2 to 32.

> diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
> index 569f4aede215d..c9ac114b82e36 100644
> --- a/drivers/usb/serial/ch341.c
> +++ b/drivers/usb/serial/ch341.c
> @@ -868,6 +868,7 @@ static struct usb_serial_driver ch341_device = {
>  	},
>  	.id_table          = id_table,
>  	.num_ports         = 1,
> +	.num_read_urbs     = 32,
>  	.open              = ch341_open,
>  	.dtr_rts	   = ch341_dtr_rts,
>  	.carrier_raised	   = ch341_carrier_raised,

[Severity: Medium]
Does queuing 32 read URBs introduce a close and suspend latency regression?

On ch341_close(), usb_serial_generic_close() loops over port->read_urbs[]
in forward order calling usb_kill_urb(), and usb_serial_port_poison_urbs()
does the same with usb_poison_urb() on suspend.  Each call unlinks one URB
and sleeps until it completes, leaving the rest active on the endpoint.

On EHCI, each active bulk QH unlink waits on a 2 ms timer and relinks the
QH while other URBs remain queued, stalling close or suspend for at least
64 ms per open port (up from ~4 ms).  OHCI and UHCI stall for 32-64 ms,
and xHCI runs 32 Stop Endpoint and Set TR Dequeue Pointer cycles.

Blocking all read URBs with usb_block_urb(), issuing asynchronous
usb_unlink_urb() across them, and then waiting for completion in
usb-serial core would let the HCD unlink the queue in a single cycle.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261206001844.14858-1-ms1qaz@gmail.com?part=2

  reply	other threads:[~2026-12-06  0:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-06  0:18 [PATCH 0/2] USB: serial: ch341: fix character loss at high line speeds Mateusz Sikora
2026-12-06  0:18 ` [PATCH 1/2] USB: serial: allow drivers to use more read urbs Mateusz Sikora
2026-12-06  0:18 ` [PATCH 2/2] USB: serial: ch341: " Mateusz Sikora
2026-12-06  0:32   ` sashiko-bot [this message]
2026-12-06  0:32 ` [PATCH 0/2] USB: serial: ch341: fix character loss at high line speeds sashiko-bot

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=sashiko-outbox-252017@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ms1qaz@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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