xhci: some hard drives cannot be seen using a JMicron JMS56x enclosure
Subsystems (2)
Hi
Quoted 44 lines · Cyril Roelandt
Hello,
Quoted 10 lines · Mathias Nyman
could you change one flag in the xhci driver and take the same set of logs? It will add more details about the URB and xHC hw position check.
drivers/usb/host/xhci-ring.c +0
-0drivers/usb/host/xhci-ring.c static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id, · line 778
Quoted 8 lines
drivers/usb/host/xhci-ring.c +1
-1@@ -772,7 +772,7 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id, hw_deq &= ~0xf ;if (trb_in_td (xhci, cur_td->start_seg, cur_td->first_trb, - cur_td->last_trb, hw_deq, false)) { + cur_td->last_trb, hw_deq, true)) {xhci_find_new_dequeue_state (xhci, slot_id, ep_index, cur_td->urb->stream_id, cur_td, &deq_state);OK, so I tried this patch on top of 4.13. I'll post the logs at the end of this message.
Quoted 7 lines
Another thing not related to xhci is that the serial number seems to be changing for this device after reset.
This causes the "usb 4-2: device firmware changed" messages, and usb core will try to logically disconnect the device.Can you also plug in and out the device a few times without changing the drives in the enclosure, and check if the serial number really is changing.
This behaviour can be seen on a machine running 4.11 (a version of the kernel with which the enclosure works well):
# dmesg -T | grep "SerialNumber:" [Fri Feb 23 02:43:20 2018] usb 2-2: SerialNumber: RANDOM__7758C4668BE7 [Fri Feb 23 02:43:38 2018] usb 2-2: SerialNumber: RANDOM__D6BA993A16EF [Fri Feb 23 02:43:57 2018] usb 2-2: SerialNumber: RANDOM__DA02D6BA993A [Fri Feb 23 02:55:45 2018] usb 2-2: SerialNumber: RANDOM__BB3BB6A08401
Quoted 3 lines
Thanks for your help, I'm leaving the (huge) logs below. Cyril Roelandt.
Thanks for the logs, They clearly show that there is a issue in getting the position where the second stream stopped.
When reading the stopped position for URB2 on stream 2 we get stream1 position, in fact stream 2 never starts again after this, and when re-reading the stopped position of stream 2 it keeps giving stream 1 position.
One possible cause is that a xhci command accidentally writes a "0" to "Max Primary Streams" while configuring some other endpoint value, this would limit streams to 1. Current tracing has a bug in displaying "Max Primaty streams" and always showed zero.
I have a series of even more custom debugging patches.
attached patches apply on 4.13, but seris for both 4.13 and 4.15 can be found in the streams-debug-4.13 and streams-debug-4.15 branches at
git://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git
https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git
Can I ask you to do take logs with these?
no need for the previous diff, it's included
Thanks
Mathias
From b6dcdf0302e839555e8e1c884c919a3c9d775b92 Mon Sep 17 00:00:00 2001
From: Mathias Nyman <[email protected]>
Date: Mon, 26 Feb 2018 11:07:15 +0200
Subject: [PATCH 3/3] xhci: TEMP DEBUG, add more custom streams debugging
For testing missing stream on uas
--- drivers/usb/host/xhci-ring.c | 15 +++++++++++++-- drivers/usb/host/xhci-trace.h | 5 +++++ 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/usb/host/xhci-ring.c +13 -2
@@ -498,9 +498,20 @@ static u64 xhci_get_hw_deq(struct xhci_hcd *xhci, struct xhci_virt_device *vdev,if (ep->ep_state &EP_HAS_STREAMS ) { st_ctx = &ep->stream_info->stream_ctx_array[stream_id]; -return le64_to_cpu (st_ctx->stream_ring); +xhci_dbg_trace (xhci, trace_xhci_get_hw_deq, +"ep_index %d stream_id %d deq %016llx\n" , + ep_index, + stream_id, +le64_to_cpu (st_ctx->stream_ring)); + +return le64_to_cpu (st_ctx->stream_ring); } ep_ctx =xhci_get_ep_ctx (xhci, vdev->out_ctx, ep_index); +xhci_dbg_trace (xhci, trace_xhci_get_hw_deq, +"ep_index %d No stream, deq %016llx\n" , + ep_index, +le64_to_cpu (ep_ctx->deq)); +return le64_to_cpu (ep_ctx->deq); }
@@ -772,7 +783,7 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id, hw_deq &= ~0xf ;if (trb_in_td (xhci, cur_td->start_seg, cur_td->first_trb, - cur_td->last_trb, hw_deq, false)) { + cur_td->last_trb, hw_deq, true)) {xhci_find_new_dequeue_state (xhci, slot_id, ep_index, cur_td->urb->stream_id, cur_td, &deq_state);
drivers/usb/host/xhci-trace.h +5 -0
@@ -39,6 +39,11 @@ DECLARE_EVENT_CLASS(xhci_log_msg,TP_printk ("%s" ,__get_str (msg)) ); +DEFINE_EVENT (xhci_log_msg, xhci_get_hw_deq, + TP_PROTO(struct va_format *vaf), +TP_ARGS (vaf) +); +DEFINE_EVENT (xhci_log_msg, xhci_dbg_address, TP_PROTO(struct va_format *vaf), TP_ARGS(vaf)
Signature · 1 line
2.7.4