Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752617AbbBRX7o (ORCPT ); Wed, 18 Feb 2015 18:59:44 -0500 Received: from mga11.intel.com ([192.55.52.93]:49439 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752524AbbBRX7m (ORCPT ); Wed, 18 Feb 2015 18:59:42 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,605,1418112000"; d="scan'208";a="529558023" Message-ID: <1424303960.9530.125.camel@schen9-desk2.jf.intel.com> Subject: Re: [PATCH] pci-dma: Fix x86 dma_alloc_coherent to fully clear all pages returned From: Tim Chen To: Alan Stern Cc: Sergei Shtylyov , Greg Kroah-Hartman , Jiri Slaby , "H. Peter Anvin" , Akinobu Mita , Mathias Nyman , Andi Kleen , Ingo Molnar , Andrew Morton , Marek Szyprowski , Thomas Gleixner , linux-kernel@vger.kernel.org, x86@kernel.org, linux-usb@vger.kernel.org, stable Date: Wed, 18 Feb 2015 15:59:20 -0800 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.8.5 (3.8.5-2.fc19) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1782 Lines: 51 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/