Skip to contentSkip to conversation

ARM: mark prepare_page_table as __init

PATCH Superseded Arnd Bergmann 4 participants 4 messages May 11, 2021 – May 17, 2021 Arm (32-bit)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: mark prepare_page_table as __init

From: Arnd Bergmann <[email protected]>

In some configurations when building with gcc-11, prepare_page_table does not get inline, which causes a build time warning for a section mismatch:

WARNING: modpost: vmlinux.o(.text.unlikely+0xce8): Section mismatch in reference from the function prepare_page_table() to the (unknown reference) .init.data:(unknown) The function prepare_page_table() references
the (unknown reference) __initdata (unknown).
This is often because prepare_page_table lacks a __initdata
annotation or the annotation of (unknown) is wrong.

Mark the function as __init to avoid the warning regardless of the inlining.

---
 arch/arm/mm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/mmu.c +1 -1
index 051f4f82414b..5220b8147f40 100644
@@ -1246,7 +1246,7 @@ void __init adjust_lowmem_bounds(void)
 	memblock_set_current_limit(memblock_limit);
 }
 
-static inline void prepare_page_table(void)
+static inline __init void prepare_page_table(void)
 {
 	unsigned long addr;
 	phys_addr_t end;
Signature · 1 line
2.29.2
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

In some configurations when building with gcc-11, prepare_page_table does not get inline, which causes a build time warning for a section mismatch:

WARNING: modpost: vmlinux.o(.text.unlikely+0xce8): Section mismatch in reference from the function prepare_page_table() to the (unknown reference) .init.data:(unknown) The function prepare_page_table() references
the (unknown reference) __initdata (unknown).
This is often because prepare_page_table lacks a __initdata
annotation or the annotation of (unknown) is wrong.

Quoted 4 lines

Mark the function as __init to avoid the warning regardless of the inlining.

I think the inline should be dropped here. Either inlining is absolutely required for correct code generation (which is rare), or the inline is optional, and better left up to the compiler, especially given that this is __init code so the time/space tradeoff is moot anyway.

With or without that change,

Quoted 20 lines
---
 arch/arm/mm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mm/mmu.c +1 -2
index 051f4f82414b..5220b8147f40 100644
@@ -1246,7 +1246,7 @@ void __init adjust_lowmem_bounds(void)
        memblock_set_current_limit(memblock_limit);
 }
 
-static inline void prepare_page_table(void)
+static inline __init void prepare_page_table(void)
 {
        unsigned long addr;
        phys_addr_t end;
--

2.29.2

#2 lore raw
In reply to Arnd Bergmann
Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

In some configurations when building with gcc-11, prepare_page_table does not get inline, which causes a build time warning for a section mismatch:

Quoted 8 lines

WARNING: modpost: vmlinux.o(.text.unlikely+0xce8): Section mismatch in reference from the function prepare_page_table() to the (unknown reference) .init.data:(unknown) The function prepare_page_table() references
the (unknown reference) __initdata (unknown).
This is often because prepare_page_table lacks a __initdata
annotation or the annotation of (unknown) is wrong.

Mark the function as __init to avoid the warning regardless of the inlining.

I think if we're doing this, it would probably also be a good idea to drop the "inline" as well, and just let the compiler decide?

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Reviewed-by on v1 1/1
#3 lore raw
In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

In some configurations when building with gcc-11, prepare_page_table does not get inline, which causes a build time warning for a section mismatch:

WARNING: modpost: vmlinux.o(.text.unlikely+0xce8): Section mismatch in reference from the function prepare_page_table() to the (unknown reference) .init.data:(unknown) The function prepare_page_table() references
the (unknown reference) __initdata (unknown).
This is often because prepare_page_table lacks a __initdata
annotation or the annotation of (unknown) is wrong.

Quoted 4 lines

Mark the function as __init to avoid the warning regardless of the inlining.

Like the others say, drop inline, with that:

Yours,
Linus Walleij