All of lore.kernel.org
 help / color / mirror / Atom feed
From: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
To: "hch@lst.de" <hch@lst.de>, "x86@kernel.org" <x86@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"sebott@linux.vnet.ibm.com" <sebott@linux.vnet.ibm.com>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"Evgeniy.Didin@synopsys.com" <Evgeniy.Didin@synopsys.com>,
	"linux-snps-arc@lists.infradead.org"
	<linux-snps-arc@lists.infradead.org>
Subject: Re: [PATCH] dma-mapping: don't clear GFP_ZERO in dma_alloc_attrs
Date: Wed, 28 Mar 2018 15:12:47 +0000	[thread overview]
Message-ID: <1522249966.2593.14.camel@synopsys.com> (raw)
In-Reply-To: <20180328133535.17302-2-hch@lst.de>

Adding linux-snps and linux-arch mailing lists.

> Revert the clearing of __GFP_ZERO in dma_alloc_attrs and move it to
> dma_direct_alloc for now.  While most common architectures always zero dma
> cohereny allocations (and x86 did so since day one) this is not documented
> and at least arc and s390 do not zero without the explicit __GFP_ZERO
> argument.
This patch fixed Ethernet issues on ARC HSDK.
https://www.spinics.net/lists/kernel/msg2762054.html

Tested-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
> Fixes: 57bf5a8963f8 ("dma-mapping: clear harmful GFP_* flags in common code")
> Reported-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
> Reported-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  include/linux/dma-mapping.h | 8 ++------
>  lib/dma-direct.c            | 3 +++
>  2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index eb9eab4ecd6d..12fedcba9a9a 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -518,12 +518,8 @@ 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.
> -	 */
> -	flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO);
> +	/* let the implementation decide on the zone to allocate from: */
> +	flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
> 
>  	if (!arch_dma_alloc_attrs(&dev, &flag))
>  		return NULL;
> diff --git a/lib/dma-direct.c b/lib/dma-direct.c
> index 1277d293d4da..c0bba30fef0a 100644
> --- a/lib/dma-direct.c
> +++ b/lib/dma-direct.c
> @@ -59,6 +59,9 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
>  	struct page *page = NULL;
>  	void *ret;
>  
> +	/* we always manually zero the memory once we are done: */
> +	gfp &= ~__GFP_ZERO;
> +
>  	/* GFP_DMA32 and GFP_DMA are no ops without the corresponding zones: */
>  	if (dev->coherent_dma_mask <= DMA_BIT_MASK(ARCH_ZONE_DMA_BITS))
>  		gfp |= GFP_DMA;

WARNING: multiple messages have this Message-ID
From: Evgeniy Didin <Evgeniy.Didin-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
To: "hch-jcswGhMUV9g@public.gmane.org"
	<hch-jcswGhMUV9g@public.gmane.org>,
	"x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org"
	<x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: "linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"sebott-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org"
	<sebott-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Evgeniy.Didin-HKixBCOQz3hWk0Htik3J/w@public.gmane.org"
	<Evgeniy.Didin-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>,
	"iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"linux-snps-arc-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-snps-arc-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH] dma-mapping: don't clear GFP_ZERO in dma_alloc_attrs
Date: Wed, 28 Mar 2018 15:12:47 +0000	[thread overview]
Message-ID: <1522249966.2593.14.camel@synopsys.com> (raw)
In-Reply-To: <20180328133535.17302-2-hch-jcswGhMUV9g@public.gmane.org>

Adding linux-snps and linux-arch mailing lists.

> Revert the clearing of __GFP_ZERO in dma_alloc_attrs and move it to
> dma_direct_alloc for now.  While most common architectures always zero dma
> cohereny allocations (and x86 did so since day one) this is not documented
> and at least arc and s390 do not zero without the explicit __GFP_ZERO
> argument.
This patch fixed Ethernet issues on ARC HSDK.
https://www.spinics.net/lists/kernel/msg2762054.html

