Re: [V4.0.0-rc3] Xhci Regression: ERROR Transfer event TRB DMA ptr not part of current TD

From: Mathias Nyman
Date: Tue Mar 10 2015 - 14:20:13 EST


On 10.03.2015 19:29, Alan Stern wrote:
> On Tue, 10 Mar 2015, Mathias Nyman wrote:
>
>> Yes, thank you
>>
>> Seems that It wasn't mature enough, I'll revert it.
>>
>> From your logs I can see what went wrong,
>>
>> If you still have some time, could you try out a patch (attached) and see if it solves the
>> issue for you. (on top of clean 4.0-rc3). I can't reproduce it with my own USB DVB-T device
>
> Mathias:
>
> Your patch description says this:
>
>> The endpoint might already processesed some TRBs on the endpiont ring
>> before we soft reset the endpoint.
>> Make sure we set the dequeue pointer to where we were befere soft reset
>
> However, if a driver tries to issue an endpoint reset while there are
> still some URBs queued, it is a bug. Host controller drivers shouldn't
> have to worry about this -- xhci_endpoint_reset() should simply return
> an error if the endpoint ring isn't empty.
>
> I suppose we should check for this in the USB core. I'll write a patch
> and CC: you.
>
> Alan Stern
>

It's possible that there's something in usb core as well,
but I think the following was what happened:

1. First a normal configure endpoint command is issued, it sets endpoint dequeue pointer
to xxx400 = start of ring segment
2. two urbs get queued -> two TDs put on endpoint ring.
3. xhci executes those, ring is in running (idle) state. sw dequeue at xxx430, No TDs queued.
Endpoint dequeue pointer is not written to the endpoint output context as the ring is still
in running state (even if idle, not advancing with no TDs queued) it still shows xxx400
4. -> something happends, xhci_endpoint_reset() is called, we do a new configure endpoint
to 'soft reset' the endpiont, but we copy the dequeue pointer from the old endpoint
output context to the configure endpoint input context, which re-initializes the old
dequeue xxx400 pointer to xhci hardware, and it starts executing the old TDs from the ring.
5. xhci driver notices that we get events for old TRBs that do not belong to the TD the driver
thinks we should be handling

-Mathias
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/