[RFC v4 19/19] xhci: add trace for missed periodic transfers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There are situations under which xHC is unable to service an isochronous
endpoint within its service interval. For an IN isoc endpoint, this is the case
when its ring is full, while for an OUT isoc endpoint when its ring is empty.
This patch adds a trace event to the class 'xhci_log_msg', called
'xhci_dbg_missed_periodic_tx', to trace the debug statements related to
missed periodic transfers.

Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
---

Differences from v3:

-make changelog more clear
-add to additional tracepoints

 drivers/usb/host/xhci-ring.c  | 26 ++++++++++++++++----------
 drivers/usb/host/xhci-trace.h |  5 +++++
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 4af43ab..e9912cf 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2488,18 +2488,22 @@ static int handle_tx_event(struct xhci_hcd *xhci,
 		 * a Ring Overrun Event for IN Isoch endpoint or Ring
 		 * Underrun Event for OUT Isoch endpoint.
 		 */
-		xhci_dbg(xhci, "underrun event on endpoint\n");
+		xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx,
+				"underrun event on endpoint");
 		if (!list_empty(&ep_ring->td_list))
-			xhci_dbg(xhci, "Underrun Event for slot %d ep %d "
-					"still with TDs queued?\n",
+			xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx,
+					"Underrun Event for slot %d ep %d "
+					"still with TDs queued?",
 				 TRB_TO_SLOT_ID(le32_to_cpu(event->flags)),
 				 ep_index);
 		goto cleanup;
 	case COMP_OVERRUN:
-		xhci_dbg(xhci, "overrun event on endpoint\n");
+		xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx,
+				"overrun event on endpoint");
 		if (!list_empty(&ep_ring->td_list))
-			xhci_dbg(xhci, "Overrun Event for slot %d ep %d "
-					"still with TDs queued?\n",
+			xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx,
+					"Overrun Event for slot %d ep %d "
+					"still with TDs queued?",
 				 TRB_TO_SLOT_ID(le32_to_cpu(event->flags)),
 				 ep_index);
 		goto cleanup;
@@ -2515,7 +2519,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
 		 * short transfer when process the ep_ring next time.
 		 */
 		ep->skip = true;
-		xhci_dbg(xhci, "Miss service interval error, set skip flag\n");
+		xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx,
+				"Miss service interval error, set skip flag");
 		goto cleanup;
 	default:
 		if (xhci_is_vendor_info_code(xhci, trb_comp_code)) {
@@ -2559,8 +2564,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
 		/* We've skipped all the TDs on the ep ring when ep->skip set */
 		if (ep->skip && td_num == 0) {
 			ep->skip = false;
-			xhci_dbg(xhci, "All tds on the ep_ring skipped. "
-						"Clear skip flag.\n");
+			xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx,
+				"All tds on ep_ring skipped. Clear skip flag.");
 			ret = 0;
 			goto cleanup;
 		}
@@ -2615,7 +2620,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
 			ep_ring->last_td_was_short = false;
 
 		if (ep->skip) {
-			xhci_dbg(xhci, "Found td. Clear skip flag.\n");
+			xhci_dbg_trace(xhci, trace_xhci_dbg_missed_periodic_tx,
+					"Found td. Clear skip flag.");
 			ep->skip = false;
 		}
 
diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h
index 20364cc..c156685 100644
--- a/drivers/usb/host/xhci-trace.h
+++ b/drivers/usb/host/xhci-trace.h
@@ -67,6 +67,11 @@ DEFINE_EVENT(xhci_log_msg, xhci_dbg_ring_expansion,
 	TP_ARGS(vaf)
 );
 
+DEFINE_EVENT(xhci_log_msg, xhci_dbg_missed_periodic_tx,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
 DECLARE_EVENT_CLASS(xhci_log_ctx,
 	TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
 		 unsigned int ep_num),
-- 
1.8.3.4

--
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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux