All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
@ 2020-10-26 12:24 ` Robin Murphy
  0 siblings, 0 replies; 8+ messages in thread
From: Robin Murphy @ 2020-10-26 12:24 UTC (permalink / raw)
  To: hch; +Cc: iommu, linux-kernel

Offering DMA_PERNUMA_CMA to non-NUMA configs is pointless.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 kernel/dma/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
index c99de4a21458..964b74c9b7e3 100644
--- a/kernel/dma/Kconfig
+++ b/kernel/dma/Kconfig
@@ -125,7 +125,8 @@ if  DMA_CMA
 
 config DMA_PERNUMA_CMA
 	bool "Enable separate DMA Contiguous Memory Area for each NUMA Node"
-	default NUMA && ARM64
+	depends on NUMA
+	default ARM64
 	help
 	  Enable this option to get pernuma CMA areas so that devices like
 	  ARM64 SMMU can get local memory by DMA coherent APIs.
-- 
2.28.0.dirty

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
@ 2020-10-26 12:24 ` Robin Murphy
  0 siblings, 0 replies; 8+ messages in thread
From: Robin Murphy @ 2020-10-26 12:24 UTC (permalink / raw)
  To: hch; +Cc: iommu, linux-kernel, song.bao.hua

Offering DMA_PERNUMA_CMA to non-NUMA configs is pointless.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
 kernel/dma/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
index c99de4a21458..964b74c9b7e3 100644
--- a/kernel/dma/Kconfig
+++ b/kernel/dma/Kconfig
@@ -125,7 +125,8 @@ if  DMA_CMA
 
 config DMA_PERNUMA_CMA
 	bool "Enable separate DMA Contiguous Memory Area for each NUMA Node"
-	default NUMA && ARM64
+	depends on NUMA
+	default ARM64
 	help
 	  Enable this option to get pernuma CMA areas so that devices like
 	  ARM64 SMMU can get local memory by DMA coherent APIs.
-- 
2.28.0.dirty


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

