Re: [PATCH] pci-dma: Fix x86 dma_alloc_coherent to fully clear all pages returned
From: Tim Chen
Date: Wed Feb 18 2015 - 18:59:48 EST
On Wed, 2015-02-18 at 15:45 -0500, Alan Stern wrote:
> On Wed, 18 Feb 2015, Tim Chen wrote:
>
> > > Have you tried doing the experiments I suggested in
> > >
> > > http://marc.info/?l=linux-usb&m=142272448620716&w=2
> > >
> > > to determine where the problem occurs?
> > >
> >
> > I was bogged down with other things lately and I haven't got a chance to
> > test that. But as you said, there's very few places where xhci
> > call this memory allocation. So I think the problem has been fairly
> > narrowed down for the XHCI folks.
>
> I disagree. _You_ reported the error. How can you expect other people
> to figure out where it is with no help from you?
>
> I looked briefly at the xhci-hcd DMA allocation code. It does not
> contain any obvious mistakes.
>
> Alan Stern
>
The error and my quick fix is right here. And xhci still needs to be
fixed properly. I'll send out the patch below in a proper patch.
Tim
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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/