All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
@ 2023-05-28 14:11 Christophe JAILLET
  2023-05-30 15:36 ` Dave Jiang
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Christophe JAILLET @ 2023-05-28 14:11 UTC (permalink / raw)
  To: Fenghua Yu, Dave Jiang, Vinod Koul
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, dmaengine

dma_alloc_coherent() already clear the allocated memory, there is no need
to explicitly call memset().

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/dma/idxd/device.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 5abbcc61c528..7c74bc60f582 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -786,8 +786,6 @@ static int idxd_device_evl_setup(struct idxd_device *idxd)
 		goto err_alloc;
 	}
 
-	memset(addr, 0, size);
-
 	spin_lock(&evl->lock);
 	evl->log = addr;
 	evl->dma = dma_addr;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
  2023-05-28 14:11 [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call Christophe JAILLET
@ 2023-05-30 15:36 ` Dave Jiang
  2023-05-30 15:51 ` Fenghua Yu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Dave Jiang @ 2023-05-30 15:36 UTC (permalink / raw)
  To: Christophe JAILLET, Fenghua Yu, Vinod Koul
  Cc: linux-kernel, kernel-janitors, dmaengine


On 5/28/23 07:11, Christophe JAILLET wrote:
> dma_alloc_coherent() already clear the allocated memory, there is no need
> to explicitly call memset().
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Dave Jiang <dave.jiang@intel.com>
> ---
>   drivers/dma/idxd/device.c | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index 5abbcc61c528..7c74bc60f582 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -786,8 +786,6 @@ static int idxd_device_evl_setup(struct idxd_device *idxd)
>   		goto err_alloc;
>   	}
>   
> -	memset(addr, 0, size);
> -
>   	spin_lock(&evl->lock);
>   	evl->log = addr;
>   	evl->dma = dma_addr;

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
  2023-05-28 14:11 [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call Christophe JAILLET
  2023-05-30 15:36 ` Dave Jiang
@ 2023-05-30 15:51 ` Fenghua Yu
  2023-05-30 15:54 ` Bernd Petrovitsch
  2023-07-11 16:44 ` Vinod Koul
  3 siblings, 0 replies; 9+ messages in thread
From: Fenghua Yu @ 2023-05-30 15:51 UTC (permalink / raw)
  To: Christophe JAILLET, Dave Jiang, Vinod Koul
  Cc: linux-kernel, kernel-janitors, dmaengine



On 5/28/23 07:11, Christophe JAILLET wrote:
> dma_alloc_coherent() already clear the allocated memory, there is no need
> to explicitly call memset().
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Fenghua Yu <fenghua.yu@intel.com>

Thanks.

-Fenghua

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
  2023-05-28 14:11 [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call Christophe JAILLET
  2023-05-30 15:36 ` Dave Jiang
  2023-05-30 15:51 ` Fenghua Yu
@ 2023-05-30 15:54 ` Bernd Petrovitsch
  2023-05-30 18:46   ` Christophe JAILLET
  2023-07-11 16:44 ` Vinod Koul
  3 siblings, 1 reply; 9+ messages in thread
From: Bernd Petrovitsch @ 2023-05-30 15:54 UTC (permalink / raw)
  To: Christophe JAILLET, Fenghua Yu, Dave Jiang, Vinod Koul
  Cc: linux-kernel, kernel-janitors, dmaengine

On 28/05/2023 16:11, Christophe JAILLET wrote:
> dma_alloc_coherent() already clear the allocated memory, there is no need
> to explicitly call memset().

Hmm, so wouldn't be dma_zalloc_coherent() a better name for the function?

Kind regards,
	Bernd
-- 
Bernd Petrovitsch                  Email : bernd@petrovitsch.priv.at
      There is NO CLOUD, just other people's computers. - FSFE
                      LUGA : http://www.luga.at


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
  2023-05-30 15:54 ` Bernd Petrovitsch
@ 2023-05-30 18:46   ` Christophe JAILLET
  0 siblings, 0 replies; 9+ messages in thread
From: Christophe JAILLET @ 2023-05-30 18:46 UTC (permalink / raw)
  To: Bernd Petrovitsch, Fenghua Yu, Dave Jiang, Vinod Koul
  Cc: linux-kernel, kernel-janitors, dmaengine

Le 30/05/2023 à 17:54, Bernd Petrovitsch a écrit :
> On 28/05/2023 16:11, Christophe JAILLET wrote:
>> dma_alloc_coherent() already clear the allocated memory, there is no need
>> to explicitly call memset().
> 
> Hmm, so wouldn't be dma_zalloc_coherent() a better name for the function?
> 
> Kind regards,
>      Bernd

Hi,

No strong opinion about it.
It is not malloc either !)

When dma_zalloc_coherent() has been deprecated (see [1]), for some 
reason, it was decided to keep the "alloc" version.

CJ


