All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
@ 2017-01-27 16:03 Geert Uytterhoeven
  2017-02-01 13:45   ` Magnus Damm
  0 siblings, 1 reply; 16+ messages in thread
From: Geert Uytterhoeven @ 2017-01-27 16:03 UTC (permalink / raw)
  To: Marek Szyprowski, Catalin Marinas, Will Deacon, Arnd Bergmann
  Cc: Magnus Damm, linux-arm-kernel, linux-renesas-soc, linux-kernel,
	Geert Uytterhoeven

Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
2 MiB, and 1 GiB.

With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
allocation may not be aligned, leading to a mapping of 512 4 KiB pages.

Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
single PTE, decreasing memory usage and TLB pressure.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Is this useful?

Should there instead be different defaults in Kconfig, depending on
enabled platform support?
---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index cea17afae855f589..1acc422052050770 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -143,6 +143,7 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_DMA_CMA=y
+CONFIG_CMA_ALIGNMENT=9
 CONFIG_MTD=y
 CONFIG_MTD_M25P80=y
 CONFIG_MTD_SPI_NOR=y
-- 
1.9.1

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

* Re: [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
  2017-01-27 16:03 [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB Geert Uytterhoeven
  2017-02-01 13:45   ` Magnus Damm
@ 2017-02-01 13:45   ` Magnus Damm
  0 siblings, 0 replies; 16+ messages in thread
From: Magnus Damm @ 2017-02-01 13:45 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Marek Szyprowski, Catalin Marinas, Will Deacon, Arnd Bergmann,
	linux-arm-kernel, Linux-Renesas, linux-kernel

Hi Geert,

On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
> 2 MiB, and 1 GiB.
>
> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>
> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
> single PTE, decreasing memory usage and TLB pressure.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Is this useful?
>
> Should there instead be different defaults in Kconfig, depending on
> enabled platform support?

I think there is a dependency on the kernel page size configuration as
well. In case of 16 KiB or 64 KiB page size configuration other large
page sizes may be required.

Thanks,

/ magnus

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

* Re: [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
@ 2017-02-01 13:45   ` Magnus Damm
  0 siblings, 0 replies; 16+ messages in thread
From: Magnus Damm @ 2017-02-01 13:45 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Marek Szyprowski, Catalin Marinas, Will Deacon, Arnd Bergmann,
	linux-arm-kernel, Linux-Renesas, linux-kernel

Hi Geert,

On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
> 2 MiB, and 1 GiB.
>
> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>
> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
> single PTE, decreasing memory usage and TLB pressure.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Is this useful?
>
> Should there instead be different defaults in Kconfig, depending on
> enabled platform support?

I think there is a dependency on the kernel page size configuration as
well. In case of 16 KiB or 64 KiB page size configuration other large
page sizes may be required.

Thanks,

/ magnus

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

