xhci features and fixes for usb-next
Subsystems (3)
cover xhci features and fixes for usb-next
Hi Greg
Some xhci features and fixes for usb-next.
Fixes are late for 5.14 so I'll add them here for 5.15-rc1 instead. They are marked for stable.
Thanks
-Mathias
Mathias Nyman (6):
xhci: fix unsafe memory usage in xhci tracing
xhci: fix even more unsafe memory usage in xhci tracing
xhci: Fix failure to give back some cached cancelled URBs. Revert "USB: xhci: fix U1/U2 handling for hardware with
XHCI_INTEL_HOST quirk set"
xhci: Add additional dynamic debug to follow URBs in cancel and error
cases.
xhci: Add bus number to some debug messages
drivers/usb/host/xhci-debugfs.c | 14 ++++-- drivers/usb/host/xhci-hub.c | 6 ++- drivers/usb/host/xhci-ring.c | 76 +++++++++++++++++++++++---------- drivers/usb/host/xhci-trace.h | 26 ++++++----- drivers/usb/host/xhci.c | 30 +++++++------ drivers/usb/host/xhci.h | 73 ++++++++++++++++--------------- 6 files changed, 134 insertions(+), 91 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/6 xhci: fix unsafe memory usage in xhci tracing
Removes static char buffer usage in the following decode functions:
xhci_decode_trb()
xhci_decode_ptortsc()
Caller must provide a buffer to use.
In tracing use __get_str() as recommended to pass buffer.
Minor chanes are needed in xhci debugfs code as these functions are also used there. Changes include moving XHCI_MSG_MAX definititon from xhci-trace.h to xhci.h
--- drivers/usb/host/xhci-debugfs.c | 6 ++-- drivers/usb/host/xhci-trace.h | 8 ++--- drivers/usb/host/xhci.h | 52 ++++++++++++++++++--------------- 3 files changed, 36 insertions(+), 30 deletions(-)
drivers/usb/host/xhci-debugfs.c +4 -2
@@ -198,12 +198,13 @@ static void xhci_ring_dump_segment(struct seq_file *s,int i;dma_addr_t dma;union xhci_trb *trb; +char str[XHCI_MSG_MAX ];for (i =0 ; i <TRBS_PER_SEGMENT ; i++) { trb = &seg->trbs[i]; dma = seg->dma + i *sizeof (*trb);seq_printf (s,"%pad: %s\n" , &dma, -xhci_decode_trb (le32_to_cpu (trb->generic.field[0 ]), +xhci_decode_trb (str,XHCI_MSG_MAX ,le32_to_cpu (trb->generic.field[0 ]),le32_to_cpu (trb->generic.field[1 ]),le32_to_cpu (trb->generic.field[2 ]),le32_to_cpu (trb->generic.field[3 ])));
@@ -341,9 +342,10 @@ static int xhci_portsc_show(struct seq_file *s, void *unused) {struct xhci_port *port = s->private;u32 portsc; +char str[XHCI_MSG_MAX ]; portsc =readl (port->addr); -seq_printf (s,"%s\n" ,xhci_decode_portsc (portsc)); +seq_printf (s,"%s\n" ,xhci_decode_portsc (str, portsc));return 0 ; }
drivers/usb/host/xhci-trace.h +4 -4
@@ -25,8 +25,6 @@#include "xhci.h" #include "xhci-dbgcap.h" -#define XHCI_MSG_MAX 500 - DECLARE_EVENT_CLASS(xhci_log_msg, TP_PROTO(struct va_format *vaf), TP_ARGS(vaf),
@@ -122,6 +120,7 @@ DECLARE_EVENT_CLASS(xhci_log_trb, __field(u32, field1) __field(u32, field2) __field(u32, field3) +__dynamic_array (char, str,XHCI_MSG_MAX ) ),TP_fast_assign ( __entry->type = ring->type;
@@ -131,7 +130,7 @@ DECLARE_EVENT_CLASS(xhci_log_trb, __entry->field3 =le32_to_cpu (trb->field[3 ]); ),TP_printk ("%s: %s" ,xhci_ring_type_string (__entry->type), -xhci_decode_trb (__entry->field0, __entry->field1, +xhci_decode_trb (__get_str (str),XHCI_MSG_MAX , __entry->field0, __entry->field1, __entry->field2, __entry->field3) ) );
@@ -523,6 +522,7 @@ DECLARE_EVENT_CLASS(xhci_log_portsc,TP_STRUCT__entry (__field (u32 ,portnum )__field (u32, portsc) +__dynamic_array (char, str,XHCI_MSG_MAX ) ),TP_fast_assign ( __entry->portnum = portnum;
@@ -530,7 +530,7 @@ DECLARE_EVENT_CLASS(xhci_log_portsc, ),TP_printk ("port-%d: %s" , __entry->portnum, -xhci_decode_portsc (__entry->portsc) +xhci_decode_portsc (__get_str (str), __entry->portsc) ) );
drivers/usb/host/xhci.h +28 -24
184 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 2/6 xhci: fix even more unsafe memory usage in xhci tracing
In reply to Mathias NymanRemoves static char buffer usage in the following decode functions:
xhci_decode_ctrl_ctx() xhci_decode_slot_context()
xhci_decode_usbsts()
xhci_decode_doorbell()
xhci_decode_ep_context()
Caller must provide a buffer to use.
In tracing use __get_str() as recommended to pass buffer.
Minor changes are needed in other xhci code as these functions are also used elsewhere
--- drivers/usb/host/xhci-debugfs.c | 8 ++++++-- drivers/usb/host/xhci-ring.c | 3 ++- drivers/usb/host/xhci-trace.h | 18 +++++++++++------- drivers/usb/host/xhci.h | 21 ++++++++------------- 4 files changed, 27 insertions(+), 23 deletions(-)
drivers/usb/host/xhci-debugfs.c +6 -2
@@ -261,11 +261,13 @@ static int xhci_slot_context_show(struct seq_file *s, void *unused)struct xhci_slot_ctx *slot_ctx;struct xhci_slot_priv *priv = s->private;struct xhci_virt_device *dev = priv->dev; +char str[XHCI_MSG_MAX ]; xhci =hcd_to_xhci (bus_to_hcd (dev->udev->bus)); slot_ctx =xhci_get_slot_ctx (xhci, dev->out_ctx);seq_printf (s,"%pad: %s\n" , &dev->out_ctx->dma, -xhci_decode_slot_context (le32_to_cpu (slot_ctx->dev_info), +xhci_decode_slot_context (str, +le32_to_cpu (slot_ctx->dev_info),le32_to_cpu (slot_ctx->dev_info2),le32_to_cpu (slot_ctx->tt_info),le32_to_cpu (slot_ctx->dev_state)));
@@ -281,6 +283,7 @@ static int xhci_endpoint_context_show(struct seq_file *s, void *unused)struct xhci_ep_ctx *ep_ctx;struct xhci_slot_priv *priv = s->private;struct xhci_virt_device *dev = priv->dev; +char str[XHCI_MSG_MAX ]; xhci =hcd_to_xhci (bus_to_hcd (dev->udev->bus));
@@ -288,7 +291,8 @@ static int xhci_endpoint_context_show(struct seq_file *s, void *unused) ep_ctx =xhci_get_ep_ctx (xhci, dev->out_ctx, ep_index); dma = dev->out_ctx->dma + (ep_index +1 ) *CTX_SIZE (xhci->hcc_params);seq_printf (s,"%pad: %s\n" , &dma, -xhci_decode_ep_context (le32_to_cpu (ep_ctx->ep_info), +xhci_decode_ep_context (str, +le32_to_cpu (ep_ctx->ep_info),le32_to_cpu (ep_ctx->ep_info2),le64_to_cpu (ep_ctx->deq),le32_to_cpu (ep_ctx->tx_info)));
drivers/usb/host/xhci-ring.c +2 -1
@@ -1212,6 +1212,7 @@ void xhci_stop_endpoint_command_watchdog(struct timer_list *t)struct xhci_hcd *xhci = ep->xhci;unsigned long flags;u32 usbsts; +char str[XHCI_MSG_MAX ];spin_lock_irqsave (&xhci->lock, flags);
@@ -1225,7 +1226,7 @@ void xhci_stop_endpoint_command_watchdog(struct timer_list *t) usbsts =readl (&xhci->op_regs->status);xhci_warn (xhci,"xHCI host not responding to stop endpoint command.\n" ); -xhci_warn (xhci,"USBSTS:%s\n" ,xhci_decode_usbsts (usbsts)); +xhci_warn (xhci,"USBSTS:%s\n" ,xhci_decode_usbsts (str, usbsts)); ep->ep_state &= ~EP_STOP_CMD_PENDING ;
drivers/usb/host/xhci-trace.h +11 -7
@@ -322,6 +322,7 @@ DECLARE_EVENT_CLASS(xhci_log_ep_ctx, __field(u32, info2) __field(u64, deq) __field(u32, tx_info) +__dynamic_array (char, str,XHCI_MSG_MAX ) ),TP_fast_assign ( __entry->info = le32_to_cpu(ctx->ep_info);
@@ -329,8 +330,8 @@ DECLARE_EVENT_CLASS(xhci_log_ep_ctx, __entry->deq =le64_to_cpu (ctx->deq); __entry->tx_info =le32_to_cpu (ctx->tx_info); ), -TP_printk ("%s" ,xhci_decode_ep_context (__entry->info, - __entry->info2, __entry->deq, __entry->tx_info) +TP_printk ("%s" ,xhci_decode_ep_context (__get_str (str), + __entry->info, __entry->info2, __entry->deq, __entry->tx_info) ) );
@@ -367,6 +368,7 @@ DECLARE_EVENT_CLASS(xhci_log_slot_ctx, __field(u32, info2) __field(u32, tt_info) __field(u32, state) +__dynamic_array (char, str,XHCI_MSG_MAX ) ),TP_fast_assign ( __entry->info = le32_to_cpu(ctx->dev_info);
@@ -374,9 +376,9 @@ DECLARE_EVENT_CLASS(xhci_log_slot_ctx, __entry->tt_info =le64_to_cpu (ctx->tt_info); __entry->state =le32_to_cpu (ctx->dev_state); ), -TP_printk ("%s" ,xhci_decode_slot_context (__entry->info, - __entry->info2, __entry->tt_info, - __entry->state) +TP_printk ("%s" ,xhci_decode_slot_context (__get_str (str), + __entry->info, __entry->info2, + __entry->tt_info, __entry->state) ) );
@@ -431,12 +433,13 @@ DECLARE_EVENT_CLASS(xhci_log_ctrl_ctx,TP_STRUCT__entry (__field (u32 ,drop )__field (u32, add) +__dynamic_array (char, str,XHCI_MSG_MAX ) ),TP_fast_assign ( __entry->drop = le32_to_cpu(ctrl_ctx->drop_flags); __entry->add =le32_to_cpu (ctrl_ctx->add_flags); ), -TP_printk ("%s" ,xhci_decode_ctrl_ctx (__entry->drop, __entry->add) +TP_printk ("%s" ,xhci_decode_ctrl_ctx (__get_str (str), __entry->drop, __entry->add) ) );
@@ -555,13 +558,14 @@ DECLARE_EVENT_CLASS(xhci_log_doorbell,TP_STRUCT__entry (__field (u32 ,slot )__field (u32, doorbell) +__dynamic_array (char, str,XHCI_MSG_MAX ) ),TP_fast_assign ( __entry->slot = slot; __entry->doorbell = doorbell; ),TP_printk ("Ring doorbell for %s" , -xhci_decode_doorbell (__entry->slot, __entry->doorbell) +xhci_decode_doorbell (__get_str (str), __entry->slot, __entry->doorbell) ) );
drivers/usb/host/xhci.h +8 -13
@@ -2460,10 +2460,9 @@ static inline const char *xhci_decode_trb(char *str, size_t size,return str; } -static inline const char *xhci_decode_ctrl_ctx (unsigned long drop, -unsigned long add) +static inline const char *xhci_decode_ctrl_ctx (char *str, +unsigned long drop,unsigned long add) { -static char str[1024 ];unsigned int bit;int ret =0 ;
@@ -2489,10 +2488,9 @@ static inline const char *xhci_decode_ctrl_ctx(unsigned long drop,return str; } -static inline const char *xhci_decode_slot_context (u32 info,u32 info2, -u32 tt_info,u32 state) +static inline const char *xhci_decode_slot_context (char *str, +u32 info,u32 info2,u32 tt_info,u32 state) { -static char str[1024 ];u32 speed;u32 hub;u32 mtt;
@@ -2621,9 +2619,8 @@ static inline const char *xhci_decode_portsc(char *str, u32 portsc)return str; } -static inline const char *xhci_decode_usbsts (u32 usbsts) +static inline const char *xhci_decode_usbsts (char *str,u32 usbsts) { -static char str[256 ];int ret =0 ;if (usbsts == ~(u32 )0 )
@@ -2650,9 +2647,8 @@ static inline const char *xhci_decode_usbsts(u32 usbsts)return str; } -static inline const char *xhci_decode_doorbell (u32 slot,u32 doorbell) +static inline const char *xhci_decode_doorbell (char *str,u32 slot,u32 doorbell) { -static char str[256 ];u8 ep;u16 stream;int ret;
@@ -2719,10 +2715,9 @@ static inline const char *xhci_ep_type_string(u8 type) } } -static inline const char *xhci_decode_ep_context (u32 info,u32 info2,u64 deq, -u32 tx_info) +static inline const char *xhci_decode_ep_context (char *str,u32 info, +u32 info2,u64 deq,u32 tx_info) { -static char str[1024 ];int ret;u32 esit;
Signature · 1 line
2.25.1
PATCH 3/6 xhci: Fix failure to give back some cached cancelled URBs.
In reply to Mathias NymanOnly TDs with status TD_CLEARING_CACHE will be given back after cache is cleared with a set TR deq command.
xhci_invalidate_cached_td() failed to set the TD_CLEARING_CACHE status for some cancelled TDs as it assumed an endpoint only needs to clear the TD it stopped on.
This isn't always true. For example with streams enabled an endpoint may have several stream rings, each stopping on a different TDs.
Note that if an endpoint has several stream rings, the current code will still only clear the cache of the stream pointed to by the last cancelled TD in the cancel list.
This patch only focus on making sure all canceled TDs are given back, avoiding hung task after device removal.
Another fix to solve clearing the caches of all stream rings with cancelled TDs is needed, but not as urgent.
This issue was simultanously discovered and debugged by by Tao Wang, with a slightly different fix proposal.
--- drivers/usb/host/xhci-ring.c | 40 ++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 15 deletions(-)
drivers/usb/host/xhci-ring.c +25 -15
@@ -942,17 +942,21 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep) td->urb->stream_id); hw_deq &= ~0xf ; -if (td->cancel_status ==TD_HALTED ) { - cached_td = td; - }else if (trb_in_td (xhci, td->start_seg, td->first_trb, - td->last_trb, hw_deq, false)) { +if (td->cancel_status ==TD_HALTED || +trb_in_td (xhci, td->start_seg, td->first_trb, td->last_trb, hw_deq, false)) {switch (td->cancel_status) {case TD_CLEARED :/* TD is already no-op */ case TD_CLEARING_CACHE :/* set TR deq command already queued */ break ;case TD_DIRTY :/* TD is cached, clear it */ case TD_HALTED : -/* FIXME stream case, several stopped rings */ + td->cancel_status =TD_CLEARING_CACHE ; +if (cached_td) +/* FIXME stream case, several stopped rings */ +xhci_dbg (xhci, +"Move dq past stream %u URB %p instead of stream %u URB %p\n" , + td->urb->stream_id, td->urb, + cached_td->urb->stream_id, cached_td->urb); cached_td = td;break ; }
@@ -961,18 +965,24 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep) td->cancel_status =TD_CLEARED ; } } -if (cached_td) { - cached_td->cancel_status =TD_CLEARING_CACHE ; - err =xhci_move_dequeue_past_td (xhci, slot_id, ep->ep_index, - cached_td->urb->stream_id, - cached_td); -/* Failed to move past cached td, try just setting it noop */ -if (err) { -td_to_noop (xhci, ring, cached_td, false); - cached_td->cancel_status =TD_CLEARED ; +/* If there's no need to move the dequeue pointer then we're done */ +if (!cached_td) +return 0 ; + + err =xhci_move_dequeue_past_td (xhci, slot_id, ep->ep_index, + cached_td->urb->stream_id, + cached_td); +if (err) { +/* Failed to move past cached td, just set cached TDs to no-op */ +list_for_each_entry_safe (td, tmp_td, &ep->cancelled_td_list, cancelled_td_list) { +if (td->cancel_status !=TD_CLEARING_CACHE ) +continue ; +xhci_dbg (xhci,"Failed to clear cancelled cached URB %p, mark clear anyway\n" , + td->urb); +td_to_noop (xhci, ring, td, false); + td->cancel_status =TD_CLEARED ; } - cached_td =NULL ; }return 0 ; }
Signature · 1 line
2.25.1
PATCH 4/6 Revert "USB: xhci: fix U1/U2 handling for hardware with XHCI_INTEL_HOST quirk set"
In reply to Mathias NymanThis reverts commit 5d5323a6f3625f101dbfa94ba3ef7706cce38760.
That commit effectively disabled Intel host initiated U1/U2 lpm for devices with periodic endpoints.
Before that commit we disabled host initiated U1/U2 lpm if the exit latency was larger than any periodic endpoint service interval, this is according to xhci spec xhci 1.1 specification section 4.23.5.2
After that commit we incorrectly checked that service interval was smaller than U1/U2 inactivity timeout. This is not relevant, and can't happen for Intel hosts as previously set U1/U2 timeout = 105% * service interval.
Patch claimed it solved cases where devices can't be enumerated because of bandwidth issues. This might be true but it's a side effect of accidentally turning off lpm.
exit latency calculations have been revised since then
--- drivers/usb/host/xhci.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/usb/host/xhci.c +12 -12
@@ -4705,19 +4705,19 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci, {unsigned long long timeout_ns; -if (xhci->quirks &XHCI_INTEL_HOST ) - timeout_ns =xhci_calculate_intel_u1_timeout (udev, desc); -else - timeout_ns = udev->u1_params.sel; -/* Prevent U1 if service interval is shorter than U1 exit latency */ if (usb_endpoint_xfer_int (desc) ||usb_endpoint_xfer_isoc (desc)) { -if (xhci_service_interval_to_ns (desc) <= timeout_ns) { +if (xhci_service_interval_to_ns (desc) <= udev->u1_params.mel) {dev_dbg (&udev->dev,"Disable U1, ESIT shorter than exit latency\n" );return USB3_LPM_DISABLED ; } } +if (xhci->quirks &XHCI_INTEL_HOST ) + timeout_ns =xhci_calculate_intel_u1_timeout (udev, desc); +else + timeout_ns = udev->u1_params.sel; +/* The U1 timeout is encoded in 1us intervals. * Don't return a timeout of zero, because that's USB3_LPM_DISABLED. */
@@ -4769,19 +4769,19 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci, {unsigned long long timeout_ns; -if (xhci->quirks &XHCI_INTEL_HOST ) - timeout_ns =xhci_calculate_intel_u2_timeout (udev, desc); -else - timeout_ns = udev->u2_params.sel; -/* Prevent U2 if service interval is shorter than U2 exit latency */ if (usb_endpoint_xfer_int (desc) ||usb_endpoint_xfer_isoc (desc)) { -if (xhci_service_interval_to_ns (desc) <= timeout_ns) { +if (xhci_service_interval_to_ns (desc) <= udev->u2_params.mel) {dev_dbg (&udev->dev,"Disable U2, ESIT shorter than exit latency\n" );return USB3_LPM_DISABLED ; } } +if (xhci->quirks &XHCI_INTEL_HOST ) + timeout_ns =xhci_calculate_intel_u2_timeout (udev, desc); +else + timeout_ns = udev->u2_params.sel; +/* The U2 timeout is encoded in 256us intervals */ timeout_ns =DIV_ROUND_UP_ULL (timeout_ns,256 *1000 );/* If the necessary timeout value is bigger than what we can set in the
Signature · 1 line
2.25.1
PATCH 5/6 xhci: Add additional dynamic debug to follow URBs in cancel and error cases.
In reply to Mathias NymanAdd more debugging messages to follow what happends to a URB internally in special cases like URB cancel, halted endpoints and endpoint reset.
Helps tracking issues like URB never given back by host.
--- drivers/usb/host/xhci-ring.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-)
drivers/usb/host/xhci-ring.c +24 -6
@@ -830,9 +830,14 @@ static void xhci_giveback_invalidated_tds(struct xhci_virt_ep *ep) ring =xhci_urb_to_transfer_ring (ep->xhci, td->urb); -if (td->cancel_status ==TD_CLEARED ) +if (td->cancel_status ==TD_CLEARED ) { +xhci_dbg (ep->xhci,"%s: Giveback cancelled URB %p TD\n" , + __func__, td->urb);xhci_td_cleanup (ep->xhci, td, ring, td->status); - + }else { +xhci_dbg (ep->xhci,"%s: Keep cancelled URB %p TD as cancel_status is %d\n" , + __func__, td->urb, td->cancel_status); + }if (ep->xhci->xhc_state &XHCI_STATE_DYING )return ; }
@@ -850,6 +855,10 @@ static int xhci_reset_halted_ep(struct xhci_hcd *xhci, unsigned int slot_id, goto done; } +xhci_dbg (xhci,"%s-reset ep %u, slot %u\n" , + (reset_type ==EP_HARD_RESET ) ?"Hard" :"Soft" , + ep_index, slot_id); + ret =xhci_queue_reset_ep (xhci, command, slot_id, ep_index, reset_type); done:if (ret)
@@ -883,7 +892,8 @@ static int xhci_handle_halted_endpoint(struct xhci_hcd *xhci, }if (ep->ep_state &EP_HALTED ) { -xhci_dbg (xhci,"Reset ep command already pending\n" ); +xhci_dbg (xhci,"Reset ep command for ep_index %d already pending\n" , + ep->ep_index);return 0 ; }
@@ -922,9 +932,10 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep)list_for_each_entry_safe (td, tmp_td, &ep->cancelled_td_list, cancelled_td_list) {xhci_dbg_trace (xhci, trace_xhci_dbg_cancel_urb, -"Removing canceled TD starting at 0x%llx (dma)." , - (unsigned long long )xhci_trb_virt_to_dma ( - td->start_seg, td->first_trb)); +"Removing canceled TD starting at 0x%llx (dma) in stream %u URB %p" , + (unsigned long long )xhci_trb_virt_to_dma ( + td->start_seg, td->first_trb), + td->urb->stream_id, td->urb);list_del_init (&td->td_list); ring =xhci_urb_to_transfer_ring (xhci, td->urb);if (!ring) {
@@ -1079,6 +1090,8 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,return ;case EP_STATE_RUNNING :/* Race, HW handled stop ep cmd before ep was running */ +xhci_dbg (xhci,"Stop ep completion ctx error, ep is running\n" ); + command =xhci_alloc_command (xhci, false,GFP_ATOMIC );if (!command)xhci_stop_watchdog_timer_in_irq (xhci, ep);
@@ -1400,7 +1413,12 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, ep_ring =xhci_urb_to_transfer_ring (ep->xhci, td->urb);if (td->cancel_status ==TD_CLEARING_CACHE ) { td->cancel_status =TD_CLEARED ; +xhci_dbg (ep->xhci,"%s: Giveback cancelled URB %p TD\n" , + __func__, td->urb);xhci_td_cleanup (ep->xhci, td, ep_ring, td->status); + }else { +xhci_dbg (ep->xhci,"%s: Keep cancelled URB %p TD as cancel_status is %d\n" , + __func__, td->urb, td->cancel_status); } } cleanup:
Signature · 1 line
2.25.1
PATCH 6/6 xhci: Add bus number to some debug messages
In reply to Mathias NymanAs we register two usb buses for each xHC, and systems with several hosts are more and more common it is getting hard to follow the flow of debug messages without knowing which bus they belong to
--- drivers/usb/host/xhci-hub.c | 6 ++++-- drivers/usb/host/xhci-ring.c | 3 ++- drivers/usb/host/xhci.c | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-)
drivers/usb/host/xhci-hub.c +4 -2
@@ -1667,7 +1667,8 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) status =1 ; }if (!status && !reset_change) { -xhci_dbg (xhci,"%s: stopping port polling.\n" , __func__); +xhci_dbg (xhci,"%s: stopping usb%d port polling\n" , + __func__, hcd->self.busnum);clear_bit (HCD_FLAG_POLL_RH , &hcd->flags); }spin_unlock_irqrestore (&xhci->lock, flags);
@@ -1699,7 +1700,8 @@ int xhci_bus_suspend(struct usb_hcd *hcd)if (bus_state->resuming_ports ||/* USB2 */ bus_state->port_remote_wakeup) {/* USB3 */ spin_unlock_irqrestore (&xhci->lock, flags); -xhci_dbg (xhci,"suspend failed because a port is resuming\n" ); +xhci_dbg (xhci,"usb%d bus suspend to fail because a port is resuming\n" , + hcd->self.busnum);return -EBUSY ; } }
drivers/usb/host/xhci-ring.c +2 -1
@@ -2031,7 +2031,8 @@ static void handle_port_status(struct xhci_hcd *xhci,* bits are still set. When an event occurs, switch over to * polling to avoid losing status changes. */ -xhci_dbg (xhci,"%s: starting port polling.\n" , __func__); +xhci_dbg (xhci,"%s: starting usb%d port polling.\n" , + __func__, hcd->self.busnum);set_bit (HCD_FLAG_POLL_RH , &hcd->flags);spin_unlock (&xhci->lock);/* Pass this up to the core */
drivers/usb/host/xhci.c +4 -2
@@ -993,7 +993,8 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)xhci_dbc_suspend (xhci);/* Don't poll the roothubs on bus suspend. */ -xhci_dbg (xhci,"%s: stopping port polling.\n" , __func__); +xhci_dbg (xhci,"%s: stopping usb%d port polling.\n" , + __func__, hcd->self.busnum);clear_bit (HCD_FLAG_POLL_RH , &hcd->flags);del_timer_sync (&hcd->rh_timer);clear_bit (HCD_FLAG_POLL_RH , &xhci->shared_hcd->flags);
@@ -1257,7 +1258,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)usb_asmedia_modifyflowcontrol (to_pci_dev (hcd->self.controller));/* Re-enable port polling. */ -xhci_dbg (xhci,"%s: starting port polling.\n" , __func__); +xhci_dbg (xhci,"%s: starting usb%d port polling.\n" , + __func__, hcd->self.busnum);set_bit (HCD_FLAG_POLL_RH , &xhci->shared_hcd->flags);usb_hcd_poll_rh_status (xhci->shared_hcd);set_bit (HCD_FLAG_POLL_RH , &hcd->flags);
Signature · 1 line
2.25.1