From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762965AbbA3T6z (ORCPT ); Fri, 30 Jan 2015 14:58:55 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45887 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753706AbbA3T6y (ORCPT ); Fri, 30 Jan 2015 14:58:54 -0500 Date: Fri, 30 Jan 2015 11:58:53 -0800 From: Greg KH To: Tim Chen Cc: "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 Subject: Re: [PATCH] pci-dma: Fix x86 dma_alloc_coherent to fully clear all pages returned Message-ID: <20150130195853.GA17115@kroah.com> References: <1422647641.9530.2.camel@schen9-desk2.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1422647641.9530.2.camel@schen9-desk2.jf.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 30, 2015 at 11:54:01AM -0800, Tim Chen wrote: > > 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 and froze usb: > > 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. > > Other drivers may have similar issue if it assumes that the pages > allocated are completely zeroed. > > This patch ensures that the pages returned are fully cleared. > > Signed-off-by: Tim Chen > --- > arch/x86/kernel/pci-dma.c | 2 ++ > 1 file changed, 2 insertions(+) > Shouldn't this go to stable trees too? Also, why is the xhci driver not asking for the memory it is going to need? If it wants to use the full page, shouldn't it ask for it? thanks, greg k-h