From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vineet Gupta Subject: Re: dma-mapping: clearing GFP_ZERO flag caused crashes of Ethernet on arc/hsdk board. Date: Tue, 27 Mar 2018 11:24:51 -0700 Message-ID: References: <1522170774.2593.9.camel@synopsys.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Andy Shevchenko , hch-jcswGhMUV9g@public.gmane.org Cc: "linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "jesper.nilsson-VrBV9hrLPhE@public.gmane.org" , Alexey Brodkin , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Evgeniy Didin , "linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org" , "iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org" , "geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org" , "dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-snps-arc-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , Eugeniy Paltsev List-Id: linux-arch.vger.kernel.org Hi Christoph, Andy On 03/27/2018 11:11 AM, Andy Shevchenko wrote: > On Tue, Mar 27, 2018 at 8:12 PM, Evgeniy Didin > wrote: >> Hello, >> >> After commit 57bf5a8963f8 ("dma-mapping: clear harmful GFP_* flags in common code") we noticed problems with Ethernet controller on one of our platforms (namely ARC HSDK). >> I >> n particular we see that removal of __GFP_ZERO flag in function dma_alloc_attrs() was the culprit because in our implementation of arc_dma_alloc() we only allocate zeroed pages if >> that flag is explicitly set by the caller. Now with unconditional removal of that flag in dma_alloc_attrs() we allocate non-zeroed pages and that seem to cause problems. >> >> From >> mentioned commit message I may conclude that architectural code is supposed to always allocate zeroed pages but I cannot find any requirement of that in kernel's documentation. >> Coul >> d you please point me to that requirement if that exists at all, then we'll implement a fix in our arch code like that: [snip] > Another question why caller can't ask for zero pages explicitly? Question to whom ? The caller can ask for it - but the problem here is generic dma API code is clearing out GFP_ZERO and expecting arch code to memst unconditionally - is that expected of arch code - and is documented ? That is broken to begin with - arch dma_alloc* simply passes thru gfp flags to page allocator and doesn't muck around with them. We could in theory but doesn't seem like the right thing to do IMO. -Vineet From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:40389 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751202AbeC0SZB (ORCPT ); Tue, 27 Mar 2018 14:25:01 -0400 Subject: Re: dma-mapping: clearing GFP_ZERO flag caused crashes of Ethernet on arc/hsdk board. References: <1522170774.2593.9.camel@synopsys.com> From: Vineet Gupta Message-ID: Date: Tue, 27 Mar 2018 11:24:51 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-arch-owner@vger.kernel.org List-ID: To: Andy Shevchenko , hch@lst.de Cc: Evgeniy Didin , "jesper.nilsson@axis.com" , Alexey Brodkin , "linux-kernel@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "geert@linux-m68k.org" , "dmaengine@vger.kernel.org" , "linux-snps-arc@lists.infradead.org" , Eugeniy Paltsev , "linux-arch@vger.kernel.org" , "linux-mm@kvack.org" Message-ID: <20180327182451.haMGEZZQAvB-7zSNMDxCjlUDZXmbYMoBz8o7QTVXKiU@z> Hi Christoph, Andy On 03/27/2018 11:11 AM, Andy Shevchenko wrote: > On Tue, Mar 27, 2018 at 8:12 PM, Evgeniy Didin > wrote: >> Hello, >> >> After commit 57bf5a8963f8 ("dma-mapping: clear harmful GFP_* flags in common code") we noticed problems with Ethernet controller on one of our platforms (namely ARC HSDK). >> I >> n particular we see that removal of __GFP_ZERO flag in function dma_alloc_attrs() was the culprit because in our implementation of arc_dma_alloc() we only allocate zeroed pages if >> that flag is explicitly set by the caller. Now with unconditional removal of that flag in dma_alloc_attrs() we allocate non-zeroed pages and that seem to cause problems. >> >> From >> mentioned commit message I may conclude that architectural code is supposed to always allocate zeroed pages but I cannot find any requirement of that in kernel's documentation. >> Coul >> d you please point me to that requirement if that exists at all, then we'll implement a fix in our arch code like that: [snip] > Another question why caller can't ask for zero pages explicitly? Question to whom ? The caller can ask for it - but the problem here is generic dma API code is clearing out GFP_ZERO and expecting arch code to memst unconditionally - is that expected of arch code - and is documented ? That is broken to begin with - arch dma_alloc* simply passes thru gfp flags to page allocator and doesn't muck around with them. We could in theory but doesn't seem like the right thing to do IMO. -Vineet