Skip to content

Commit f444ff2

Browse files
author
Sarah Sharp
committed
xhci: STFU: Be quieter during URB submission and completion.
Unsurprisingly, URBs get submitted and completed a lot in the xHCI driver. If we have to print 10 lines of debug for every URB submitted or completed, then that can cause the whole system to stay in the interrupt handler too long, and can cause Missed Service completion codes for isochronous transfers. Cut down the debugging in the URB submission and completion paths: - Don't squawk about successful transfers, only unsuccessful ones. - Only print the number of bytes transferred if this was a short transfer. - Don't print the endpoint index for successful transfers (will add more debug to failed transfers to show endpoint index there later). - Stop printing MMIO writes. This debugging shows up when the endpoint doorbell is rung a to start a transfer (basically for every URB). - Don't print out the ring enqueue and dequeue pointers - Stop printing when we're pointing to a link TRB. Signed-off-by: Sarah Sharp <[email protected]>
1 parent 5153b7b commit f444ff2

File tree

2 files changed

+15
-37
lines changed

2 files changed

+15
-37
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer
167167
next = ring->dequeue;
168168
}
169169
addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
170-
if (ring == xhci->cmd_ring)
171-
xhci_dbg(xhci, "Command ring deq = 0x%llx (DMA)\n", addr);
172-
else
173-
xhci_dbg(xhci, "Ring deq = 0x%llx (DMA)\n", addr);
174170
}
175171

