Linux USB
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Julian Oes <julian@oes.ch>
Cc: Johan Hovold <johan@kernel.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] USB: serial: generic: recover from a stalled bulk-in endpoint
Date: Tue, 1 Sep 2026 06:33:15 +0200	[thread overview]
Message-ID: <2026090142-walrus-zipfile-70d1@gregkh> (raw)
In-Reply-To: <20260901034949.118739-1-julian@oes.ch>

On Tue, Sep 01, 2026 at 03:49:49PM +1200, Julian Oes wrote:
> A USB serial port can go permanently silent when its bulk-in endpoint is
> halted: the read URBs complete with -EPIPE, which the generic read
> callback has always treated as fatal, and no further data arrives until
> user space closes and reopens the tty.

Which is good, as the device is obviously broken at that point in time :)

> Recovery from a halted bulk endpoint is CLEAR_FEATURE(ENDPOINT_HALT)
> followed by resubmission of the reads. That needs a control transfer, so
> defer it to a work item as cdc-acm already does.
> 
> Use a dedicated work item rather than the existing per-port work.

Ok, this is just llm-generated text.  Please rewrite this in your own
words.

> The
> latter is scheduled from every write completion and must not be
> cancelled on close, as the line discipline depends on it. Stall
> recovery resubmits the read URBs and must therefore be cancelled
> wherever the reads are stopped, that is, on close, suspend and
> disconnect.
> 
> Schedule the recovery with a short cooldown. The stall can persist for a
> few milliseconds, during which the resubmitted URBs stall again as soon
> as they are queued; without a delay the recovery becomes a busy loop of
> control transfers. Rate-limit the stall message for the same reason, as
> a stall is now a recurring condition rather than a terminal one.
> 
> I ran into this with an FTDI FT231X behind a hub that halts the
> adapter's bulk-in endpoint whenever an unrelated CDC ACM device on a
> sibling port is disconnected. With this change the FTDI port keeps
> receiving data across such an event.

This sounds like a broken hub, why not just replace that?  It shouldn't
be causing transactions on a different port to stop.

> +/*
> + * Cooldown between attempts to recover a stalled bulk-in endpoint. A stall
> + * caused by a transient fault can persist for a few milliseconds, during which
> + * the resubmitted URBs stall again immediately. Back off a little so that a
> + * persistently halted endpoint is not hammered with control transfers.
> + */
> +#define USB_SERIAL_STALL_COOLDOWN	msecs_to_jiffies(10)

control or bulk?  This comment does not make much sense.

thanks,

greg k-h

  reply	other threads:[~2026-09-01  4:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  3:49 [PATCH v2] USB: serial: generic: recover from a stalled bulk-in endpoint Julian Oes
2026-09-01  4:33 ` Greg Kroah-Hartman [this message]
2026-09-01 22:44   ` Julian Oes
2026-09-01  8:28 ` Oliver Neukum
2026-09-01 23:13   ` Julian Oes
2026-09-02  4:42     ` Michal Pecio
2026-09-02  8:40       ` Oliver Neukum
2026-09-02 14:33       ` Alan Stern

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=2026090142-walrus-zipfile-70d1@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=julian@oes.ch \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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