On 2024-07-05 15:05, Klara Modin wrote:
Hi, On 2024-05-29 00:36, Oreoluwa Babatunde wrote:The unflatten_devicetree APIs have been setup and are available to be used by the time the fdt_init_reserved_mem() function is called. Since the unflatten_devicetree APIs are a more efficient way of scanning through the DT nodes, switch to using these APIs to facilitate the rest of the reserved memory processing.With this patch series, I've observed significantly less memory available to userspace on my Raspberry Pi 1 and 3.I see this message on the kernel console:Jul 4 23:13:49 bonnet kernel: OF: reserved mem: 0x1b000000..0x1effffff (65536 KiB) map non-reusable linuxwhere it was previously marked as reusable:Jul 4 22:23:22 bonnet kernel: OF: reserved mem: 0x1b000000..0x1effffff (65536 KiB) map reusable linux,cmaIf I look at bcm283x.dtsi, it definitely has the reusable property. I've below pointed out the snippet I think could be suspicous.Signed-off-by: Oreoluwa Babatunde <quic_obabatun@xxxxxxxxxxx> --- drivers/of/of_reserved_mem.c | 93 ++++++++++++++++++++------------- include/linux/of_reserved_mem.h | 2 +- kernel/dma/coherent.c | 10 ++-- kernel/dma/contiguous.c | 8 +-- kernel/dma/swiotlb.c | 10 ++-- 5 files changed, 72 insertions(+), 51 deletions(-) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 113d593ea031..05283cd24c3b 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c
@@ -447,7 +476,7 @@ static int __init __reserved_mem_alloc_size(unsigned long node, const char *unamuname, (unsigned long)(size / SZ_1M)); return -ENOMEM; }- fdt_reserved_mem_save_node(node, uname, base, size); + fdt_reserved_mem_save_node(NULL, uname, base, size);This could perhaps be suspicious? The above message seems to come from of_init_reserved_mem_node whencalled from of_reserved_mem_save_node when called from here. This would mean that the node is not actually saved to rmem and thus not marked reusable?return 0; }
Regards, Klara Modin
Attaching kernel logs of old and new behavior, and my config for reference.
Attachment:
config.gz
Description: application/gzip
Attachment:
kern-new.log.gz
Description: application/gzip
Attachment:
kern-old.log.gz
Description: application/gzip