From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Michal Pecio <michal.pecio@gmail.com>,
Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2] usb: xhci: Work around the ASM3142 bulk UVC bug
Date: Thu, 3 Dec 2026 14:23:00 +0200 [thread overview]
Message-ID: <c5d7d8e2-3ad1-457b-ac6a-72377b2f9cb7@linux.intel.com> (raw)
In-Reply-To: <20261202113051.7587a314.michal.pecio@gmail.com>
On 12/2/26 12:30, Michal Pecio wrote:
> ASM3142 occasionally generates no event for a single-TRB bulk TD which
> is directly followed by a Link TRB. This affects USB3 UVC devices and
> makes them stop streaming within a few seconds with logs like:
>
> Event dma 0xffe5e000 for ep 6 comp_code 1 not part of TD at ffd0cfe0 - ffd0cfe0
> Event dma 0xffe5e010 for ep 6 comp_code 1 not part of TD at ffd0cfe0 - ffd0cfe0
> Event dma 0xffe5e020 for ep 6 comp_code 1 not part of TD at ffd0cfe0 - ffd0cfe0
> Event dma 0xffe5e030 for ep 6 comp_code 1 not part of TD at ffd0cfe0 - ffd0cfe0
>
> Only one line appears if the Link TRB toggles cycle; it seems that the
> HC fails to toggle its cycle state and stops processing queued TDs, but
> it ignores cycle of the first TRB in the segment and produces an event.
> If subsequent TRBs are stale and match the wrong cycle state, the whole
> ring is executed again - reliably triggered by keeping 2 URBs queued.
>
> Regardless of cycle issues, the first event is always bogus - a canary
> pattern written to the transfer buffer survives, while canary of the TD
> which was passed silently is fully overwritten (short transfers appear
> to mitigate this bug). The link target seems treated as chained to the
> completed prior TD, although no chain bits exist anywhere on the ring.
Could there have a been old chain bit set from previous cycle due to
splitting last TD over the link? Does giving the Link TRB to HW immediately
after the last TRB help? i.e. always call inc_enq_past_link() .
I noticed that the buffer in that last TRB ended at exactly 64k boundary,
and was also max packet aligned. Was this true for all those cases where
event is lost?
>
> The bug doesn't affect drivers that only keep one URB queued at a time,
> even if xhci-hcd is patched to call inc_enq_past_link() after queuing.
> It seems to be triggered by fetching a TRB with current cycle from the
> next segment. Keeping 800 URBs queued in advance and skipping ringing
> the doorbell doesn't help, it looks like an internal race.
>
> Multi-TRB TDs are also affected if they end before a link, but chained
> links in multi-TRB TDs are handled correctly, including cycle toggle.
>
> It seems this can be avoided by ensuring that no TD ends before a link.
> If that's about to happen, insert a No-Op TRB to shift the TD one slot
> forward so that it ends in the next segment. No solution exists yet for
> cases when TD fragment alignment shortens the TD. If we fail to stop
> the bug, prevent execution of stale URBs by adding a No-Op before the
> next TD so that 2nd TRB of the segment can't be stale.
Would force-splitting a TD over the link TRB then be an option?
Requires original 'last' TRB buffer size to be over a max packet.
Thanks
Mathias
prev parent reply other threads:[~2026-12-03 12:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 9:12 [PATCH] usb: xhci: Work around the ASM3142 bulk UVC bug Michal Pecio
2026-12-02 9:21 ` sashiko-bot
2026-12-02 10:30 ` [PATCH v2] " Michal Pecio
2026-12-02 10:39 ` sashiko-bot
2026-12-03 12:23 ` Mathias Nyman [this message]
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=c5d7d8e2-3ad1-457b-ac6a-72377b2f9cb7@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=michal.pecio@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