From: Chris Yokum <linux-usb@mail.totalphase.com>
To: Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: Chris Yokum <linux-usb@mail.totalphase.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linux regressions mailing list <regressions@lists.linux.dev>,
stable <stable@vger.kernel.org>,
linux-usb <linux-usb@vger.kernel.org>,
Niklas Neronin <niklas.neronin@linux.intel.com>
Subject: Re: 6.5.0 broke XHCI URB submissions for count >512
Date: Mon, 4 Mar 2024 15:50:58 -0800 (PST) [thread overview]
Message-ID: <717413307.861315.1709596258844.JavaMail.zimbra@totalphase.com> (raw)
In-Reply-To: <3a560c60-ffa2-a511-98d3-d29ef807b213@linux.intel.com>
Hello Mathias,
Yes! This fixed the problem. I've checked with our repro case as well as our functional tests.
I'll email you the repro code directly, you can compare the unpatched and patched kernel behavior.
Best regards,
Chris
----- Original Message -----
From: "Mathias Nyman" <mathias.nyman@linux.intel.com>
To: "Chris Yokum" <linux-usb@mail.totalphase.com>, "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: "Linux regressions mailing list" <regressions@lists.linux.dev>, "stable" <stable@vger.kernel.org>, "linux-usb" <linux-usb@vger.kernel.org>, "Niklas Neronin" <niklas.neronin@linux.intel.com>
Sent: Monday, March 4, 2024 7:53:03 AM
Subject: Re: 6.5.0 broke XHCI URB submissions for count >512
On 4.3.2024 13.57, Mathias Nyman wrote:
> On 2.3.2024 17.55, Chris Yokum wrote:
>>>> We have found a regression bug, where more than 512 URBs cannot be
>>>> reliably submitted to XHCI. URBs beyond that return 0x00 instead of
>>>> valid data in the buffer.
>>>
>>> FWIW, that's f5af638f0609af ("xhci: Fix transfer ring expansion size
>>> calculation") [v6.5-rc1] from Mathias.
>>>
>
> Ok, I see, this could be the empty ring exception check in xhci-ring.c:
>
> It could falsely assume ring is empty when it in fact is filled up in one
> go by queuing several small urbs.
Does this help?
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 6a29ebd6682d..52278afea94b 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -332,7 +332,13 @@ static unsigned int xhci_ring_expansion_needed(struct xhci_hcd *xhci, struct xhc
/* how many trbs will be queued past the enqueue segment? */
trbs_past_seg = enq_used + num_trbs - (TRBS_PER_SEGMENT - 1);
- if (trbs_past_seg <= 0)
+ /*
+ * Consider expanding the ring already if num_trbs fills the current
+ * segment (i.e. trbs_past_seg == 0), not only when num_trbs goes into
+ * the next segment. Avoids confusing full ring with special empty ring
+ * case below
+ */
+ if (trbs_past_seg < 0)
return 0;
Thanks
Mathias
next prev parent reply other threads:[~2024-03-04 23:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <949223224.833962.1709339266739.JavaMail.zimbra@totalphase.com>
[not found] ` <50f3ca53-40e3-41f2-8f7a-7ad07c681eea@leemhuis.info>
2024-03-02 7:14 ` 6.5.0 broke XHCI URB submissions for count >512 Greg Kroah-Hartman
2024-03-02 15:55 ` Chris Yokum
2024-03-04 11:57 ` Mathias Nyman
2024-03-04 15:53 ` Mathias Nyman
2024-03-04 23:50 ` Chris Yokum [this message]
2024-03-11 17:03 ` Chris Yokum
2024-03-12 8:52 ` 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=717413307.861315.1709596258844.JavaMail.zimbra@totalphase.com \
--to=linux-usb@mail.totalphase.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=niklas.neronin@linux.intel.com \
--cc=regressions@lists.linux.dev \
--cc=stable@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;
as well as URLs for NNTP newsgroup(s).