* [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
@ 2017-02-01 13:45   ` Magnus Damm
  0 siblings, 0 replies; 16+ messages in thread
From: Magnus Damm @ 2017-02-01 13:45 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Geert,

On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
> 2 MiB, and 1 GiB.
>
> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>
> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
> single PTE, decreasing memory usage and TLB pressure.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Is this useful?
>
> Should there instead be different defaults in Kconfig, depending on
> enabled platform support?

I think there is a dependency on the kernel page size configuration as
well. In case of 16 KiB or 64 KiB page size configuration other large
page sizes may be required.

Thanks,

/ magnus

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

* Re: [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
  2017-02-01 13:45   ` Magnus Damm
  (?)
@ 2017-02-01 14:06     ` Robin Murphy
  -1 siblings, 0 replies; 16+ messages in thread
From: Robin Murphy @ 2017-02-01 14:06 UTC (permalink / raw)
  To: Magnus Damm, Geert Uytterhoeven
  Cc: Arnd Bergmann, Catalin Marinas, Will Deacon, linux-kernel,
	Linux-Renesas, linux-arm-kernel, Marek Szyprowski

On 01/02/17 13:45, Magnus Damm wrote:
> Hi Geert,
> 
> On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
>> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
>> 2 MiB, and 1 GiB.
>>
>> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
>> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
>> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>>
>> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
>> single PTE, decreasing memory usage and TLB pressure.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>> Is this useful?
>>
>> Should there instead be different defaults in Kconfig, depending on
>> enabled platform support?
> 
> I think there is a dependency on the kernel page size configuration as
> well. In case of 16 KiB or 64 KiB page size configuration other large
> page sizes may be required.

I don't see the original patch (linux-arm-kernel doesn't look to have it
archived either), but I think bumping the default up to 2MB to match our
normal section size sounds generally reasonable - users can still
override it manually in their config, right? For 16KB and 64KB granules,
it is at least the size covered by contiguous-hinted pages; the actual
section sizes there are far too big to be practical for alignment
purposes anyway (32MB and 512MB respectively).

Robin.

> 
> Thanks,
> 
> / magnus
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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

* Re: [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
@ 2017-02-01 14:06     ` Robin Murphy
  0 siblings, 0 replies; 16+ messages in thread
From: Robin Murphy @ 2017-02-01 14:06 UTC (permalink / raw)
  To: Magnus Damm, Geert Uytterhoeven
  Cc: Arnd Bergmann, Catalin Marinas, Will Deacon, linux-kernel,
	Linux-Renesas, linux-arm-kernel, Marek Szyprowski

On 01/02/17 13:45, Magnus Damm wrote:
> Hi Geert,
> 
> On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
>> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
>> 2 MiB, and 1 GiB.
>>
>> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
>> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
>> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>>
>> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
>> single PTE, decreasing memory usage and TLB pressure.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>> Is this useful?
>>
>> Should there instead be different defaults in Kconfig, depending on
>> enabled platform support?
> 
> I think there is a dependency on the kernel page size configuration as
> well. In case of 16 KiB or 64 KiB page size configuration other large
> page sizes may be required.

I don't see the original patch (linux-arm-kernel doesn't look to have it
archived either), but I think bumping the default up to 2MB to match our
normal section size sounds generally reasonable - users can still
override it manually in their config, right? For 16KB and 64KB granules,
it is at least the size covered by contiguous-hinted pages; the actual
section sizes there are far too big to be practical for alignment
purposes anyway (32MB and 512MB respectively).

Robin.

> 
> Thanks,
> 
> / magnus
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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

