From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Jun Li <jun.li@nxp.com>,
"mathias.nyman@intel.com" <mathias.nyman@intel.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
dl-linux-imx <linux-imx@nxp.com>
Subject: Re: [PATCH v2] usb: xhci: add debugfs support for ep with stream
Date: Mon, 31 Aug 2020 16:11:13 +0300 [thread overview]
Message-ID: <5257ec39-9f59-58fe-661f-a1cd69955f1e@linux.intel.com> (raw)
In-Reply-To: <VE1PR04MB65289D522279DD1267A1FFF5895C0@VE1PR04MB6528.eurprd04.prod.outlook.com>
On 18.8.2020 4.54, Jun Li wrote:
>
>
>> -----Original Message-----
>> From: Mathias Nyman <mathias.nyman@linux.intel.com>
>> Sent: Monday, August 17, 2020 7:48 PM
>> To: Jun Li <jun.li@nxp.com>; mathias.nyman@intel.com
>> Cc: gregkh@linuxfoundation.org; linux-usb@vger.kernel.org; dl-linux-imx
>> <linux-imx@nxp.com>
>> Subject: Re: [PATCH v2] usb: xhci: add debugfs support for ep with stream
>>
>> On 13.8.2020 12.57, Jun Li wrote:
>>> Hi
>>>
>>>> -----Original Message-----
>>>> From: Jun Li <jun.li@nxp.com>
>>>> Sent: Thursday, July 16, 2020 8:40 PM
>>>> To: mathias.nyman@intel.com
>>>> Cc: gregkh@linuxfoundation.org; linux-usb@vger.kernel.org;
>>>> dl-linux-imx <linux-imx@nxp.com>
>>>> Subject: [PATCH v2] usb: xhci: add debugfs support for ep with stream
>>>>
>>>> To show the trb ring of streams, use the exsiting ring files of bulk
>>>> ep to show trb ring of one specific stream ID, which stream ID's trb
>>>> ring will be shown, is controlled by a new debugfs file stream_id,
>>>> this is to avoid to create a large number of dir for every allocate
>>>> stream IDs, another debugfs file stream_context_array is created to show all
>> the allocated stream context array entries.
>>>>
>>>> Signed-off-by: Li Jun <jun.li@nxp.com>
>>>> ---
>>>> chanages for v2:
>>>> - Drop stream files remove, the stream files will be removed
>>>> with ep dir removal, keep the ep but only remove streams
>>>> actually does not make sense in current code.
>>>> - Use the new_ring for show_ring pointer for non-zero ep.
>>>>
>>>> drivers/usb/host/xhci-debugfs.c | 112
>>>> +++++++++++++++++++++++++++++++++++++++-
>>>> drivers/usb/host/xhci-debugfs.h | 10 ++++
>>>> drivers/usb/host/xhci.c | 1 +
>>>> 3 files changed, 122 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/usb/host/xhci-debugfs.c
>>>> b/drivers/usb/host/xhci-debugfs.c index 65d8de4..708585c 100644
>>>> --- a/drivers/usb/host/xhci-debugfs.c
>>>> +++ b/drivers/usb/host/xhci-debugfs.c
>>>> @@ -450,9 +450,14 @@ void xhci_debugfs_create_endpoint(struct xhci_hcd *xhci,
>>>> if (!epriv)
>>>> return;
>>>>
>>>> + if (dev->eps[ep_index].ring)
>>>> + epriv->show_ring = dev->eps[ep_index].ring;
>>>> + else
>>>> + epriv->show_ring = dev->eps[ep_index].new_ring;
>>>> +
Ran some tests and the I suspect the above code causes issues.
If an endpoint is dropped and added back the above code will store the
old ring in epriv->show_ring as we have both a .ring and .new_ring present at
that moment. Soon after this the old ring pointed to by .ring will be freed,
and .ring = .new_ring will be set.
Old code showed whatever ring buffer eps[i].ring pointer pointed to when the
sysfs file was read, (as we saved the address, &eps[i].ring). I see now that
it in theory it had a small gap before .ring = .new_ring was set where user
could read the ring buffer and .ring would still be a NULL pointer.
That needs to be fixed as well.
I still like the old way of using double pointer more.
xhci driver will also dig out the current ring from eps[i].ring, so I think we
should as well.
(in stream case it would be &ep->stream_info->stream_rings[stream_id])
-Mathias
next prev parent reply other threads:[~2020-08-31 13:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 12:08 [PATCH v2] usb: xhci: add debugfs support for ep with stream Li Jun
2020-08-13 9:57 ` Jun Li
2020-08-17 11:48 ` Mathias Nyman
2020-08-18 1:54 ` Jun Li
2020-08-31 13:11 ` Mathias Nyman [this message]
2020-09-02 10:28 ` Jun Li
2020-09-02 12:41 ` Mathias Nyman
2020-09-02 16:00 ` Jun Li
2020-09-03 7:23 ` Mathias Nyman
2020-09-03 7:46 ` Jun Li
2020-09-03 9:38 ` Mathias Nyman
2020-09-04 10:01 ` Jun Li
2020-09-15 9:31 ` 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=5257ec39-9f59-58fe-661f-a1cd69955f1e@linux.intel.com \
--to=mathias.nyman@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jun.li@nxp.com \
--cc=linux-imx@nxp.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;
as well as URLs for NNTP newsgroup(s).