]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xhci: Don't trace ring at every enqueue or dequeue increase
authorMathias Nyman <mathias.nyman@linux.intel.com>
Wed, 6 Nov 2024 10:14:32 +0000 (12:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Nov 2024 12:26:14 +0000 (13:26 +0100)
Don't trace ring pointers every time driver increases enqueue pointer
after queuing a TRB, or dequeue pointer after handling an event.

These xhci_inc_deq: and xhci_inc_enq: trace entries fill up the trace and
provides little useful info now that the TRB DMA address is printed with
the TRB itself.

Only trace ring during xhci_inc_enq() and xhci_inc_deq() in case we move
to a new ring segment.

Also don't show both segment and TRB addess in trace.
Segment is just TRB with 0xfff masked off.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20241106101459.775897-7-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci-trace.h

index 3c19f58fcefd7e9d30816cfd691eed1fa20a6954..f7f7b0a818f8736e927656e7e2781bef6f1635b8 100644 (file)
@@ -167,13 +167,16 @@ void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring)
        if (ring->type == TYPE_EVENT) {
                if (!last_trb_on_seg(ring->deq_seg, ring->dequeue)) {
                        ring->dequeue++;
-                       goto out;
+                       return;
                }
                if (last_trb_on_ring(ring, ring->deq_seg, ring->dequeue))
                        ring->cycle_state ^= 1;
                ring->deq_seg = ring->deq_seg->next;
                ring->dequeue = ring->deq_seg->trbs;
-               goto out;
+
+               trace_xhci_inc_deq(ring);
+
+               return;
        }
 
        /* All other rings have link trbs */
@@ -188,14 +191,13 @@ void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring)
                ring->deq_seg = ring->deq_seg->next;
                ring->dequeue = ring->deq_seg->trbs;
 
+               trace_xhci_inc_deq(ring);
+
                if (link_trb_count++ > ring->num_segs) {
                        xhci_warn(xhci, "Ring is an endless link TRB loop\n");
                        break;
                }
        }
-out:
-       trace_xhci_inc_deq(ring);
-
        return;
 }
 
@@ -264,13 +266,13 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring,
                ring->enqueue = ring->enq_seg->trbs;
                next = ring->enqueue;
 
+               trace_xhci_inc_enq(ring);
+
                if (link_trb_count++ > ring->num_segs) {
                        xhci_warn(xhci, "%s: Ring link TRB loop\n", __func__);
                        break;
                }
        }
-
-       trace_xhci_inc_enq(ring);
 }
 
 /*
index cc916e58a3295415200e17917120ccb386a54767..57b8cb5a8d19788709bc398e4a7db69014128789 100644 (file)
@@ -458,8 +458,6 @@ DECLARE_EVENT_CLASS(xhci_log_ring,
                __field(void *, ring)
                __field(dma_addr_t, enq)
                __field(dma_addr_t, deq)
-               __field(dma_addr_t, enq_seg)
-               __field(dma_addr_t, deq_seg)
                __field(unsigned int, num_segs)
                __field(unsigned int, stream_id)
                __field(unsigned int, cycle_state)
@@ -470,17 +468,15 @@ DECLARE_EVENT_CLASS(xhci_log_ring,
                __entry->type = ring->type;
                __entry->num_segs = ring->num_segs;
                __entry->stream_id = ring->stream_id;
-               __entry->enq_seg = ring->enq_seg->dma;
-               __entry->deq_seg = ring->deq_seg->dma;
                __entry->cycle_state = ring->cycle_state;
                __entry->bounce_buf_len = ring->bounce_buf_len;
                __entry->enq = xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue);
                __entry->deq = xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
        ),
-       TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d bounce %d cycle %d",
+       TP_printk("%s %p: enq %pad deq %pad segs %d stream %d bounce %d cycle %d",
                        xhci_ring_type_string(__entry->type), __entry->ring,
-                       &__entry->enq, &__entry->enq_seg,
-                       &__entry->deq, &__entry->deq_seg,
+                       &__entry->enq,
+                       &__entry->deq,
                        __entry->num_segs,
                        __entry->stream_id,
                        __entry->bounce_buf_len,