* [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
@ 2017-02-01 14:06     ` Robin Murphy
  0 siblings, 0 replies; 16+ messages in thread
From: Robin Murphy @ 2017-02-01 14:06 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/02/17 13:45, Magnus Damm wrote:
> Hi Geert,
> 
> On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
>> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
>> 2 MiB, and 1 GiB.
>>
>> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
>> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
>> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>>
>> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
>> single PTE, decreasing memory usage and TLB pressure.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>> Is this useful?
>>
>> Should there instead be different defaults in Kconfig, depending on
>> enabled platform support?
> 
> I think there is a dependency on the kernel page size configuration as
> well. In case of 16 KiB or 64 KiB page size configuration other large
> page sizes may be required.

I don't see the original patch (linux-arm-kernel doesn't look to have it
archived either), but I think bumping the default up to 2MB to match our
normal section size sounds generally reasonable - users can still
override it manually in their config, right? For 16KB and 64KB granules,
it is at least the size covered by contiguous-hinted pages; the actual
section sizes there are far too big to be practical for alignment
purposes anyway (32MB and 512MB respectively).

Robin.

> 
> Thanks,
> 
> / magnus
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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

* Re: [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
  2017-02-01 14:06     ` Robin Murphy
  (?)
@ 2017-02-02  9:22       ` Simon Horman
  -1 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2017-02-02  9:22 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Magnus Damm, Geert Uytterhoeven, Arnd Bergmann, Catalin Marinas,
	Will Deacon, linux-kernel, Linux-Renesas, linux-arm-kernel,
	Marek Szyprowski

On Wed, Feb 01, 2017 at 02:06:45PM +0000, Robin Murphy wrote:
> On 01/02/17 13:45, Magnus Damm wrote:
> > Hi Geert,
> > 
> > On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
> > <geert+renesas@glider.be> wrote:
> >> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
> >> 2 MiB, and 1 GiB.
> >>
> >> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
> >> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
> >> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
> >>
> >> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
> >> single PTE, decreasing memory usage and TLB pressure.
> >>
> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >> ---
> >> Is this useful?
> >>
> >> Should there instead be different defaults in Kconfig, depending on
> >> enabled platform support?
> > 
> > I think there is a dependency on the kernel page size configuration as
> > well. In case of 16 KiB or 64 KiB page size configuration other large
> > page sizes may be required.
> 
> I don't see the original patch (linux-arm-kernel doesn't look to have it
> archived either), but I think bumping the default up to 2MB to match our
> normal section size sounds generally reasonable - users can still
> override it manually in their config, right? For 16KB and 64KB granules,
> it is at least the size covered by contiguous-hinted pages; the actual
> section sizes there are far too big to be practical for alignment
> purposes anyway (32MB and 512MB respectively).

I am happy to take this patch on the strength of the above but an Ack or
similar tag from Robin would be nice. Geert, perhaps you could repost the
patch with Robin CCed?

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

* Re: [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
@ 2017-02-02  9:22       ` Simon Horman
  0 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2017-02-02  9:22 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Magnus Damm, Geert Uytterhoeven, Arnd Bergmann, Catalin Marinas,
	Will Deacon, linux-kernel, Linux-Renesas, linux-arm-kernel,
	Marek Szyprowski

On Wed, Feb 01, 2017 at 02:06:45PM +0000, Robin Murphy wrote:
> On 01/02/17 13:45, Magnus Damm wrote:
> > Hi Geert,
> > 
> > On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
> > <geert+renesas@glider.be> wrote:
> >> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
> >> 2 MiB, and 1 GiB.
> >>
> >> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
> >> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
> >> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
> >>
> >> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
> >> single PTE, decreasing memory usage and TLB pressure.
> >>
> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >> ---
> >> Is this useful?
> >>
> >> Should there instead be different defaults in Kconfig, depending on
> >> enabled platform support?
> > 
> > I think there is a dependency on the kernel page size configuration as
> > well. In case of 16 KiB or 64 KiB page size configuration other large
> > page sizes may be required.
> 
> I don't see the original patch (linux-arm-kernel doesn't look to have it
> archived either), but I think bumping the default up to 2MB to match our
> normal section size sounds generally reasonable - users can still
> override it manually in their config, right? For 16KB and 64KB granules,
> it is at least the size covered by contiguous-hinted pages; the actual
> section sizes there are far too big to be practical for alignment
> purposes anyway (32MB and 512MB respectively).

I am happy to take this patch on the strength of the above but an Ack or
similar tag from Robin would be nice. Geert, perhaps you could repost the
patch with Robin CCed?

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

