Hi, On 12/29/2016 07:01 PM, Felipe Balbi wrote: > These three new tracers will help us tie TRBs into URBs by *also* > looking into URB lifetime. I didn't see anything related to TRBs in the patch. Anything I missed? > > Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx> > --- > drivers/usb/host/xhci-ring.c | 1 + > drivers/usb/host/xhci-trace.h | 70 +++++++++++++++++++++++++++++++++++++++++++ > drivers/usb/host/xhci.c | 5 ++++ > 3 files changed, 76 insertions(+) > > diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c > index 0ee7d358b812..1431e0651e78 100644 > --- a/drivers/usb/host/xhci-ring.c > +++ b/drivers/usb/host/xhci-ring.c > @@ -627,6 +627,7 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci, > usb_hcd_unlink_urb_from_ep(hcd, urb); > spin_unlock(&xhci->lock); > usb_hcd_giveback_urb(hcd, urb, status); > + trace_xhci_urb_giveback(urb); There is another trace point in xhci_urb_dequeue(). diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index b49588f..ee46877 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1535,6 +1535,7 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) usb_hcd_unlink_urb_from_ep(hcd, urb); spin_unlock_irqrestore(&xhci->lock, flags); + trace_xhci_urb_giveback(urb); usb_hcd_giveback_urb(hcd, urb, -ESHUTDOWN); xhci_urb_free_priv(urb_priv); return ret; > spin_lock(&xhci->lock); > } > > diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h > index d01524b9fb14..4bad0d6d2c8a 100644 > --- a/drivers/usb/host/xhci-trace.h > +++ b/drivers/usb/host/xhci-trace.h > @@ -158,6 +158,76 @@ DEFINE_EVENT(xhci_log_trb, xhci_queue_trb, > TP_ARGS(ring, trb) > ); > > +DECLARE_EVENT_CLASS(xhci_log_urb, > + TP_PROTO(struct urb *urb), > + TP_ARGS(urb), > + TP_STRUCT__entry( > + __field(void *, urb) > + __field(unsigned int, pipe) > + __field(unsigned int, stream) > + __field(int, status) > + __field(unsigned int, flags) > + __field(int, num_mapped_sgs) > + __field(int, num_sgs) > + __field(int, length) > + __field(int, actual) > + __field(int, epnum) > + __field(int, dir_in) > + __field(int, type) > + ), > + TP_fast_assign( > + __entry->urb = urb; > + __entry->pipe = urb->pipe; > + __entry->stream = urb->stream_id; > + __entry->status = urb->status; > + __entry->flags = urb->transfer_flags; > + __entry->num_mapped_sgs = urb->num_mapped_sgs; > + __entry->num_sgs = urb->num_sgs; > + __entry->length = urb->transfer_buffer_length; > + __entry->actual = urb->actual_length; > + __entry->epnum = usb_endpoint_num(&urb->ep->desc); > + __entry->dir_in = usb_endpoint_dir_in(&urb->ep->desc); > + __entry->type = usb_endpoint_type(&urb->ep->desc); > + ), > + TP_printk("ep%d%s-%s: urb %p pipe %u length %d/%d sgs %d/%d stream %d flags %08x", > + __entry->epnum, __entry->dir_in ? "in" : "out", > + ({ char *s; > + switch (__entry->type) { > + case USB_ENDPOINT_XFER_INT: > + s = "intr"; > + break; > + case USB_ENDPOINT_XFER_CONTROL: > + s = "control"; > + break; > + case USB_ENDPOINT_XFER_BULK: > + s = "bulk"; > + break; > + case USB_ENDPOINT_XFER_ISOC: > + s = "isoc"; > + break; > + default: > + s = "UNKNOWN"; > + } s; }), __entry->urb, __entry->pipe, __entry->actual, > + __entry->length, __entry->num_mapped_sgs, > + __entry->num_sgs, __entry->stream, __entry->flags > + ) > +); > + > +DEFINE_EVENT(xhci_log_urb, xhci_urb_enqueue, > + TP_PROTO(struct urb *urb), > + TP_ARGS(urb) > +); > + > +DEFINE_EVENT(xhci_log_urb, xhci_urb_giveback, > + TP_PROTO(struct urb *urb), > + TP_ARGS(urb) > +); > + > +DEFINE_EVENT(xhci_log_urb, xhci_urb_dequeue, > + TP_PROTO(struct urb *urb), > + TP_ARGS(urb) > +); > + > #endif /* __XHCI_TRACE_H */ > > /* this part must be outside header guard */ > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c > index 06d294d7e01f..c0f3670e5a51 100644 > --- a/drivers/usb/host/xhci.c > +++ b/drivers/usb/host/xhci.c > @@ -1383,6 +1383,8 @@ int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags) > urb_priv->td_cnt = 0; > urb->hcpriv = urb_priv; > > + trace_xhci_urb_enqueue(urb); > + > if (usb_endpoint_xfer_control(&urb->ep->desc)) { > /* Check to see if the max packet size for the default control > * endpoint changed during FS device enumeration > @@ -1509,6 +1511,9 @@ int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) > > xhci = hcd_to_xhci(hcd); > spin_lock_irqsave(&xhci->lock, flags); > + > + trace_xhci_urb_dequeue(urb); > + > /* Make sure the URB hasn't completed or been unlinked already */ > ret = usb_hcd_check_unlink_urb(hcd, urb, status); > if (ret || !urb->hcpriv) Best regards, Lu Baolu -- 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