[1]: 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/include/linux/dma-mapping.h?id=06d4dd2f2ce1cdb625f77c0676d5af6ba310c01d

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
  2023-05-28 14:11 [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call Christophe JAILLET
                   ` (2 preceding siblings ...)
  2023-05-30 15:54 ` Bernd Petrovitsch
@ 2023-07-11 16:44 ` Vinod Koul
  3 siblings, 0 replies; 9+ messages in thread
From: Vinod Koul @ 2023-07-11 16:44 UTC (permalink / raw)
  To: Fenghua Yu, Dave Jiang, Christophe JAILLET
  Cc: linux-kernel, kernel-janitors, dmaengine


On Sun, 28 May 2023 16:11:54 +0200, Christophe JAILLET wrote:
> dma_alloc_coherent() already clear the allocated memory, there is no need
> to explicitly call memset().
> 
> 

Applied, thanks!

[1/1] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
      commit: 61e2cd90681e91ee8202d22e5ca25b1100557fc4

Best regards,
-- 
~Vinod



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
  2023-07-21  7:35 ` sunran001
  2023-07-21 16:13   ` Dave Jiang
@ 2023-08-01 18:31   ` Vinod Koul
  1 sibling, 0 replies; 9+ messages in thread
From: Vinod Koul @ 2023-08-01 18:31 UTC (permalink / raw)
  To: sunran001; +Cc: dmaengine, linux-kernel

On 21-07-23, 07:35, sunran001@208suo.com wrote:
> dma_alloc_coherent() already clear the allocated memory, there is no need
> to explicitly call memset().

Please fix the sender name and resend. it should match s-o-b name

> 
> Signed-off-by: Ran Sun <sunran001@208suo.com>
> ---
>  drivers/dma/idxd/device.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index 7c74bc60f582..72330876d40a 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -792,7 +792,6 @@ static int idxd_device_evl_setup(struct idxd_device
> *idxd)
>  	evl->log_size = size;
>  	evl->bmap = bmap;
> 
> -	memset(&evlcfg, 0, sizeof(evlcfg));
>  	evlcfg.bits[0] = dma_addr & GENMASK(63, 12);
>  	evlcfg.size = evl->size;

-- 
~Vinod

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
  2023-07-21  7:35 ` sunran001
@ 2023-07-21 16:13   ` Dave Jiang
  2023-08-01 18:31   ` Vinod Koul
  1 sibling, 0 replies; 9+ messages in thread
From: Dave Jiang @ 2023-07-21 16:13 UTC (permalink / raw)
  To: sunran001, vkoul; +Cc: dmaengine, linux-kernel, Fenghua Yu



On 7/21/23 00:35, sunran001@208suo.com wrote:
> dma_alloc_coherent() already clear the allocated memory, there is no need
> to explicitly call memset().
> 
> Signed-off-by: Ran Sun <sunran001@208suo.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>   drivers/dma/idxd/device.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index 7c74bc60f582..72330876d40a 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -792,7 +792,6 @@ static int idxd_device_evl_setup(struct idxd_device 
> *idxd)
>       evl->log_size = size;
>       evl->bmap = bmap;
> 
> -    memset(&evlcfg, 0, sizeof(evlcfg));
>       evlcfg.bits[0] = dma_addr & GENMASK(63, 12);
>       evlcfg.size = evl->size;

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call
       [not found] <20230721073440.5402-1-xujianghui@cdjrlc.com>
@ 2023-07-21  7:35 ` sunran001
  2023-07-21 16:13   ` Dave Jiang
  2023-08-01 18:31   ` Vinod Koul
  0 siblings, 2 replies; 9+ messages in thread
From: sunran001 @ 2023-07-21  7:35 UTC (permalink / raw)
  To: vkoul; +Cc: dmaengine, linux-kernel

dma_alloc_coherent() already clear the allocated memory, there is no 
need
to explicitly call memset().

Signed-off-by: Ran Sun <sunran001@208suo.com>
---
  drivers/dma/idxd/device.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 7c74bc60f582..72330876d40a 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -792,7 +792,6 @@ static int idxd_device_evl_setup(struct idxd_device 
*idxd)
  	evl->log_size = size;
  	evl->bmap = bmap;

-	memset(&evlcfg, 0, sizeof(evlcfg));
  	evlcfg.bits[0] = dma_addr & GENMASK(63, 12);
  	evlcfg.size = evl->size;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-01 18:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-28 14:11 [PATCH] dmaengine: idxd: No need to clear memory after a dma_alloc_coherent() call Christophe JAILLET
2023-05-30 15:36 ` Dave Jiang
2023-05-30 15:51 ` Fenghua Yu
2023-05-30 15:54 ` Bernd Petrovitsch
2023-05-30 18:46   ` Christophe JAILLET
2023-07-11 16:44 ` Vinod Koul
     [not found] <20230721073440.5402-1-xujianghui@cdjrlc.com>
2023-07-21  7:35 ` sunran001
2023-07-21 16:13   ` Dave Jiang
2023-08-01 18:31   ` Vinod Koul

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.