* [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
@ 2017-02-02  9:22       ` Simon Horman
  0 siblings, 0 replies; 16+ messages in thread
From: Simon Horman @ 2017-02-02  9:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 01, 2017 at 02:06:45PM +0000, Robin Murphy wrote:
> On 01/02/17 13:45, Magnus Damm wrote:
> > Hi Geert,
> > 
> > On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
> > <geert+renesas@glider.be> wrote:
> >> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
> >> 2 MiB, and 1 GiB.
> >>
> >> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
> >> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
> >> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
> >>
> >> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
> >> single PTE, decreasing memory usage and TLB pressure.
> >>
> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >> ---
> >> Is this useful?
> >>
> >> Should there instead be different defaults in Kconfig, depending on
> >> enabled platform support?
> > 
> > I think there is a dependency on the kernel page size configuration as
> > well. In case of 16 KiB or 64 KiB page size configuration other large
> > page sizes may be required.
> 
> I don't see the original patch (linux-arm-kernel doesn't look to have it
> archived either), but I think bumping the default up to 2MB to match our
> normal section size sounds generally reasonable - users can still
> override it manually in their config, right? For 16KB and 64KB granules,
> it is at least the size covered by contiguous-hinted pages; the actual
> section sizes there are far too big to be practical for alignment
> purposes anyway (32MB and 512MB respectively).

I am happy to take this patch on the strength of the above but an Ack or
similar tag from Robin would be nice. Geert, perhaps you could repost the
patch with Robin CCed?

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

* Re: [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
  2017-02-01 13:45   ` Magnus Damm
  (?)
@ 2017-02-13 10:29     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2017-02-13 10:29 UTC (permalink / raw)
  To: Magnus Damm
  Cc: Geert Uytterhoeven, Marek Szyprowski, Catalin Marinas,
	Will Deacon, Arnd Bergmann, linux-arm-kernel, Linux-Renesas,
	linux-kernel

Hi Magnus,

On Wed, Feb 1, 2017 at 2:45 PM, Magnus Damm <magnus.damm@gmail.com> wrote:
> On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
>> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
>> 2 MiB, and 1 GiB.
>>
>> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
>> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
>> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>>
>> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
>> single PTE, decreasing memory usage and TLB pressure.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>> Is this useful?
>>
>> Should there instead be different defaults in Kconfig, depending on
>> enabled platform support?
>
> I think there is a dependency on the kernel page size configuration as
> well. In case of 16 KiB or 64 KiB page size configuration other large
> page sizes may be required.

This is about IOMMU pages, not (CPU)MMU pages?

Still, there is indeed some dependency, as CONFIG_CMA_ALIGNMENT is a
shift relative to PAGE_SHIFT (i.e. CONFIG_ARM64_PAGE_SHIFT = 12 in
arm64_defconfig).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
@ 2017-02-13 10:29     ` Geert Uytterhoeven
  0 siblings, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2017-02-13 10:29 UTC (permalink / raw)
  To: Magnus Damm
  Cc: Geert Uytterhoeven, Marek Szyprowski, Catalin Marinas,
	Will Deacon, Arnd Bergmann, linux-arm-kernel, Linux-Renesas,
	linux-kernel

Hi Magnus,

On Wed, Feb 1, 2017 at 2:45 PM, Magnus Damm <magnus.damm@gmail.com> wrote:
> On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
>> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
>> 2 MiB, and 1 GiB.
>>
>> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
>> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
>> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>>
>> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
>> single PTE, decreasing memory usage and TLB pressure.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>> Is this useful?
>>
>> Should there instead be different defaults in Kconfig, depending on
>> enabled platform support?
>
> I think there is a dependency on the kernel page size configuration as
> well. In case of 16 KiB or 64 KiB page size configuration other large
> page sizes may be required.

This is about IOMMU pages, not (CPU)MMU pages?

Still, there is indeed some dependency, as CONFIG_CMA_ALIGNMENT is a
shift relative to PAGE_SHIFT (i.e. CONFIG_ARM64_PAGE_SHIFT = 12 in
arm64_defconfig).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
@ 2017-02-13 10:29     ` Geert Uytterhoeven
  0 siblings, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2017-02-13 10:29 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Magnus,

On Wed, Feb 1, 2017 at 2:45 PM, Magnus Damm <magnus.damm@gmail.com> wrote:
> On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
> <geert+renesas@glider.be> wrote:
>> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
>> 2 MiB, and 1 GiB.
>>
>> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
>> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
>> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>>
>> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
>> single PTE, decreasing memory usage and TLB pressure.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> ---
>> Is this useful?
>>
>> Should there instead be different defaults in Kconfig, depending on
>> enabled platform support?
>
> I think there is a dependency on the kernel page size configuration as
> well. In case of 16 KiB or 64 KiB page size configuration other large
> page sizes may be required.

This is about IOMMU pages, not (CPU)MMU pages?

Still, there is indeed some dependency, as CONFIG_CMA_ALIGNMENT is a
shift relative to PAGE_SHIFT (i.e. CONFIG_ARM64_PAGE_SHIFT = 12 in
arm64_defconfig).

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
  2017-02-01 14:06     ` Robin Murphy
  (?)
@ 2017-02-13 10:33       ` Geert Uytterhoeven
  -1 siblings, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2017-02-13 10:33 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Magnus Damm, Geert Uytterhoeven, Arnd Bergmann, Catalin Marinas,
	Will Deacon, linux-kernel, Linux-Renesas, linux-arm-kernel,
	Marek Szyprowski

Hi Robin,

On Wed, Feb 1, 2017 at 3:06 PM, Robin Murphy <robin.murphy@arm.com> wrote:
> On 01/02/17 13:45, Magnus Damm wrote:
>> On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
>> <geert+renesas@glider.be> wrote:
>>> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
>>> 2 MiB, and 1 GiB.
>>>
>>> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
>>> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
>>> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>>>
>>> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
>>> single PTE, decreasing memory usage and TLB pressure.
>>>
>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>> ---
>>> Is this useful?
>>>
>>> Should there instead be different defaults in Kconfig, depending on
>>> enabled platform support?
>>
>> I think there is a dependency on the kernel page size configuration as
>> well. In case of 16 KiB or 64 KiB page size configuration other large
>> page sizes may be required.
>
> I don't see the original patch (linux-arm-kernel doesn't look to have it
> archived either), but I think bumping the default up to 2MB to match our

