All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
	linux-usb@vger.kernel.org, lukaszx.szulc@intel.com
Subject: usb HC busted?
Date: Thu, 24 May 2018 16:35:34 +0300	[thread overview]
Message-ID: <80eace7a-976d-65a5-a353-54a2b18edd06@linux.intel.com> (raw)

Hi

On 24.05.2018 00:29, Sudip Mukherjee wrote:
> Hi Mathias,
> 
> On Fri, May 18, 2018 at 04:19:02PM +0300, Mathias Nyman wrote:
>> On 18.05.2018 16:04, Sudip Mukherjee wrote:
>>> Hi Mathias,
>>>
>>> On Fri, May 18, 2018 at 03:55:04PM +0300, Mathias Nyman wrote:
>>>> Hi,
>>>>
>>>> Looks like event for Transfer block (TRB) at 0x32a21060 was never completed,
>>>> or at least not handled by xhci driver.
>>>> (either the event was never issued by hw, or something got messed up in the driver along the way)
>>>>
>>>> HC doesn't look busted, it continues sending transfer completions events.
>>>> it is already at event 0x32a211d0, which is 23 TRBS later. (one TRB is 0x10)
>>>>
>>>> This small log sinppet doesnt' say much about the reasons.
>>>>
>>>> Can you enable tracing for xhci and send me the output.
>>>
> We have finally reproduced the error while traces were on. The trace and
> the relevant part of the dmesg (when the error starts) are in:
> https://drive.google.com/open?id=1PbcYwL1a9ndtHw1MNjE6uVqb0fFX9jV8
> 
> Will request you to have a look and suggest what might be going wrong here.
> 

Log show two rings having the same TRB segment dma address, this will completely mess up the transfer:

While allocating rigs the enque pointers for the two rings are the same:

461.859315: xhci_ring_alloc: ISOC efa4e580: enq 0x0000000033386000(0x0000000033386000) deq 0x0000000033386000(0x0000000033386000) segs 2 stream 0 ...bs
461.859320: xhci_ring_alloc: ISOC f0ce1f00: enq 0x0000000033386000(0x0000000033386000) deq 0x0000000033386000(0x0000000033386000) segs 2 stream 0 ...

URBs for ISOC IN transfers are queued on EP3 at enqueue address (33386000 to 33386140)

461.859998: xhci_urb_enqueue: ep3in-isoc: urb f0ec0e00 pipe 4294528 slot 8 length 0/170 sgs 0/0 stream 0 flags 00010302
461.860004: xhci_queue_trb: ISOC: Buffer 000000002b480240 length 17 TD size 0 intr 0 type 'Isoch' flags b:i:I:c:s:I:e:c
461.860006: xhci_inc_enq: ISOC f0ce1f00: enq 0x0000000033386010(0x0000000033386000) deq 0x0000000033386000(0x0000000033386000

Later URBs for ISOC OUT transfers are queued at the same address, this should not happen:

461.901175: xhci_urb_enqueue: ep3out-isoc: urb ecec2600 pipe 100096 slot 8 length 0/51 sgs 0/0 stream 0 flags 00010002
461.901180: xhci_queue_trb: ISOC: Buffer 000000002d9fa805 length 17 TD size 0 intr 0 type 'Isoch' flags b:i:I:c:s:i:e:c
461.901181: xhci_inc_enq: ISOC efa4e580: enq 0x0000000033386010(0x0000000033386000) deq 0x0000000033386000(0x0000000033386000)

So something goes really wrong when allocating or setting up the rings in one of these functions:
xhci_ring_alloc()
xhci_alloc_segments_for_ring()
xhci_initialize_ring_info()
xhci_segment_alloc()
xhci_link_segments()
dma_pool_zalloc()

To verify and rule out dma_pool_zalloc(), could you apply the attached patch and reproduce with new logs?

Thanks
-Mathias

From 7aee4db28204fddff6cbc1534b8d50f13fd0b141 Mon Sep 17 00:00:00 2001
From: Mathias Nyman <mathias.nyman@linux.intel.com>
Date: Thu, 24 May 2018 15:37:41 +0300
Subject: [PATCH] xhci: testpatch, add custom trace for ring segment alloc

for custom debugging only
---
 drivers/usb/host/xhci-mem.c   | 10 ++++++++++
 drivers/usb/host/xhci-trace.h |  5 +++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index e5ace89..7d343ad 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -44,10 +44,15 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci,
 		return NULL;
 	}
 
