linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ole Salscheider <ole@salscheider.org>
To: Mathias Nyman <mathias.nyman@linux.intel.com>, linux-usb@vger.kernel.org
Cc: Mathias Nyman <mathias.nyman@intel.com>
Subject: Re: [PATCH] [RFC] xhci: Add Link TRB sync quirk for ASM3142
Date: Mon, 19 Apr 2021 12:52:04 +0200	[thread overview]
Message-ID: <a8b56a79-e092-a344-7508-8c22b6568898@salscheider.org> (raw)
In-Reply-To: <5c92dd8c-c8b0-40b5-addb-2df360673462@salscheider.org>

Hi Mathias,

On 16.04.21 17:18, Ole Salscheider wrote:
> Hi Mathias.
> 
> On 16.04.21 14:09, Mathias Nyman wrote:
>> Hi Ole
>>
>> On 16.4.2021 12.37, Ole Salscheider wrote:
>>> This patch adds a quirk to the xhci driver so that link TRBs are only
>>> given to the host controller once it has processed all previous TRBs on
>>> this segment.
>>>
>>> This quirk is necessary for me on an ASMedia ASM3142 host controller.
>>> Without it, I get the following errors when accessing a SuperSpeed UVC
>>> camera:
>>>
>>> Transfer event TRB DMA ptr not part of current TD ep_index XX 
> comp_code XX
>>>
>>> You can find more details in my previous mail about the problem:
>>> https://lkml.org/lkml/2021/3/31/355
>>>
>>> This patch fixes my problem, but it is probably terribly wrong. I am not
>>> even sure if I can rely on handle_tx_event being called before each link
>>> TRB in the segment. Some feedback would be very welcome.
>>
>> I think we need to look at the cause more closely.
>>
>> We normally only get events for the last TRB of a TD, or for short 
> transfers like in your case.
>> So not every transfer TRB generates events.
>>
>> There are several things going on here that combined could cause this.
>>
>> Last transfer TRB of a segment has some alignment requirements which 
> might not be handled in the isoc case.
>> The amount of untransferred data is large, (16388 bytes) so the TRB 
> causing the short packet
>> could be far from the last TRB we expect the event on.
>> Due to new segment and link trb maybe the stored last_trb for this TD 
> is just set wrong
>>
>> Anyway, more detailed traces together with dynamic debug show us more:
>>
>> mount -t debugfs none /sys/kernel/debug
>> echo 'module xhci_hcd =p' >/sys/kernel/debug/dynamic_debug/control
>> echo 'module usbcore =p' >/sys/kernel/debug/dynamic_debug/control
>> echo 81920 > /sys/kernel/debug/tracing/buffer_size_kb
>> echo 1 > /sys/kernel/debug/tracing/events/xhci-hcd/enable
>> < trigger the issue >
>> Send output of dmesg
>> Send content of /sys/kernel/debug/tracing/trace
>>
>> trace accumulates pretty fast so try to copy it as soon as the issue 
> is seen.
> 
> I have uploaded the dmesg output to
> https://stuff.salscheider.org/dmesg_out
> and the trace to
> https://stuff.salscheider.org/trace_out
> 
> With the trace enabled, I did not get the DMA errors. Maybe it slowed 
> down the computer enough. But still the camera stream froze after ~3 
> frames.
> 
> The log contains a recording with ffmpeg that gave a few frames (at 
> second 83), then some where it hung completely. Then I re-plugged the 
> camera and got a few more frames (at second 179) before it hung again.
> 
> I hope this is helpful. If you need a different log please tell me.

I tried it a second time today and now I got the DMA error also when 
tracing was active. You can find the dmesg and trace outputs here:

https://stuff.salscheider.org/dmesg_out2
https://stuff.salscheider.org/trace_out2

Best regards,

Ole

  reply	other threads:[~2021-04-19 10:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-16  9:37 [PATCH] [RFC] xhci: Add Link TRB sync quirk for ASM3142 Ole Salscheider
2021-04-16  9:56 ` Greg KH
2021-04-16 12:09 ` Mathias Nyman
2021-04-16 15:18   ` Ole Salscheider
2021-04-19 10:52     ` Ole Salscheider [this message]
2021-04-19 14:43       ` Mathias Nyman
2021-04-19 19:05         ` Ole Salscheider
2021-04-21  7:28           ` Mathias Nyman
2021-04-21  8:45             ` Ole Salscheider
2021-05-05  7:56               ` Ole Salscheider
2021-05-06  9:08                 ` Mathias Nyman
2021-05-09  0:01                   ` Forest Crossman
2021-05-09  7:31                     ` Ole Salscheider

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=a8b56a79-e092-a344-7508-8c22b6568898@salscheider.org \
    --to=ole@salscheider.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=mathias.nyman@linux.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;
as well as URLs for NNTP newsgroup(s).