* RE: [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
  2020-10-26 12:24 ` Robin Murphy
@ 2020-10-26 20:07   ` Song Bao Hua (Barry Song)
  -1 siblings, 0 replies; 8+ messages in thread
From: Song Bao Hua (Barry Song) @ 2020-10-26 20:07 UTC (permalink / raw)
  To: Robin Murphy, hch@lst.de
  Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Robin Murphy [mailto:robin.murphy@arm.com]
> Sent: Tuesday, October 27, 2020 1:25 AM
> To: hch@lst.de
> Cc: iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org; Song Bao
> Hua (Barry Song) <song.bao.hua@hisilicon.com>
> Subject: [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
> 
> Offering DMA_PERNUMA_CMA to non-NUMA configs is pointless.
> 

This is right.

> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  kernel/dma/Kconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> index c99de4a21458..964b74c9b7e3 100644
> --- a/kernel/dma/Kconfig
> +++ b/kernel/dma/Kconfig
> @@ -125,7 +125,8 @@ if  DMA_CMA
> 
>  config DMA_PERNUMA_CMA
>  	bool "Enable separate DMA Contiguous Memory Area for each NUMA
> Node"
> -	default NUMA && ARM64
> +	depends on NUMA
> +	default ARM64

On the other hand, at this moment, only ARM64 is calling the init code
to get per_numa cma. Do we need to
depends on NUMA && ARM64 ?
so that this is not enabled by non-arm64?

>  	help
>  	  Enable this option to get pernuma CMA areas so that devices like
>  	  ARM64 SMMU can get local memory by DMA coherent APIs.
> --
 
Thanks
Barry


_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* RE: [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
@ 2020-10-26 20:07   ` Song Bao Hua (Barry Song)
  0 siblings, 0 replies; 8+ messages in thread
From: Song Bao Hua (Barry Song) @ 2020-10-26 20:07 UTC (permalink / raw)
  To: Robin Murphy, hch@lst.de
  Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org



> -----Original Message-----
> From: Robin Murphy [mailto:robin.murphy@arm.com]
> Sent: Tuesday, October 27, 2020 1:25 AM
> To: hch@lst.de
> Cc: iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org; Song Bao
> Hua (Barry Song) <song.bao.hua@hisilicon.com>
> Subject: [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
> 
> Offering DMA_PERNUMA_CMA to non-NUMA configs is pointless.
> 

This is right.

> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  kernel/dma/Kconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> index c99de4a21458..964b74c9b7e3 100644
> --- a/kernel/dma/Kconfig
> +++ b/kernel/dma/Kconfig
> @@ -125,7 +125,8 @@ if  DMA_CMA
> 
>  config DMA_PERNUMA_CMA
>  	bool "Enable separate DMA Contiguous Memory Area for each NUMA
> Node"
> -	default NUMA && ARM64
> +	depends on NUMA
> +	default ARM64

On the other hand, at this moment, only ARM64 is calling the init code
to get per_numa cma. Do we need to
depends on NUMA && ARM64 ?
so that this is not enabled by non-arm64?

>  	help
>  	  Enable this option to get pernuma CMA areas so that devices like
>  	  ARM64 SMMU can get local memory by DMA coherent APIs.
> --
 
Thanks
Barry



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

* Re: [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
  2020-10-26 20:07   ` Song Bao Hua (Barry Song)
@ 2020-10-27  7:54     ` hch
  -1 siblings, 0 replies; 8+ messages in thread
From: hch @ 2020-10-27  7:54 UTC (permalink / raw)
  To: Song Bao Hua (Barry Song)
  Cc: iommu@lists.linux-foundation.org, Robin Murphy, hch@lst.de,
	linux-kernel@vger.kernel.org

On Mon, Oct 26, 2020 at 08:07:43PM +0000, Song Bao Hua (Barry Song) wrote:
> > diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> > index c99de4a21458..964b74c9b7e3 100644
> > --- a/kernel/dma/Kconfig
> > +++ b/kernel/dma/Kconfig
> > @@ -125,7 +125,8 @@ if  DMA_CMA
> > 
> >  config DMA_PERNUMA_CMA
> >  	bool "Enable separate DMA Contiguous Memory Area for each NUMA
> > Node"
> > -	default NUMA && ARM64
> > +	depends on NUMA
> > +	default ARM64
> 
> On the other hand, at this moment, only ARM64 is calling the init code
> to get per_numa cma. Do we need to
> depends on NUMA && ARM64 ?
> so that this is not enabled by non-arm64?

I actually hate having arch symbols in common code.  A new
ARCH_HAS_DMA_PERNUMA_CMA, only selected by arm64 for now would be more
clean I think.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* Re: [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
@ 2020-10-27  7:54     ` hch
  0 siblings, 0 replies; 8+ messages in thread
From: hch @ 2020-10-27  7:54 UTC (permalink / raw)
  To: Song Bao Hua (Barry Song)
  Cc: Robin Murphy, hch@lst.de, iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org

On Mon, Oct 26, 2020 at 08:07:43PM +0000, Song Bao Hua (Barry Song) wrote:
> > diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> > index c99de4a21458..964b74c9b7e3 100644
> > --- a/kernel/dma/Kconfig
> > +++ b/kernel/dma/Kconfig
> > @@ -125,7 +125,8 @@ if  DMA_CMA
> > 
> >  config DMA_PERNUMA_CMA
> >  	bool "Enable separate DMA Contiguous Memory Area for each NUMA
> > Node"
> > -	default NUMA && ARM64
> > +	depends on NUMA
> > +	default ARM64
> 
> On the other hand, at this moment, only ARM64 is calling the init code
> to get per_numa cma. Do we need to
> depends on NUMA && ARM64 ?
> so that this is not enabled by non-arm64?

I actually hate having arch symbols in common code.  A new
ARCH_HAS_DMA_PERNUMA_CMA, only selected by arm64 for now would be more
clean I think.

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

* RE: [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
  2020-10-27  7:54     ` hch
@ 2020-10-27  8:22       ` Song Bao Hua (Barry Song)
  -1 siblings, 0 replies; 8+ messages in thread
From: Song Bao Hua (Barry Song) @ 2020-10-27  8:22 UTC (permalink / raw)
  To: hch@lst.de, will@kernel.org
  Cc: iommu@lists.linux-foundation.org, Robin Murphy,
	linux-kernel@vger.kernel.org, Linuxarm



> -----Original Message-----
> From: hch@lst.de [mailto:hch@lst.de]
> Sent: Tuesday, October 27, 2020 8:55 PM
> To: Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>
> Cc: Robin Murphy <robin.murphy@arm.com>; hch@lst.de;
> iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
> 
> On Mon, Oct 26, 2020 at 08:07:43PM +0000, Song Bao Hua (Barry Song)
> wrote:
> > > diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> > > index c99de4a21458..964b74c9b7e3 100644
> > > --- a/kernel/dma/Kconfig
> > > +++ b/kernel/dma/Kconfig
> > > @@ -125,7 +125,8 @@ if  DMA_CMA
> > >
> > >  config DMA_PERNUMA_CMA
> > >  	bool "Enable separate DMA Contiguous Memory Area for each NUMA
> > > Node"
> > > -	default NUMA && ARM64
> > > +	depends on NUMA
> > > +	default ARM64
> >
> > On the other hand, at this moment, only ARM64 is calling the init code
> > to get per_numa cma. Do we need to
> > depends on NUMA && ARM64 ?
> > so that this is not enabled by non-arm64?
> 
> I actually hate having arch symbols in common code.  A new
> ARCH_HAS_DMA_PERNUMA_CMA, only selected by arm64 for now would be
> more
> clean I think.

Sounds good to me.

BTW,  +Will.

Last time we talked about default pernuma cma size, you suggested a bootargs
in arch/arm64/Kconfig but Will seems to have different idea. Am I right, Will?

Would we let aarch64 call dma_pernuma_cma_reserve(16MB) rather than
dma_pernuma_cma_reserve()?

In this way, users will at least get a default pernuma CMA which is required
at least by IOMMU. If users set a "cma_pernuma" bootargs, it will overwrite
the default size from aarch64 code?

I mean

- void __init dma_pernuma_cma_reserve(size_t size)
+ void __init dma_pernuma_cma_reserve(size_t size)
{
	if (!pernuma_size_bytes)
+		pernuma_size_bytes = size;
	....
}

Right now, it is easy that users will forget to set cma_pernuma in bootargs.
Probably this feature is not enabled by users.

Thanks
Barry
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

* RE: [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
@ 2020-10-27  8:22       ` Song Bao Hua (Barry Song)
  0 siblings, 0 replies; 8+ messages in thread
From: Song Bao Hua (Barry Song) @ 2020-10-27  8:22 UTC (permalink / raw)
  To: hch@lst.de, will@kernel.org
  Cc: Robin Murphy, iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, Linuxarm



> -----Original Message-----
> From: hch@lst.de [mailto:hch@lst.de]
> Sent: Tuesday, October 27, 2020 8:55 PM
> To: Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>
> Cc: Robin Murphy <robin.murphy@arm.com>; hch@lst.de;
> iommu@lists.linux-foundation.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] dma: Per-NUMA-node CMA should depend on NUMA
> 
> On Mon, Oct 26, 2020 at 08:07:43PM +0000, Song Bao Hua (Barry Song)
> wrote:
> > > diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> > > index c99de4a21458..964b74c9b7e3 100644
> > > --- a/kernel/dma/Kconfig
> > > +++ b/kernel/dma/Kconfig
> > > @@ -125,7 +125,8 @@ if  DMA_CMA
> > >
> > >  config DMA_PERNUMA_CMA
> > >  	bool "Enable separate DMA Contiguous Memory Area for each NUMA
> > > Node"
> > > -	default NUMA && ARM64
> > > +	depends on NUMA
> > > +	default ARM64
> >
> > On the other hand, at this moment, only ARM64 is calling the init code
> > to get per_numa cma. Do we need to
> > depends on NUMA && ARM64 ?
> > so that this is not enabled by non-arm64?
> 
> I actually hate having arch symbols in common code.  A new
> ARCH_HAS_DMA_PERNUMA_CMA, only selected by arm64 for now would be
> more
> clean I think.

Sounds good to me.

BTW,  +Will.

Last time we talked about default pernuma cma size, you suggested a bootargs
in arch/arm64/Kconfig but Will seems to have different idea. Am I right, Will?

Would we let aarch64 call dma_pernuma_cma_reserve(16MB) rather than
dma_pernuma_cma_reserve()?

In this way, users will at least get a default pernuma CMA which is required
at least by IOMMU. If users set a "cma_pernuma" bootargs, it will overwrite
the default size from aarch64 code?

I mean

- void __init dma_pernuma_cma_reserve(size_t size)
+ void __init dma_pernuma_cma_reserve(size_t size)
{
	if (!pernuma_size_bytes)
+		pernuma_size_bytes = size;
	....
}

Right now, it is easy that users will forget to set cma_pernuma in bootargs.
Probably this feature is not enabled by users.

Thanks
Barry

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

end of thread, other threads:[~2020-10-27  8:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-26 12:24 [PATCH] dma: Per-NUMA-node CMA should depend on NUMA Robin Murphy
2020-10-26 12:24 ` Robin Murphy
2020-10-26 20:07 ` Song Bao Hua (Barry Song)
2020-10-26 20:07   ` Song Bao Hua (Barry Song)
2020-10-27  7:54   ` hch
2020-10-27  7:54     ` hch
2020-10-27  8:22     ` Song Bao Hua (Barry Song)
2020-10-27  8:22       ` Song Bao Hua (Barry Song)

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.