+	xhci_dbg_trace(xhci,  trace_xhci_ring_mem_detail,
+		       "MATTU xhci_segment_alloc dma @ %pad", &dma);
+
 	if (max_packet) {
 		seg->bounce_buf = kzalloc(max_packet, flags);
 		if (!seg->bounce_buf) {
 			dma_pool_free(xhci->segment_pool, seg->trbs, dma);
+			xhci_dbg_trace(xhci,  trace_xhci_ring_mem_detail,
+				       "MATTU xhci segment free dma @ %pad", &dma);
 			kfree(seg);
 			return NULL;
 		}
@@ -58,6 +63,9 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci,
 			seg->trbs[i].link.control |= cpu_to_le32(TRB_CYCLE);
 	}
 	seg->dma = dma;
+	xhci_dbg_trace(xhci,  trace_xhci_ring_mem_detail,
+		       "MATTU xhci segment alloc seg->dma @ %pad", &seg->dma);
+
 	seg->next = NULL;
 
 	return seg;
@@ -67,6 +75,8 @@ static void xhci_segment_free(struct xhci_hcd *xhci, struct xhci_segment *seg)
 {
 	if (seg->trbs) {
 		dma_pool_free(xhci->segment_pool, seg->trbs, seg->dma);
+		xhci_dbg_trace(xhci,  trace_xhci_ring_mem_detail,
+			       "MATTU xhci segment free seg->dma @ %p", &seg->dma);
 		seg->trbs = NULL;
 	}
 	kfree(seg->bounce_buf);
diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h
index 35bdd06..951e371 100644
--- a/drivers/usb/host/xhci-trace.h
+++ b/drivers/usb/host/xhci-trace.h
@@ -72,6 +72,11 @@ DEFINE_EVENT(xhci_log_msg, xhci_dbg_ring_expansion,
 	TP_ARGS(vaf)
 );
 
+DEFINE_EVENT(xhci_log_msg, xhci_ring_mem_detail,
+	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),
-- 
2.7.4


             reply	other threads:[~2018-05-24 13:35 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180518100650.kfw6wijpncpvqx7j@debian>
     [not found] ` <6790b352-add3-5531-115c-15db6c9c744d@intel.com>
     [not found]   ` <20180518130458.v73syr3fltdzdzzi@debian>
     [not found]     ` <881d576b-c7c1-ef74-c6bc-68b81371e7e0@intel.com>
     [not found]       ` <20180523212956.n4ztasdffg2aeaku@debian>
2018-05-24 13:35         ` Mathias Nyman [this message]
2018-06-04 15:28           ` usb HC busted? Sudip Mukherjee
2018-06-06 14:12             ` Mathias Nyman
2018-06-06 14:12               ` Mathias Nyman
     [not found]               ` <06226ecb-baad-cc36-e9e3-797dabb0aa5e-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-06 15:36                 ` Andy Shevchenko
2018-06-06 15:36                   ` Andy Shevchenko
     [not found]                   ` <42ec4ab07d96b4302b875ac9c5eb76675bf85690.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-06 16:45                     ` Sudip Mukherjee
2018-06-06 16:45                       ` Sudip Mukherjee
2018-06-07  7:40                       ` Mathias Nyman
2018-06-07  7:40                         ` Mathias Nyman
     [not found]                         ` <2e8829c2-850d-6bca-5f0c-58a809dc9499-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-08  9:07                           ` Sudip Mukherjee
2018-06-08  9:07                             ` Sudip Mukherjee
2018-06-21  0:53                           ` Sudip Mukherjee
2018-06-21  0:53                             ` Sudip Mukherjee
2018-06-21 11:01                             ` Mathias Nyman
2018-06-21 11:01                               ` Mathias Nyman
     [not found]                               ` <2b4fe87a-3706-0aa8-2b61-a9c1d1352a7a-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-25 16:15                                 ` Sudip Mukherjee
2018-06-25 16:15                                   ` Sudip Mukherjee
2018-06-27 11:59                                   ` Sudip Mukherjee
2018-06-27 11:59                                     ` Sudip Mukherjee
2018-06-27 12:20                                     ` Sudip Mukherjee
2018-06-27 12:20                                       ` Sudip Mukherjee
2018-06-29 11:41                                     ` Mathias Nyman
2018-06-29 11:41                                       ` Mathias Nyman
     [not found]                                       ` <4b269009-7593-a41f-9f0f-203ee174b52e-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-06-30 21:07                                         ` Sudip Mukherjee
2018-06-30 21:07                                           ` Sudip Mukherjee
2018-07-17 11:41                                           ` Sudip Mukherjee
2018-07-17 11:41                                             ` Sudip Mukherjee
2018-07-17 12:04                                             ` Greg KH
2018-07-17 12:04                                               ` Greg Kroah-Hartman
     [not found]                                               ` <20180717120411.GB28592-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2018-07-17 13:20                                                 ` Sudip Mukherjee
2018-07-17 13:20                                                   ` Sudip Mukherjee
2018-07-17 13:53                                                   ` Greg KH
2018-07-17 13:53                                                     ` Greg Kroah-Hartman
2018-07-17 14:31                                                 ` Alan Stern
2018-07-17 14:31                                                   ` Alan Stern
     [not found]                                                   ` <Pine.LNX.4.44L0.1807171029310.1689-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2018-07-17 15:52                                                     ` Greg KH
2018-07-17 15:52                                                       ` Greg Kroah-Hartman
     [not found]                                                       ` <20180717155259.GB2416-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2018-07-17 15:59                                                         ` Sudip Mukherjee
2018-07-17 15:59                                                           ` Sudip Mukherjee
2018-07-17 17:01                                                           ` Sudip Mukherjee
2018-07-17 17:01                                                             ` Sudip Mukherjee
2018-07-17 14:28                                             ` Alan Stern
2018-07-17 14:28                                               ` Alan Stern
     [not found]                                               ` <Pine.LNX.4.44L0.1807171022001.1689-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2018-07-17 14:40                                                 ` Sudip Mukherjee
2018-07-17 14:40                                                   ` Sudip Mukherjee
2018-07-17 14:49                                                   ` Sudip Mukherjee
2018-07-17 14:49                                                     ` Sudip Mukherjee
2018-07-17 15:08                                                     ` Alan Stern
2018-07-17 15:08                                                       ` Alan Stern
2018-07-17 15:10                                                     ` Sudip Mukherjee
2018-07-17 15:10                                                       ` Sudip Mukherjee
2018-07-19 10:59                                                       ` Mathias Nyman
2018-07-19 10:59                                                         ` Mathias Nyman
     [not found]                                                         ` <f7801c24-fa98-6338-0b26-33a0ac9498bb-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-07-19 11:34                                                           ` Sudip Mukherjee
2018-07-19 11:34                                                             ` Sudip Mukherjee
2018-07-19 15:42                                                             ` Mathias Nyman
2018-07-19 15:42                                                               ` Mathias Nyman
     [not found]                                                               ` <ab814c88-0857-5444-57da-34c21b8d7f6c-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-07-19 17:32                                                                 ` Sudip Mukherjee
2018-07-19 17:32                                                                   ` Sudip Mukherjee
2018-07-20 11:10                                                                   ` Mathias Nyman
2018-07-20 11:10                                                                     ` Mathias Nyman
     [not found]                                                                     ` <d3f5575c-c75b-ea16-6da9-b2fe3cc9c102-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-07-20 12:54                                                                       ` Sudip Mukherjee
2018-07-20 12:54                                                                         ` Sudip Mukherjee
2018-07-21 10:55                                                                         ` Sudip Mukherjee
2018-07-21 10:55                                                                           ` Sudip Mukherjee
2018-07-19 14:57                                                           ` Alan Stern
2018-07-19 14:57                                                             ` Alan Stern
     [not found]                                                             ` <Pine.LNX.4.44L0.1807191046180.1308-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2018-07-20 11:46                                                               ` Mathias Nyman
2018-07-20 11:46                                                                 ` Mathias Nyman
     [not found]                                                                 ` <f8cfa055-cfd8-db66-a386-72bf904e17cd-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2018-07-20 14:09                                                                   ` Alan Stern
2018-07-20 14:09                                                                     ` Alan Stern
2018-06-06 16:42                 ` Sudip Mukherjee
2018-06-06 16:42                   ` Sudip Mukherjee
2018-06-03 19:37 Sudip Mukherjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80eace7a-976d-65a5-a353-54a2b18edd06@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukaszx.szulc@intel.com \
    --cc=mathias.nyman@intel.com \
    --cc=sudipm.mukherjee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.