arm64: mm: make CONFIG_ZONE_DMA configurable without EXPERT
PATCH 1/1 arm64: mm: make CONFIG_ZONE_DMA configurable without EXPERT
From: Peng Fan <[email protected]>
commit 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32") enables both ZONE_DMA and ZONE_DMA32. The lower 1GB memory will be occupied by ZONE_DMA, this will cause CMA allocation fail on some platforms, because CMA area could not across different type of memory zones.
Make CONFIG_ZONE_DMA configurable without EXPERT option could let people build non debug kernel image with CONFIG_ZONE_DMA disabled.
--- arch/arm64/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/Kconfig +1 -1
@@ -270,7 +270,7 @@ config GENERIC_CALIBRATE_DELAY def_bool y config ZONE_DMA - bool "Support DMA zone" if EXPERT + bool "Support DMA zone" default y config ZONE_DMA32
Signature · 7 lines
2.16.4 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 2 lines
Subject: [PATCH] arm64: mm: make
CONFIG_ZONE_DMAconfigurable without EXPERT
Gentle ping..
Thanks,
Peng.
Quoted 31 lines
From: Peng Fan <[email protected]>
commit
1a8e1cef7603("arm64: use bothZONE_DMAandZONE_DMA32") enables bothZONE_DMAandZONE_DMA32. The lower 1GB memory will be occupied byZONE_DMA, this will cause CMA allocation fail on some platforms, because CMA area could not across different type of memory zones.Make
CONFIG_ZONE_DMAconfigurable without EXPERT option could let people build non debug kernel image withCONFIG_ZONE_DMAdisabled.Signed-off-by Peng Fan <[email protected]>--- arch/arm64/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/Kconfig index renamed from arch/arm64/Kconfig +0
-0
217e12ff2115..c4ba8bf011e1100644arch/arm64/Kconfig +1
-2@@ -270,7 +270,7 @@ config GENERIC_CALIBRATE_DELAY def_bool y config ZONE_DMA - bool "Support DMA zone" if EXPERT + bool "Support DMA zone" default y config ZONE_DMA32 --2.16.4
Catalin Marinas
maintainerQuoted 11 lines · On Tue, Mar 10, 2020 at 08:48:46PM +0800, [email protected] wrote:
From: Peng Fan <[email protected]>
commit
1a8e1cef7603("arm64: use bothZONE_DMAandZONE_DMA32") enables bothZONE_DMAandZONE_DMA32. The lower 1GB memory will be occupied byZONE_DMA, this will cause CMA allocation fail on some platforms, because CMA area could not across different type of memory zones.Make
CONFIG_ZONE_DMAconfigurable without EXPERT option could let people build non debug kernel image withCONFIG_ZONE_DMAdisabled.
While I see why you need to toggle this feature, I'd rather try to figure out whether there is a better solution that does not break the single kernel image aim (i.e. the same config works for all supported SoCs).
When we decided to go ahead with a static 1GB ZONE_DMA for Raspberry Pi 4, we thought that other platforms would be fine, ZONE_DMA32 allocations fall back to ZONE_DMA. We missed the large CMA case.
I see a few potential options:
a) Ensure the CMA is contained within a single zone. How large is it in your case? Is it allocated by the kernel dynamically or a fixed start set by the boot loader?
b) Change the CMA allocator to allow spanning multiple zones (last time I looked it wasn't trivial since it relied on some per-zone lock).
c) Make ZONE_DMA dynamic on arm64 and only enable it if RPi4.
Signature · 1 line
Catalin
Quoted 20 lines
Subject: Re: [PATCH] arm64: mm: make
CONFIG_ZONE_DMAconfigurable without EXPERTQuoted 4 lines · On Tue, Mar 10, 2020 at 08:48:46PM +0800, [email protected] wrote:
From: Peng Fan <[email protected]>
commit
1a8e1cef7603("arm64: use bothZONE_DMAandZONE_DMA32") enables bothZONE_DMAandZONE_DMA32. The lower 1GB memory willbe
Quoted 6 lines
occupied by
ZONE_DMA, this will cause CMA allocation fail on some platforms, because CMA area could not across different type of memory zones.Make
CONFIG_ZONE_DMAconfigurable without EXPERT option could let people build non debug kernel image withCONFIG_ZONE_DMAdisabled.While I see why you need to toggle this feature, I'd rather try to figure out whether there is a better solution that does not break the single kernel image aim (i.e. the same config works for all supported SoCs).
Quoted 7 lines
When we decided to go ahead with a static 1GB
ZONE_DMAfor Raspberry Pi 4, we thought that other platforms would be fine,ZONE_DMA32allocations fall back toZONE_DMA. We missed the large CMA case.I see a few potential options:
a) Ensure the CMA is contained within a single zone.
This will break legacy dts with new version kernel.
How large is it in
Quoted 1 line
your case?
It is 1GB
Is it allocated by the kernel dynamically or a fixed start
Quoted 1 line
set by the boot loader?
We use alloc-ranges and size in kernel dts.
But there is only 2GB DRAM in the board.
Quoted 5 lines
b) Change the CMA allocator to allow spanning multiple zones (last time I looked it wasn't trivial since it relied on some per-zone lock).
c) Make
ZONE_DMAdynamic on arm64 and only enable it if RPi4.
Option c seems a bit easier to me :)
I will try to explore both, but if you have time to help, that would be appreciated.
Thanks,
Peng.
Quoted 3 lines
--
Catalin
Catalin Marinas
maintainerQuoted 28 lines · Peng Fan
Quoted 16 lines · On Tue, Mar 10, 2020 at 08:48:46PM +0800, [email protected] wrote:
Quoted 10 lines
From: Peng Fan <[email protected]>
commit
1a8e1cef7603("arm64: use bothZONE_DMAandZONE_DMA32") enables bothZONE_DMAandZONE_DMA32. The lower 1GB memory will be occupied byZONE_DMA, this will cause CMA allocation fail on some platforms, because CMA area could not across different type of memory zones.Make
CONFIG_ZONE_DMAconfigurable without EXPERT option could let people build non debug kernel image withCONFIG_ZONE_DMAdisabled.While I see why you need to toggle this feature, I'd rather try to figure out whether there is a better solution that does not break the single kernel image aim (i.e. the same config works for all supported SoCs).
Quoted 7 lines
When we decided to go ahead with a static 1GB
ZONE_DMAfor Raspberry Pi 4, we thought that other platforms would be fine,ZONE_DMA32allocations fall back toZONE_DMA. We missed the large CMA case.I see a few potential options:
a) Ensure the CMA is contained within a single zone.
This will break legacy dts with new version kernel.
Quoted 1 line
How large is it in your case?
Quoted 8 lines
It is 1GB
Quoted 2 lines
Is it allocated by the kernel dynamically or a fixed start set by the boot loader?
We use alloc-ranges and size in kernel dts.
But there is only 2GB DRAM in the board.
So I guess without changing the dts, option (a) doesn't really work.
Quoted 9 lines
Quoted 4 lines
b) Change the CMA allocator to allow spanning multiple zones (last time I looked it wasn't trivial since it relied on some per-zone lock).
c) Make
ZONE_DMAdynamic on arm64 and only enable it if RPi4.Option c seems a bit easier to me :)
I will try to explore both, but if you have time to help, that would be appreciated.
I don't have time but option (c) was already discussed and there are patches from Nicolas on the list:
https://lore.kernel.org/linux-arm-kernel/[email protected]/
The above series was checking whether the platform is RPi4 and limiting the ZONE_DMA size to 1GB (otherwise 4GB with ZONE_DMA32 empty). We ended up with a static 1GB for ZONE_DMA but we missed the fact that it may break existing platforms.
So I don't think it would be too hard to revive the above series (most of it was already merged).
Signature · 1 line
Catalin
Quoted 69 lines
Subject: Re: [PATCH] arm64: mm: make
CONFIG_ZONE_DMAconfigurable without EXPERTQuoted 4 lines · Peng Fan
Quoted 4 lines · On Tue, Mar 10, 2020 at 08:48:46PM +0800, [email protected] wrote:
Quoted 3 lines
From: Peng Fan <[email protected]>
commit
1a8e1cef7603("arm64: use bothZONE_DMAand
ZONE_DMA32")Quoted 1 line
Quoted 1 line
Quoted 1 line
enables both
ZONE_DMAandZONE_DMA32. The lower 1GB memorywill be
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
occupied by
ZONE_DMA, this will cause CMA allocation fail on some platforms, because CMA area could not across different type of memory zones.Make
CONFIG_ZONE_DMAconfigurable without EXPERT option couldlet
Quoted 1 line
Quoted 1 line
Quoted 1 line
people build non debug kernel image with
CONFIG_ZONE_DMAdisabled.
Quoted 4 lines
Quoted 4 lines
While I see why you need to toggle this feature, I'd rather try to figure out whether there is a better solution that does not break the single kernel image aim (i.e. the same config works for all supported
SoCs).
Quoted 2 lines
Quoted 2 lines
When we decided to go ahead with a static 1GB
ZONE_DMAforRaspberry
Quoted 11 lines
Quoted 6 lines
Pi 4, we thought that other platforms would be fine,
ZONE_DMA32allocations fall back toZONE_DMA. We missed the large CMA case.I see a few potential options:
a) Ensure the CMA is contained within a single zone.
This will break legacy dts with new version kernel.
Quoted 1 line
How large is it in your case?
Quoted 8 lines
It is 1GB
Quoted 2 lines
Is it allocated by the kernel dynamically or a fixed start set by the boot loader?
We use alloc-ranges and size in kernel dts.
But there is only 2GB DRAM in the board.
So I guess without changing the dts, option (a) doesn't really work.
Quoted 9 lines
Quoted 4 lines
b) Change the CMA allocator to allow spanning multiple zones (last time I looked it wasn't trivial since it relied on some per-zone lock).
c) Make
ZONE_DMAdynamic on arm64 and only enable it if RPi4.Option c seems a bit easier to me :)
I will try to explore both, but if you have time to help, that would be appreciated.
I don't have time but option (c) was already discussed and there are patches from Nicolas on the list:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ke
rnel.org%2Flinux-arm-kernel%2F20190820145821.27214-5-nsaenzjulienne% 40suse.de%2F&data=02%7C01%7Cpeng.fan%40nxp.com%7C6403ddf37 89b452ae5ee08d7d0a5a659%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0 %7C0%7C637207282191026738&sdata=t2cZ9HTCcRuaL9RO4kD%2BzN 2n4VqM%2F66zYNZIOComCVs%3D&reserved=0
Quoted 4 lines
The above series was checking whether the platform is RPi4 and limiting the
ZONE_DMAsize to 1GB (otherwise 4GB withZONE_DMA32empty). We ended up with a static 1GB forZONE_DMAbut we missed the fact that it may break existing platforms.
Thanks for the information. I'll check the patchset and work out something proper to fix the issue I met.
Thanks,
Peng.
Quoted 6 lines
So I don't think it would be too hard to revive the above series (most of it was already merged).
--
Catalin
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Peng,
Quoted 13 lines · Peng Fan
Quoted 13 lines
Quoted 13 lines
Quoted 3 lines
I see a few potential options:
a) Ensure the CMA is contained within a single zone.
This will break legacy dts with new version kernel.
Quoted 1 line
How large is it in your case?
It is 1GB
Quoted 2 lines
Is it allocated by the kernel dynamically or a fixed start set by the boot loader?
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
We use alloc-ranges and size in kernel dts.
But there is only 2GB DRAM in the board.
So I guess without changing the dts, option (a) doesn't really work.
Quoted 2 lines
Quoted 2 lines
b) Change the CMA allocator to allow spanning multiple zones (last time I looked it wasn't trivial since it relied on some per-zone lock).
I like this as a solution, ultimately why should CMA be linked to a specific zone. Also, crossing the ZONE_DMA/ZONE_DMA32 boundary shouldn't be an issue since we already default to ZONE_DMA32 as the default area for CMA.
That said, easier said than done.
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
Quoted 1 line
c) Make
ZONE_DMAdynamic on arm64 and only enable it if RPi4.Option c seems a bit easier to me :)
I will try to explore both, but if you have time to help, that would be appreciated.
I don't have time but option (c) was already discussed and there are patches from Nicolas on the list:
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ke
rnel.org%2Flinux-arm-kernel%2F20190820145821.27214-5-nsaenzjulienne% 40suse.de%2F&data=02%7C01%7Cpeng.fan%40nxp.com%7C6403ddf37 89b452ae5ee08d7d0a5a659%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0 %7C0%7C637207282191026738&sdata=t2cZ9HTCcRuaL9RO4kD%2BzN 2n4VqM%2F66zYNZIOComCVs%3D&reserved=0
Quoted 7 lines
Quoted 4 lines
The above series was checking whether the platform is RPi4 and limiting the
ZONE_DMAsize to 1GB (otherwise 4GB withZONE_DMA32empty). We ended up with a static 1GB forZONE_DMAbut we missed the fact that it may break existing platforms.Thanks for the information. I'll check the patchset and work out something proper to fix the issue I met.
Just an FYI, I'm follwing the conversation, and will try to look into as soon as I get some free time. In the meantime if you want me to test/review anything on the Raspberry Pi, I'll be happy to.
Regards,
Nicolas