176172
/*
@@ -246,12 +242,6 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring,
246242
next = ring->enqueue;
247243
}
248244
addr = (unsigned long long) xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue);
249-
if (ring == xhci->event_ring)
250-
xhci_dbg(xhci, "Event ring enq = 0x%llx (DMA)\n", addr);
251-
else if (ring == xhci->cmd_ring)
252-
xhci_dbg(xhci, "Command ring enq = 0x%llx (DMA)\n", addr);
253-
else
254-
xhci_dbg(xhci, "Ring enq = 0x%llx (DMA)\n", addr);
255245
}
256246

257247
/*
@@ -634,13 +624,11 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci,
634624
}
635625
}
636626
usb_hcd_unlink_urb_from_ep(hcd, urb);
637-
xhci_dbg(xhci, "Giveback %s URB %p\n", adjective, urb);
638627

639628
spin_unlock(&xhci->lock);
640629
usb_hcd_giveback_urb(hcd, urb, status);
641630
xhci_urb_free_priv(xhci, urb_priv);
642631
spin_lock(&xhci->lock);
643-
xhci_dbg(xhci, "%s URB given back\n", adjective);
644632
}
645633
}
646634

@@ -1630,7 +1618,6 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td,
16301618
"without IOC set??\n");
16311619
*status = -ESHUTDOWN;
16321620
} else {
1633-
xhci_dbg(xhci, "Successful control transfer!\n");
16341621
*status = 0;
16351622
}
16361623
break;
@@ -1727,7 +1714,6 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
17271714
switch (trb_comp_code) {
17281715
case COMP_SUCCESS:
17291716
frame->status = 0;
1730-
xhci_dbg(xhci, "Successful isoc transfer!\n");
17311717
break;
17321718
case COMP_SHORT_TX:
17331719
frame->status = td->urb->transfer_flags & URB_SHORT_NOT_OK ?
@@ -1837,12 +1823,6 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
18371823
else
18381824
*status = 0;
18391825
} else {
1840-
if (usb_endpoint_xfer_bulk(&td->urb->ep->desc))
1841-
xhci_dbg(xhci, "Successful bulk "
1842-
"transfer!\n");
1843-
else
1844-
xhci_dbg(xhci, "Successful interrupt "
1845-
"transfer!\n");
18461826
*status = 0;
18471827
}
18481828
break;
@@ -1856,11 +1836,12 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
18561836
/* Others already handled above */
18571837
break;
18581838
}
1859-
xhci_dbg(xhci, "ep %#x - asked for %d bytes, "
1860-
"%d bytes untransferred\n",
1861-
td->urb->ep->desc.bEndpointAddress,
1862-
td->urb->transfer_buffer_length,
1863-
TRB_LEN(le32_to_cpu(event->transfer_len)));
1839+
if (trb_comp_code == COMP_SHORT_TX)
1840+
xhci_dbg(xhci, "ep %#x - asked for %d bytes, "
1841+
"%d bytes untransferred\n",
1842+
td->urb->ep->desc.bEndpointAddress,
1843+
td->urb->transfer_buffer_length,
1844+
TRB_LEN(le32_to_cpu(event->transfer_len)));
18641845
/* Fast path - was this the last TRB in the TD for this URB? */
18651846
if (event_trb == td->last_trb) {
18661847
if (TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
@@ -1954,7 +1935,6 @@ static int handle_tx_event(struct xhci_hcd *xhci,
19541935

19551936
/* Endpoint ID is 1 based, our index is zero based */
19561937
ep_index = TRB_TO_EP_ID(le32_to_cpu(event->flags)) - 1;
1957-
xhci_dbg(xhci, "%s - ep index = %d\n", __func__, ep_index);
19581938
ep = &xdev->eps[ep_index];
19591939
ep_ring = xhci_dma_to_transfer_ring(ep, le64_to_cpu(event->buffer));
19601940
ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index);
@@ -2149,9 +2129,15 @@ static int handle_tx_event(struct xhci_hcd *xhci,
21492129
xhci_urb_free_priv(xhci, urb_priv);
21502130

21512131
usb_hcd_unlink_urb_from_ep(bus_to_hcd(urb->dev->bus), urb);
2152-
xhci_dbg(xhci, "Giveback URB %p, len = %d, "
2153-
"status = %d\n",
2154-
urb, urb->actual_length, status);
2132+
if ((urb->actual_length != urb->transfer_buffer_length &&
2133+
(urb->transfer_flags &
2134+
URB_SHORT_NOT_OK)) ||
2135+
status != 0)
2136+
xhci_dbg(xhci, "Giveback URB %p, len = %d, "
2137+
"expected = %x, status = %d\n",
2138+
urb, urb->actual_length,
2139+
urb->transfer_buffer_length,
2140+
status);
21552141
spin_unlock(&xhci->lock);
21562142
usb_hcd_giveback_urb(bus_to_hcd(urb->dev->bus), urb, status);
21572143
spin_lock(&xhci->lock);
@@ -2379,7 +2365,6 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
23792365
u32 ep_state, unsigned int num_trbs, gfp_t mem_flags)
23802366
{
23812367
/* Make sure the endpoint has been added to xHC schedule */
2382-
xhci_dbg(xhci, "Endpoint state = 0x%x\n", ep_state);
23832368
switch (ep_state) {
23842369
case EP_STATE_DISABLED:
23852370
/*
@@ -2416,7 +2401,6 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
24162401
struct xhci_ring *ring = ep_ring;
24172402
union xhci_trb *next;
24182403

2419-
xhci_dbg(xhci, "prepare_ring: pointing to link trb\n");
24202404
next = ring->enqueue;
24212405

24222406
while (last_trb(xhci, ring, ring->enq_seg, next)) {

drivers/usb/host/xhci.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,9 +1338,6 @@ static inline unsigned int xhci_readl(const struct xhci_hcd *xhci,
13381338
static inline void xhci_writel(struct xhci_hcd *xhci,
13391339
const unsigned int val, __le32 __iomem *regs)
13401340
{
1341-
xhci_dbg(xhci,
1342-
"`MEM_WRITE_DWORD(3'b000, 32'h%p, 32'h%0x, 4'hf);\n",
1343-
regs, val);
13441341
writel(val, regs);
13451342
}
13461343

@@ -1368,9 +1365,6 @@ static inline void xhci_write_64(struct xhci_hcd *xhci,
13681365
u32 val_lo = lower_32_bits(val);
13691366
u32 val_hi = upper_32_bits(val);
13701367

1371-
xhci_dbg(xhci,
1372-
"`MEM_WRITE_DWORD(3'b000, 64'h%p, 64'h%0lx, 4'hf);\n",
1373-
regs, (long unsigned int) val);
13741368
writel(val_lo, ptr);
13751369
writel(val_hi, ptr + 1);
13761370
}

0 commit comments

Comments
 (0)