From: Oreoluwa Babatunde <quic_obabatun@quicinc.com>
To: Klara Modin <klarasmodin@gmail.com>, <robh@kernel.org>,
<saravanak@google.com>, <hch@lst.de>, <m.szyprowski@samsung.com>,
<robin.murphy@arm.com>, <will@kernel.org>,
<catalin.marinas@arm.com>
Cc: <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<iommu@lists.linux.dev>, <kernel@quicinc.com>
Subject: Re: [PATCH v6 3/4] of: reserved_mem: Use unflatten_devicetree APIs to scan reserved memory nodes
Date: Mon, 8 Jul 2024 16:12:14 -0700 [thread overview]
Message-ID: <1684910a-54e2-4df5-a076-de9c2de4277b@quicinc.com> (raw)
In-Reply-To: <4905e651-4c37-4fb4-bbc1-af9633013134@gmail.com>
On 7/5/2024 8:38 AM, Klara Modin wrote:
> 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 linux
>>
>> where it was previously marked as reusable:
>> Jul 4 22:23:22 bonnet kernel: OF: reserved mem: 0x1b000000..0x1effffff (65536 KiB) map reusable linux,cma
>>
>> If 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@quicinc.com>
>>> ---
>>> 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 *unam
>>> uname, (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 when
>> called 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.
Hi Klara,
Thanks for pointing this out. I have uploaded a fix here:
https://lore.kernel.org/all/20240708230613.448846-1-quic_obabatun@quicinc.com/
Please test and see if this fixes the issue.
Thank you!
Oreoluwa
next prev parent reply other threads:[~2024-07-08 23:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 22:36 [PATCH v6 0/4] Dynamic Allocation of the reserved_mem array Oreoluwa Babatunde
2024-05-28 22:36 ` [PATCH v6 1/4] of: reserved_mem: Restruture how the reserved memory regions are processed Oreoluwa Babatunde
2024-06-10 21:34 ` Nathan Chancellor
2024-06-10 21:47 ` Mark Brown
2024-06-13 16:05 ` Oreoluwa Babatunde
2024-06-13 16:17 ` Conor Dooley
2024-06-13 16:38 ` Robin Murphy
2024-06-17 19:33 ` [PATCH] of: reserved_mem: Restructure code to call reserved mem init functions earlier Oreoluwa Babatunde
2024-06-18 8:53 ` kernel test robot
2024-06-20 0:10 ` [PATCH v2] " Oreoluwa Babatunde
2024-06-26 15:04 ` Nathan Chancellor
2024-06-26 15:16 ` Rob Herring
2024-06-26 15:48 ` Oreoluwa Babatunde
2024-06-25 21:25 ` [PATCH v6 1/4] of: reserved_mem: Restruture how the reserved memory regions are processed Mark Brown
2024-06-25 21:43 ` Oreoluwa Babatunde
2024-05-28 22:36 ` [PATCH v6 2/4] of: reserved_mem: Add code to dynamically allocate reserved_mem array Oreoluwa Babatunde
2024-05-28 22:36 ` [PATCH v6 3/4] of: reserved_mem: Use unflatten_devicetree APIs to scan reserved memory nodes Oreoluwa Babatunde
2024-07-05 13:05 ` Klara Modin
2024-07-05 15:38 ` Klara Modin
2024-07-08 23:12 ` Oreoluwa Babatunde [this message]
2024-07-08 23:45 ` Rob Herring
2024-05-28 22:36 ` [PATCH v6 4/4] of: reserved_mem: Rename fdt_* functions to refelct the change from using fdt APIs Oreoluwa Babatunde
2024-06-06 15:33 ` [PATCH v6 0/4] Dynamic Allocation of the reserved_mem array Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1684910a-54e2-4df5-a076-de9c2de4277b@quicinc.com \
--to=quic_obabatun@quicinc.com \
--cc=catalin.marinas@arm.com \
--cc=devicetree@vger.kernel.org \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=kernel@quicinc.com \
--cc=klarasmodin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=saravanak@google.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®