* [PATCH] of: reserved_mem: mark the early_memremap() array helpers __init @ 2026-11-02 22:45 ` Sasha Levin 2026-11-03 9:44 ` Marek Szyprowski 0 siblings, 1 reply; 2+ messages in thread From: Sasha Levin @ 2026-11-02 22:45 UTC (permalink / raw) To: Rob Herring, Marek Szyprowski Cc: Saravana Kannan, Mike Rapoport, Nathan Chancellor, devicetree, llvm, linux-kernel early_array_map() and early_array_unmap() wrap early_memremap() and early_memunmap(), which are __init, but the helpers themselves are only static inline. If the compiler decides not to inline them, the out of line copy ends up in .text and modpost complains. clang 21 does this for a riscv allnoconfig build: WARNING: modpost: vmlinux: section mismatch in reference: early_array_map+0x30 (section: .text) -> early_memremap (section: .init.text) ERROR: modpost: Section mismatches detected. Both helpers are only called from fdt_scan_reserved_mem(), which is __init, so mark them __init too. Fixes: aa05faf81583 ("of: reserved_mem: allocate and map the reserved_mem array early") Signed-off-by: Sasha Levin <sashal@kernel.org> --- KernelCI's clang-21 riscv builds fail on this once dt/for-next is merged, so it will probably show up in tomorrow's linux-next as well. Tested with a riscv LLVM=1 allnoconfig build (fails at modpost before, links after), plus W=1 builds of of_reserved_mem.o for riscv and arm64 defconfig with clang, and arm64 defconfig with gcc. drivers/of/of_reserved_mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 0fd1683cba011..630ad65466385 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -66,11 +66,11 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, */ #if defined(CONFIG_GENERIC_EARLY_IOREMAP) && !defined(CONFIG_PPC64) #include <asm/early_ioremap.h> -static inline void *early_array_map(void *array, size_t size) +static inline void * __init early_array_map(void *array, size_t size) { return early_memremap(__pa(array), size); } -static inline void early_array_unmap(void *map, size_t size) +static inline void __init early_array_unmap(void *map, size_t size) { early_memunmap(map, size); } -- 2.53.0 ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] of: reserved_mem: mark the early_memremap() array helpers __init 2026-11-02 22:45 ` [PATCH] of: reserved_mem: mark the early_memremap() array helpers __init Sasha Levin @ 2026-11-03 9:44 ` Marek Szyprowski 0 siblings, 0 replies; 2+ messages in thread From: Marek Szyprowski @ 2026-11-03 9:44 UTC (permalink / raw) To: Sasha Levin, Rob Herring Cc: Saravana Kannan, Mike Rapoport, Nathan Chancellor, devicetree, llvm, linux-kernel On 02.11.2026 23:45, Sasha Levin wrote: > early_array_map() and early_array_unmap() wrap early_memremap() and > early_memunmap(), which are __init, but the helpers themselves are only > static inline. If the compiler decides not to inline them, the out of > line copy ends up in .text and modpost complains. clang 21 does this for > a riscv allnoconfig build: > > WARNING: modpost: vmlinux: section mismatch in reference: early_array_map+0x30 (section: .text) -> early_memremap (section: .init.text) > ERROR: modpost: Section mismatches detected. > > Both helpers are only called from fdt_scan_reserved_mem(), which is > __init, so mark them __init too. > > Fixes: aa05faf81583 ("of: reserved_mem: allocate and map the reserved_mem array early") > Signed-off-by: Sasha Levin <sashal@kernel.org> I wasn't aware that 'static inline' functions might need __init annotations. Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> > --- > KernelCI's clang-21 riscv builds fail on this once dt/for-next is > merged, so it will probably show up in tomorrow's linux-next as well. > > Tested with a riscv LLVM=1 allnoconfig build (fails at modpost before, > links after), plus W=1 builds of of_reserved_mem.o for riscv and arm64 > defconfig with clang, and arm64 defconfig with gcc. > > drivers/of/of_reserved_mem.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c > index 0fd1683cba011..630ad65466385 100644 > --- a/drivers/of/of_reserved_mem.c > +++ b/drivers/of/of_reserved_mem.c > @@ -66,11 +66,11 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, > */ > #if defined(CONFIG_GENERIC_EARLY_IOREMAP) && !defined(CONFIG_PPC64) > #include <asm/early_ioremap.h> > -static inline void *early_array_map(void *array, size_t size) > +static inline void * __init early_array_map(void *array, size_t size) > { > return early_memremap(__pa(array), size); > } > -static inline void early_array_unmap(void *map, size_t size) > +static inline void __init early_array_unmap(void *map, size_t size) > { > early_memunmap(map, size); > } Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-03 9:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20261102224535eucas1p2a4b762399cd706fadb9dbaeb08188846@eucas1p2.samsung.com>
2026-11-02 22:45 ` [PATCH] of: reserved_mem: mark the early_memremap() array helpers __init Sasha Levin
2026-11-03 9:44 ` Marek Szyprowski
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®