On 07/25/2014 11:01 PM, Hans de Goede wrote: > Lately (with the use of uas / bulk-streams) we have been seeing several > cases where this error triggers (which should never happen). > > Add some extra logging to make debugging these errors easier. > > Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> > --- > drivers/usb/host/xhci-mem.c | 4 +++- > drivers/usb/host/xhci-ring.c | 22 ++++++++++++++++++---- > drivers/usb/host/xhci.h | 6 +++--- > 3 files changed, 24 insertions(+), 8 deletions(-) > > diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c > index 8056d90..26129d3 100644 > --- a/drivers/usb/host/xhci-mem.c > +++ b/drivers/usb/host/xhci-mem.c > @@ -1903,7 +1903,7 @@ static int xhci_test_trb_in_td(struct xhci_hcd *xhci, > start_dma = xhci_trb_virt_to_dma(input_seg, start_trb); > end_dma = xhci_trb_virt_to_dma(input_seg, end_trb); > > - seg = trb_in_td(input_seg, start_trb, end_trb, input_dma); > + seg = trb_in_td(xhci, input_seg, start_trb, end_trb, input_dma, false); > if (seg != result_seg) { > xhci_warn(xhci, "WARN: %s TRB math test %d failed!\n", > test_name, test_number); > @@ -1917,6 +1917,8 @@ static int xhci_test_trb_in_td(struct xhci_hcd *xhci, > end_trb, end_dma); > xhci_warn(xhci, "Expected seg %p, got seg %p\n", > result_seg, seg); > + trb_in_td(xhci, input_seg, start_trb, end_trb, input_dma, > + true); > return -1; > } > return 0; > diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c > index d9b3286..213b28a 100644 > --- a/drivers/usb/host/xhci-ring.c > +++ b/drivers/usb/host/xhci-ring.c > @@ -1718,10 +1718,12 @@ cleanup: > * TRB in this TD, this function returns that TRB's segment. Otherwise it > * returns 0. > */ > -struct xhci_segment *trb_in_td(struct xhci_segment *start_seg, > +struct xhci_segment *trb_in_td(struct xhci_hcd *xhci, > + struct xhci_segment *start_seg, > union xhci_trb *start_trb, > union xhci_trb *end_trb, > - dma_addr_t suspect_dma) > + dma_addr_t suspect_dma, > + bool debug) The added debug information is useful, but I'm not a big fan of the boolean debug function parameter. I get that we only want to print the information when we really expect the trb to be in the TD, and fail. This is a simple way of doing it, but reading the code with lots of true / false function arguments is difficult. (xhci has too many of them already) I haven't got a better solution, all other variants seems to have their own drawbacks. New suggestions are welcome -Mathias -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html