Tested-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
> Fixes: 57bf5a8963f8 ("dma-mapping: clear harmful GFP_* flags in common code")
> Reported-by: Evgeniy Didin <Evgeniy.Didin@synopsys.com>
> Reported-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  include/linux/dma-mapping.h | 8 ++------
>  lib/dma-direct.c            | 3 +++
>  2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index eb9eab4ecd6d..12fedcba9a9a 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -518,12 +518,8 @@ 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.
> -	 */
> -	flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO);
> +	/* let the implementation decide on the zone to allocate from: */
> +	flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
> 
>  	if (!arch_dma_alloc_attrs(&dev, &flag))
>  		return NULL;
> diff --git a/lib/dma-direct.c b/lib/dma-direct.c
> index 1277d293d4da..c0bba30fef0a 100644
> --- a/lib/dma-direct.c
> +++ b/lib/dma-direct.c
> @@ -59,6 +59,9 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
>  	struct page *page = NULL;
>  	void *ret;
>  
> +	/* we always manually zero the memory once we are done: */
> +	gfp &= ~__GFP_ZERO;
> +
>  	/* GFP_DMA32 and GFP_DMA are no ops without the corresponding zones: */
>  	if (dev->coherent_dma_mask <= DMA_BIT_MASK(ARCH_ZONE_DMA_BITS))
>  		gfp |= GFP_DMA;
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID
From: Evgeniy.Didin@synopsys.com (Evgeniy Didin)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH] dma-mapping: don't clear GFP_ZERO in dma_alloc_attrs
Date: Wed, 28 Mar 2018 15:12:47 +0000	[thread overview]
Message-ID: <1522249966.2593.14.camel@synopsys.com> (raw)
In-Reply-To: <20180328133535.17302-2-hch@lst.de>

Adding linux-snps and linux-arch mailing lists.

> Revert the clearing of __GFP_ZERO in dma_alloc_attrs and move it to
> dma_direct_alloc for now.??While most common architectures always zero dma
> cohereny allocations (and x86 did so since day one) this is not documented
> and at least arc and s390 do not zero without the explicit __GFP_ZERO
> argument.
This patch fixed Ethernet issues on ARC HSDK.
https://www.spinics.net/lists/kernel/msg2762054.html

Tested-by: Evgeniy Didin <Evgeniy.Didin at synopsys.com>
> Fixes: 57bf5a8963f8 ("dma-mapping: clear harmful GFP_* flags in common code")
> Reported-by: Evgeniy Didin <Evgeniy.Didin at synopsys.com>
> Reported-by: Sebastian Ott <sebott at linux.vnet.ibm.com>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
> ?include/linux/dma-mapping.h | 8 ++------
> ?lib/dma-direct.c????????????| 3 +++
> ?2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index eb9eab4ecd6d..12fedcba9a9a 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -518,12 +518,8 @@ 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.
> -	?*/
> -	flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM | __GFP_ZERO);
> +	/* let the implementation decide on the zone to allocate from: */
> +	flag &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
> 
> ?	if (!arch_dma_alloc_attrs(&dev, &flag))
> ?		return NULL;
> diff --git a/lib/dma-direct.c b/lib/dma-direct.c
> index 1277d293d4da..c0bba30fef0a 100644
> --- a/lib/dma-direct.c
> +++ b/lib/dma-direct.c
> @@ -59,6 +59,9 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
> ?	struct page *page = NULL;
> ?	void *ret;
> ?
> +	/* we always manually zero the memory once we are done: */
> +	gfp &= ~__GFP_ZERO;
> +
> ?	/* GFP_DMA32 and GFP_DMA are no ops without the corresponding zones: */
> ?	if (dev->coherent_dma_mask <= DMA_BIT_MASK(ARCH_ZONE_DMA_BITS))
> ?		gfp |= GFP_DMA;

  reply	other threads:[~2018-03-28 15:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-28 13:35 tip/x86/dma fix for arc and s390 (at least) Christoph Hellwig
2018-03-28 13:35 ` Christoph Hellwig
2018-03-28 13:35 ` [PATCH] dma-mapping: don't clear GFP_ZERO in dma_alloc_attrs Christoph Hellwig
2018-03-28 13:35   ` Christoph Hellwig
2018-03-28 15:12   ` Evgeniy Didin [this message]
2018-03-28 15:12     ` Evgeniy Didin
2018-03-28 15:12     ` Evgeniy Didin
2018-04-09 10:52     ` dma-mapping: clear harmful GFP_* flags in common code Alexey Brodkin
2018-04-09 10:52       ` Alexey Brodkin
2018-04-09 10:52       ` Alexey Brodkin
2018-03-28 15:40   ` [tip:x86/dma] dma-mapping: Don't clear GFP_ZERO in dma_alloc_attrs tip-bot for Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1522249966.2593.14.camel@synopsys.com \
    --to=evgeniy.didin@synopsys.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=sebott@linux.vnet.ibm.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.