public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michał Pecio" <michal.pecio@gmail.com>
To: linux-usb@vger.kernel.org
Cc: Mathias Nyman <mathias.nyman@intel.com>
Subject: Re: "Transfer event TRB DMA ptr not part of current TD" spam after USB disconnection
Date: Sat, 13 Jan 2024 21:47:57 +0100	[thread overview]
Message-ID: <20240113214757.3f658913@foxbook> (raw)
In-Reply-To: <20240112235205.1259f60c@foxbook>

CC'ing XHCI driver maintainer.

> Disconnecting a high- or super-speed UVC camera from USB 3.0 port
> during recording prints a lot of these errors.

I made progress on this issue and I know what happens, I only don't
know whose fault it is and what the proper solution should be.


The host controller, in case it's a hardware bug:
NEC Corporation uPD720200 USB 3.0 Host Controller [1033:0194] (rev 03)


And this is what happens when errors appear on a running isoch EP.
I added debug code which traces execution and prints full contents of
the failing TRBs.


# errors in single TDs at offsets 3c0 and 3d0 are dealt with cleanly

[ 8350.611162] xhci_hcd 0000:02:00.0: handle_tx_event: ep_trb_dma 108b043c0 comp_code 4
[ 8350.611166] xhci_hcd 0000:02:00.0: dump first TRB: 108b043c0 -> 000000010986e6a0 0004099c 80001424
[ 8350.611168] xhci_hcd 0000:02:00.0: dump last TRB:  108b043c0 -> 000000010986e6a0 0004099c 80001424
[ 8350.611171] xhci_hcd 0000:02:00.0: process_isoc_td comp_code 4 last_in_td 1
[ 8350.611172] xhci_hcd 0000:02:00.0: finish_td: comp_code 4

[ 8350.611287] xhci_hcd 0000:02:00.0: handle_tx_event: ep_trb_dma 108b043d0 comp_code 4
[ 8350.611291] xhci_hcd 0000:02:00.0: dump first TRB: 108b043d0 -> 000000010986f03c 0004099c 80001424
[ 8350.611293] xhci_hcd 0000:02:00.0: dump last TRB:  108b043d0 -> 000000010986f03c 0004099c 80001424
[ 8350.611295] xhci_hcd 0000:02:00.0: process_isoc_td comp_code 4 last_in_td 1
[ 8350.611297] xhci_hcd 0000:02:00.0: finish_td: comp_code 4

# then a chained TD appears at 3e0 and 3f0 and signals an error at 3e0

[ 8350.611412] xhci_hcd 0000:02:00.0: handle_tx_event: ep_trb_dma 108b043e0 comp_code 4
[ 8350.611416] xhci_hcd 0000:02:00.0: dump first TRB: 108b043e0 -> 000000010986f9d8 00040628 80001414
[ 8350.611418] xhci_hcd 0000:02:00.0: dump last TRB:  108b043f0 -> 0000000109870000 00000374 00000424
[ 8350.611421] xhci_hcd 0000:02:00.0: process_isoc_td comp_code 4 last_in_td 0

# process_isoc_td found that it isn't the last TRB in this TD and didn't call finish_td
# the driver still waits for 3f0 completion, but 400 arrives instead

[ 8350.611536] xhci_hcd 0000:02:00.0: handle_tx_event: ep_trb_dma 108b04400 comp_code 4
[ 8350.611540] xhci_hcd 0000:02:00.0: ERROR Transfer event TRB DMA ptr not part of current TD ep_index 2 comp_code 4

# now everything is out of sync and the last message repeats ad nauseam


To my layman eye the chained TD looks OK (and has the right total size
of 0x99c). So the question is if the hardware is right to signal failure
on the first TRD only, and how the driver should handle it?


Thanks,
Michal

  reply	other threads:[~2024-01-13 20:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-12 22:52 "Transfer event TRB DMA ptr not part of current TD" spam after USB disconnection Michał Pecio
2024-01-13 20:47 ` Michał Pecio [this message]
2024-01-14 14:06   ` Michał Pecio
2024-01-15 13:58     ` Mathias Nyman
2024-01-15 16:27       ` Michał Pecio
2024-01-16 15:36         ` [RFT PATCH] xhci: process isoc TD properly when there was an error mid TD Mathias Nyman
2024-01-16 22:20           ` Michał Pecio
2024-01-17 10:46             ` Mathias Nyman
2024-01-17 17:49               ` Michał Pecio
2024-01-18 11:00                 ` Isochronous error handling bug on VIA VL805 Michał Pecio
2024-01-18 11:10                   ` Michał Pecio
2024-01-18 13:54                   ` Mathias Nyman
2024-01-18 13:56                     ` [RFT PATCH v2] xhci: process isoc TD properly when there was an error mid TD Mathias Nyman
2024-01-18 22:16                       ` Michał Pecio
2024-01-19 10:49                         ` Mathias Nyman
2024-01-19 10:58                           ` [RTF PATCH v3] " Mathias Nyman
2024-01-19 21:54                             ` Michał Pecio
2024-01-22  9:03                               ` Michał Pecio
2024-01-22 13:37                                 ` Mathias Nyman
2024-01-22 17:10                                   ` Michał Pecio
2024-01-22 11:47                               ` Mathias Nyman

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=20240113214757.3f658913@foxbook \
    --to=michal.pecio@gmail.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.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