These days linux-arm-kernel (infradead) tends to reject my patches :-(

linux-renesas-soc patchwork does have it:
https://patchwork.kernel.org/patch/9542173/

> normal section size sounds generally reasonable - users can still
> override it manually in their config, right? For 16KB and 64KB granules,
> it is at least the size covered by contiguous-hinted pages; the actual
> section sizes there are far too big to be practical for alignment
> purposes anyway (32MB and 512MB respectively).

Yes, it can be overridden by the user.

One slight annoyance is the dependency on PAGE_SHIFT: if you increase
ARM64_PAGE_SHIFT, you want to decrease CONFIG_CMA_ALIGNMENT.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
@ 2017-02-13 10:33       ` Geert Uytterhoeven
  0 siblings, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2017-02-13 10:33 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Magnus Damm, Geert Uytterhoeven, Arnd Bergmann, Catalin Marinas,
	Will Deacon, linux-kernel, Linux-Renesas, linux-arm-kernel,
	Marek Szyprowski

Hi Robin,

On Wed, Feb 1, 2017 at 3:06 PM, Robin Murphy <robin.murphy@arm.com> wrote:
> On 01/02/17 13:45, Magnus Damm wrote:
>> On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
>> <geert+renesas@glider.be> wrote:
>>> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
>>> 2 MiB, and 1 GiB.
>>>
>>> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
>>> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
>>> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>>>
>>> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
>>> single PTE, decreasing memory usage and TLB pressure.
>>>
>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>> ---
>>> Is this useful?
>>>
>>> Should there instead be different defaults in Kconfig, depending on
>>> enabled platform support?
>>
>> I think there is a dependency on the kernel page size configuration as
>> well. In case of 16 KiB or 64 KiB page size configuration other large
>> page sizes may be required.
>
> I don't see the original patch (linux-arm-kernel doesn't look to have it
> archived either), but I think bumping the default up to 2MB to match our

These days linux-arm-kernel (infradead) tends to reject my patches :-(

linux-renesas-soc patchwork does have it:
https://patchwork.kernel.org/patch/9542173/

> normal section size sounds generally reasonable - users can still
> override it manually in their config, right? For 16KB and 64KB granules,
> it is at least the size covered by contiguous-hinted pages; the actual
> section sizes there are far too big to be practical for alignment
> purposes anyway (32MB and 512MB respectively).

Yes, it can be overridden by the user.

One slight annoyance is the dependency on PAGE_SHIFT: if you increase
ARM64_PAGE_SHIFT, you want to decrease CONFIG_CMA_ALIGNMENT.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB
@ 2017-02-13 10:33       ` Geert Uytterhoeven
  0 siblings, 0 replies; 16+ messages in thread
From: Geert Uytterhoeven @ 2017-02-13 10:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Robin,

On Wed, Feb 1, 2017 at 3:06 PM, Robin Murphy <robin.murphy@arm.com> wrote:
> On 01/02/17 13:45, Magnus Damm wrote:
>> On Sat, Jan 28, 2017 at 1:03 AM, Geert Uytterhoeven
>> <geert+renesas@glider.be> wrote:
>>> Some IOMMUs (e.g. Renesas IPMMU/VMSA) support only page sizes of 4 KiB,
>>> 2 MiB, and 1 GiB.
>>>
>>> With the default setting of CONFIG_CMA_ALIGNMENT = 8, allocations larger
>>> than 1 MiB are aligned to a 1 MiB boundary only.  Hence a 2 MiB
>>> allocation may not be aligned, leading to a mapping of 512 4 KiB pages.
>>>
>>> Increase CONFIG_CMA_ALIGNMENT to allow mapping a 2 MiB buffer using a
>>> single PTE, decreasing memory usage and TLB pressure.
>>>
>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>>> ---
>>> Is this useful?
>>>
>>> Should there instead be different defaults in Kconfig, depending on
>>> enabled platform support?
>>
>> I think there is a dependency on the kernel page size configuration as
>> well. In case of 16 KiB or 64 KiB page size configuration other large
>> page sizes may be required.
>
> I don't see the original patch (linux-arm-kernel doesn't look to have it
> archived either), but I think bumping the default up to 2MB to match our

