[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1424306081.9530.137.camel@schen9-desk2.jf.intel.com>
Date: Wed, 18 Feb 2015 16:34:41 -0800
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: Mathias Nyman <mathias.nyman@...ux.intel.com>
Cc: Tim Chen <tim.c.chen@...ux.intel.com>,
Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.cz>, "H. Peter Anvin" <hpa@...or.com>,
Akinobu Mita <akinobu.mita@...il.com>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, x86@...nel.org,
linux-usb@...r.kernel.org, stable <stable@...r.kernel.org>,
Alan Stern <stern@...land.harvard.edu>, ak <ak@...ux.intel.com>
Subject: [PATCH] xhci: use dma_alloc_coherent with fully cleared pages
Commit d92ef66c4f8f ("x86: make dma_alloc_coherent() return zeroed memory
if CMA is enabled") changed the dma_alloc_coherent page clearance from
using an __GFP_ZERO in page allocation to not setting the flag but doing
an explicit memory clear at the end.
However the memory clear only covered the memory size that
was requested, but may not be up to the full extent of the
last page, if the total pages returned exceed the
memory size requested. This behavior has caused problem with XHCI
and caused it to hang:
kernel: xhci_hcd 0000:00:14.0: Stopped the command ring failed, maybe the host is dead
kernel: xhci_hcd 0000:00:14.0: Abort command ring failed
kernel: xhci_hcd 0000:00:14.0: HC died; cleaning up
kernel: xhci_hcd 0000:00:14.0: Error while assigning device slot ID
kernel: xhci_hcd 0000:00:14.0: Max number of devices this xHCI host supports is 64.
This patch reverts xhci the use the old behavior to avoid the hang. XHCI should
do a proper fix to avoid this un-allocated memory.
Signed-off-by: Tim Chen <tim.c.chen@...ux.intel.com>
Cc: <stable@...r.kernel.org> # 3.16+
---
drivers/usb/host/xhci-mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 5cb3d7a..39e7196 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1658,7 +1658,7 @@ static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags)
goto fail_sp;
xhci->scratchpad->sp_array = dma_alloc_coherent(dev,
- num_sp * sizeof(u64),
+ PAGE_ALIGN(num_sp * sizeof(u64)),
&xhci->scratchpad->sp_dma, flags);
if (!xhci->scratchpad->sp_array)
goto fail_sp2;
--
1.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists