From: Rob Herring <robh@kernel.org>
To: Masahiro Yamada <masahiroy@kernel.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrea della Porta <andrea.porta@suse.com>,
linux-clk@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>,
Brendan Higgins <brendanhiggins@google.com>,
devicetree@vger.kernel.org, Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas@fjasle.eu>
Subject: Re: [PATCH v3 1/2] kbuild: move non-boot built-in DTBs to .rodata section
Date: Tue, 24 Sep 2024 17:15:14 -0500 [thread overview]
Message-ID: <20240924221514.GA374455-robh@kernel.org> (raw)
In-Reply-To: <20240923075704.3567313-1-masahiroy@kernel.org>
On Mon, Sep 23, 2024 at 04:56:02PM +0900, Masahiro Yamada wrote:
> Commit aab94339cd85 ("of: Add support for linking device tree blobs
> into vmlinux") introduced a mechanism to embed DTBs into vmlinux.
>
> Initially, it was used for wrapping boot DTBs in arch/*/boot/dts/, but
> it is now reused for more generic purposes, such as testing.
>
> Built-in DTBs are discarded because KERNEL_DTB() is part of INIT_DATA,
> as defined in include/asm-generic/vmlinux.lds.h.
>
> This has not been an issue so far because OF unittests are triggered
> during boot, as defined by late_initcall(of_unittest).
>
> However, the recent clk KUnit test additions have caused problems
> because KUnit can execute test suites after boot.
>
> For example:
>
> # echo > /sys/kernel/debug/kunit/clk_register_clk_parent_data_device/run
>
> This command triggers a stack trace because built-in DTBs have already
> been freed.
>
> While it is possible to move such test suites from kunit_test_suites to
> kunit_test_init_section_suites, it would be preferable to avoid usage
> limitations.
>
> This commit moves non-boot built-in DTBs to the .rodata section. Since
> these generic DTBs are looked up by name, they do not need to be placed
> in the special .dtb.init.rodata section.
>
> Boot DTBs should remain in .dtb.init.rodata because the arch boot code
> generally does not know the DT name, thus it uses the __dtb_start symbol
> to locate it.
>
> This separation also ensures that the __dtb_start symbol references the
> boot DTB. Currently, the .dtb.init.rodata is a mixture of both boot and
> non-boot DTBs. The __dtb_start symbol must be followed by the boot DTB,
> but we currently rely on the link order (i.e., the order in Makefiles),
> which is very fragile.
>
> Fixes: 5c9dd72d8385 ("of: Add a KUnit test for overlays and test managed APIs")
> Fixes: 5776526beb95 ("clk: Add KUnit tests for clk fixed rate basic type")
> Fixes: 274aff8711b2 ("clk: Add KUnit tests for clks registered with struct clk_parent_data")
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
> Changes in v3:
> - Move to .rodata section instead of .init.rodata
>
> scripts/Makefile.dtbs | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Acked-by: Rob Herring (Arm) <robh@kernel.org>
next prev parent reply other threads:[~2024-09-24 22:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-23 7:56 [PATCH v3 1/2] kbuild: move non-boot built-in DTBs to .rodata section Masahiro Yamada
2024-09-23 7:56 ` [PATCH v3 2/2] kbuild: add generic support for built-in boot DTBs Masahiro Yamada
2024-09-24 22:15 ` Rob Herring [this message]
2024-09-27 14:51 ` [PATCH v3 1/2] kbuild: move non-boot built-in DTBs to .rodata section Masahiro Yamada
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=20240924221514.GA374455-robh@kernel.org \
--to=robh@kernel.org \
--cc=andrea.porta@suse.com \
--cc=brendanhiggins@google.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas@fjasle.eu \
--cc=sboyd@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;
as well as URLs for NNTP newsgroup(s).