From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Murphy Date: Wed, 10 Jan 2018 11:59:30 +0000 Subject: Re: [PATCH 20/33] dma-mapping: clear harmful GFP_* flags in common code Message-Id: <27b90341-f9d0-356f-0194-1c7203a3f93e@arm.com> List-Id: References: <20180110080027.13879-1-hch@lst.de> <20180110080027.13879-21-hch@lst.de> In-Reply-To: <20180110080027.13879-21-hch-jcswGhMUV9g@public.gmane.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Christoph Hellwig , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Cc: linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org, linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Guan Xuetao , linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-c6x-dev-jPsnJVOj+W6hPH1hqNUYSQ@public.gmane.org, linux-hexagon-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Konrad Rzeszutek Wilk , linux-snps-arc-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b@public.gmane.org, patches-q3qR2WxjNRFS9aJRtSZj7A@public.gmane.org, linux-metag-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Michal Simek , linux-cris-kernel-VrBV9hrLPhE@public.gmane.org, linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org On 10/01/18 08:00, Christoph Hellwig wrote: [...] > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > index 9f28b2fa329e..88bcb1a8211d 100644 > --- a/include/linux/dma-mapping.h > +++ b/include/linux/dma-mapping.h > @@ -518,6 +518,13 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size, > if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) > return cpu_addr; > > + /* > + * Let the implementation decide on the zone to allocate from, and > + * decide on the way of zeroing the memory given that the memory > + * returned should always be zeroed. > + */ Just a note that if we're all happy to enshrine the "allocations are always zeroed" behaviour in the API (I am too, for the record), we should remember to follow up once the dust settles to update the docs and I guess just #define dma_zalloc_coherent dma_alloc_coherent. Robin. > + flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO); > + > if (!arch_dma_alloc_attrs(&dev, &flag)) > return NULL; > if (!ops->alloc) > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robin Murphy Subject: Re: [PATCH 20/33] dma-mapping: clear harmful GFP_* flags in common code Date: Wed, 10 Jan 2018 11:59:30 +0000 Message-ID: <27b90341-f9d0-356f-0194-1c7203a3f93e@arm.com> References: <20180110080027.13879-1-hch@lst.de> <20180110080027.13879-21-hch@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Cc: linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org, linux-ia64-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Guan Xuetao , linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-c6x-dev-jPsnJVOj+W6hPH1hqNUYSQ@public.gmane.org, linux-hexagon-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Konrad Rzeszutek Wilk , linux-snps-arc-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b@public.gmane.org, patches-q3qR2WxjNRFS9aJRtSZj7A@public.gmane.org, linux-metag-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Michal Simek , linux-cris-kernel-VrBV9hrLPhE@public.gmane.org, linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: Christoph Hellwig , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Return-path: In-Reply-To: <20180110080027.13879-21-hch-jcswGhMUV9g@public.gmane.org> List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org On 10/01/18 08:00, Christoph Hellwig wrote: [...] > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > index 9f28b2fa329e..88bcb1a8211d 100644 > --- a/include/linux/dma-mapping.h > +++ b/include/linux/dma-mapping.h > @@ -518,6 +518,13 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size, > if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) > return cpu_addr; > > + /* > + * Let the implementation decide on the zone to allocate from, and > + * decide on the way of zeroing the memory given that the memory > + * returned should always be zeroed. > + */ Just a note that if we're all happy to enshrine the "allocations are always zeroed" behaviour in the API (I am too, for the record), we should remember to follow up once the dust settles to update the docs and I guess just #define dma_zalloc_coherent dma_alloc_coherent. Robin. > + flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO); > + > if (!arch_dma_alloc_attrs(&dev, &flag)) > return NULL; > if (!ops->alloc) > From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965340AbeAJL7j (ORCPT + 1 other); Wed, 10 Jan 2018 06:59:39 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40796 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965302AbeAJL7g (ORCPT ); Wed, 10 Jan 2018 06:59:36 -0500 Subject: Re: [PATCH 20/33] dma-mapping: clear harmful GFP_* flags in common code To: Christoph Hellwig , iommu@lists.linux-foundation.org Cc: linux-mips@linux-mips.org, linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, Guan Xuetao , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, linux-hexagon@vger.kernel.org, x86@kernel.org, Konrad Rzeszutek Wilk , linux-snps-arc@lists.infradead.org, linux-m68k@lists.linux-m68k.org, patches@groups.riscv.org, linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michal Simek , linux-parisc@vger.kernel.org, linux-cris-kernel@axis.com, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <20180110080027.13879-1-hch@lst.de> <20180110080027.13879-21-hch@lst.de> From: Robin Murphy Message-ID: <27b90341-f9d0-356f-0194-1c7203a3f93e@arm.com> Date: Wed, 10 Jan 2018 11:59:30 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180110080027.13879-21-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 10/01/18 08:00, Christoph Hellwig wrote: [...] > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > index 9f28b2fa329e..88bcb1a8211d 100644 > --- a/include/linux/dma-mapping.h > +++ b/include/linux/dma-mapping.h > @@ -518,6 +518,13 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size, > if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) > return cpu_addr; > > + /* > + * Let the implementation decide on the zone to allocate from, and > + * decide on the way of zeroing the memory given that the memory > + * returned should always be zeroed. > + */ Just a note that if we're all happy to enshrine the "allocations are always zeroed" behaviour in the API (I am too, for the record), we should remember to follow up once the dust settles to update the docs and I guess just #define dma_zalloc_coherent dma_alloc_coherent. Robin. > + flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO); > + > if (!arch_dma_alloc_attrs(&dev, &flag)) > return NULL; > if (!ops->alloc) > From mboxrd@z Thu Jan 1 00:00:00 1970 From: robin.murphy@arm.com (Robin Murphy) Date: Wed, 10 Jan 2018 11:59:30 +0000 Subject: [PATCH 20/33] dma-mapping: clear harmful GFP_* flags in common code In-Reply-To: <20180110080027.13879-21-hch@lst.de> References: <20180110080027.13879-1-hch@lst.de> <20180110080027.13879-21-hch@lst.de> List-ID: Message-ID: <27b90341-f9d0-356f-0194-1c7203a3f93e@arm.com> To: linux-snps-arc@lists.infradead.org On 10/01/18 08:00, Christoph Hellwig wrote: [...] > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > index 9f28b2fa329e..88bcb1a8211d 100644 > --- a/include/linux/dma-mapping.h > +++ b/include/linux/dma-mapping.h > @@ -518,6 +518,13 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size, > if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) > return cpu_addr; > > + /* > + * Let the implementation decide on the zone to allocate from, and > + * decide on the way of zeroing the memory given that the memory > + * returned should always be zeroed. > + */ Just a note that if we're all happy to enshrine the "allocations are always zeroed" behaviour in the API (I am too, for the record), we should remember to follow up once the dust settles to update the docs and I guess just #define dma_zalloc_coherent dma_alloc_coherent. Robin. > + flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO); > + > if (!arch_dma_alloc_attrs(&dev, &flag)) > return NULL; > if (!ops->alloc) > From mboxrd@z Thu Jan 1 00:00:00 1970 From: robin.murphy@arm.com (Robin Murphy) Date: Wed, 10 Jan 2018 11:59:30 +0000 Subject: [PATCH 20/33] dma-mapping: clear harmful GFP_* flags in common code In-Reply-To: <20180110080027.13879-21-hch@lst.de> References: <20180110080027.13879-1-hch@lst.de> <20180110080027.13879-21-hch@lst.de> Message-ID: <27b90341-f9d0-356f-0194-1c7203a3f93e@arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 10/01/18 08:00, Christoph Hellwig wrote: [...] > diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h > index 9f28b2fa329e..88bcb1a8211d 100644 > --- a/include/linux/dma-mapping.h > +++ b/include/linux/dma-mapping.h > @@ -518,6 +518,13 @@ static inline void *dma_alloc_attrs(struct device *dev, size_t size, > if (dma_alloc_from_dev_coherent(dev, size, dma_handle, &cpu_addr)) > return cpu_addr; > > + /* > + * Let the implementation decide on the zone to allocate from, and > + * decide on the way of zeroing the memory given that the memory > + * returned should always be zeroed. > + */ Just a note that if we're all happy to enshrine the "allocations are always zeroed" behaviour in the API (I am too, for the record), we should remember to follow up once the dust settles to update the docs and I guess just #define dma_zalloc_coherent dma_alloc_coherent. Robin. > + flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO); > + > if (!arch_dma_alloc_attrs(&dev, &flag)) > return NULL; > if (!ops->alloc) >