From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Ole Salscheider <ole@salscheider.org>,
Mathias Nyman <mathias.nyman@intel.com>,
linux-usb@vger.kernel.org
Subject: Re: [PATCH] [RFC] xhci: Add Link TRB sync quirk for ASM3142
Date: Wed, 21 Apr 2021 10:28:18 +0300 [thread overview]
Message-ID: <9335fdde-4996-1fe5-42ac-fc70bb98d20c@linux.intel.com> (raw)
In-Reply-To: <c9a18ec2-7fb1-f206-1d27-ce3fa52be762@salscheider.org>
On 19.4.2021 22.05, Ole Salscheider wrote:
> Hi Mathias,
...
>> tracing shows the content of the TRB while it's written, before writing the cycle bit.
>> Could be worth dumping transfer ring after issue is seen and check TRB still looks valid:
>> cat /sys/kernel/debug/usb/xhci/<your controller>/devices/<xx>/ep<yy>/trbs
>> you need to figure out which controller, device and endpoint number for this.
>
> I think this is the output for the correct device and endpoint:
>
> https://stuff.salscheider.org/trbs
Thanks, the TRB was already turned No-op by the cancel code by then, but it doesn't matter,
your trace below indicates the TRB is fine.
>
>> How about your delayed link TRB cycle write patch? did it help trigger an event for the last transfer
>> TRB, or did it just help as controller couldn't go past the link TRB and was less out of sync with
>> the driver?
>
>
> You can find a trace of recording a few seconds of video with my patch here:
>
> https://stuff.salscheider.org/trace_with_patch
>
> As far as I can tell from it, the patch helps to trigger an event for all transfer TRBs. I also tried to record around 30 min of video with it and it did not encounter a problem while recording.
>
> I however cannot start a new recording after stopping the first. And sometimes I observe hangs of the computer some time after stopping the recording. That might be some unwanted side-effect of my patch...
>
Yes, It shows transfer events for the TRBs before the link TRB.
This workaround is however a can of worms as many TD's consist of several TRBs, and they only trigger events for the last TRB.
How about a different approach?
If the issue is only with transfers starting on the last TRB before the link TRB, we could turn that TRB to a no-op.
Does something like the code below help?
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 6cdea0d00d19..0ffda8127640 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3181,6 +3181,12 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
}
}
+ if (ep_ring != xhci->cmd_ring &&
+ !trb_is_link(ep_ring->enqueue) &&
+ trb_is_link(ep_ring->enqueue + 1))
+ queue_trb(xhci, ep_ring, 0, 0, 0, 0,
+ TRB_TYPE(TRB_TR_NOOP) | ep_ring->cycle_state);
+
while (trb_is_link(ep_ring->enqueue)) {
/* If we're not dealing with 0.95 hardware or isoc rings
* on AMD 0.96 host, clear the chain bit.
-Mathias
next prev parent reply other threads:[~2021-04-21 7:26 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
2021-04-19 14:43 ` Mathias Nyman
2021-04-19 19:05 ` Ole Salscheider
2021-04-21 7:28 ` Mathias Nyman [this message]
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=9335fdde-4996-1fe5-42ac-fc70bb98d20c@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=ole@salscheider.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;
as well as URLs for NNTP newsgroup(s).