These days linux-arm-kernel (infradead) tends to reject my patches :-(

linux-renesas-soc patchwork does have it:
https://patchwork.kernel.org/patch/9542173/

> normal section size sounds generally reasonable - users can still
> override it manually in their config, right? For 16KB and 64KB granules,
> it is at least the size covered by contiguous-hinted pages; the actual
> section sizes there are far too big to be practical for alignment
> purposes anyway (32MB and 512MB respectively).

Yes, it can be overridden by the user.

One slight annoyance is the dependency on PAGE_SHIFT: if you increase
ARM64_PAGE_SHIFT, you want to decrease CONFIG_CMA_ALIGNMENT.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2017-02-13 10:33 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-27 16:03 [PATCH/RFC] arm64: defconfig: Enlarge CMA alignment to 2 MiB Geert Uytterhoeven
2017-02-01 13:45 ` Magnus Damm
2017-02-01 13:45   ` Magnus Damm
2017-02-01 13:45   ` Magnus Damm
2017-02-01 14:06   ` Robin Murphy
2017-02-01 14:06     ` Robin Murphy
2017-02-01 14:06     ` Robin Murphy
2017-02-02  9:22     ` Simon Horman
2017-02-02  9:22       ` Simon Horman
2017-02-02  9:22       ` Simon Horman
2017-02-13 10:33     ` Geert Uytterhoeven
2017-02-13 10:33       ` Geert Uytterhoeven
2017-02-13 10:33       ` Geert Uytterhoeven
2017-02-13 10:29   ` Geert Uytterhoeven
2017-02-13 10:29     ` Geert Uytterhoeven
2017-02-13 10:29     ` Geert Uytterhoeven

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.