Skip to contentSkip to conversation

memblock: fix section mismatch warning again

PATCH Applied Mike Rapoport 3 participants 3 messages Mar 16, 2021

Subsystems (2)
lore
Share & tools
lore

Mike Rapoport

author maintainer
#0 lore raw

PATCH 1/1 memblock: fix section mismatch warning again

From: Mike Rapoport <[email protected]>

Commit 34dc2efb39a2 ("memblock: fix section mismatch warning") marked memblock_bottom_up() and memblock_set_bottom_up() as __init, but they could be referenced from non-init functions like memblock_find_in_range_node() on architectures that enable CONFIG_ARCH_KEEP_MEMBLOCK.

For such builds kernel test robot reports:
All warnings (new ones prefixed by >>, old ones prefixed by <<):

Quoted 1 line
Quoted 1 line

WARNING: modpost: vmlinux.o(.text+0x74fea4): Section mismatch in reference from the function memblock_find_in_range_node() to the function .init.text:memblock_bottom_up()

The function memblock_find_in_range_node() references the function __init memblock_bottom_up().
This is often because memblock_find_in_range_node lacks a __init annotation or the annotation of memblock_bottom_up is wrong.

Replace __init annotations with __init_memblock annotations so that the appropriate section will be selected depending on CONFIG_ARCH_KEEP_MEMBLOCK.

---

@Andrew, please let me know if you'd prefer this merged via memblock tree.

 include/linux/memblock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/memblock.h +2 -2
index d13e3cd938b4..5984fff3f175 100644
@@ -460,7 +460,7 @@ static inline void memblock_free_late(phys_addr_t base, phys_addr_t size)
 /*
  * Set the allocation direction to bottom-up or top-down.
  */
-static inline __init void memblock_set_bottom_up(bool enable)
+static inline __init_memblock void memblock_set_bottom_up(bool enable)
 {
 	memblock.bottom_up = enable;
 }
@@ -470,7 +470,7 @@ static inline __init void memblock_set_bottom_up(bool enable)
  * if this is true, that said, memblock will allocate memory
  * in bottom-up direction.
  */
-static inline __init bool memblock_bottom_up(void)
+static inline __init_memblock bool memblock_bottom_up(void)
 {
 	return memblock.bottom_up;
 }
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 47 lines · Mike Rapoport

From: Mike Rapoport <[email protected]>

Commit 34dc2efb39a2 ("memblock: fix section mismatch warning") marked memblock_bottom_up() and memblock_set_bottom_up() as __init, but they could be referenced from non-init functions like memblock_find_in_range_node() on architectures that enable CONFIG_ARCH_KEEP_MEMBLOCK.

For such builds kernel test robot reports:
All warnings (new ones prefixed by >>, old ones prefixed by <<):

Quoted 1 line
Quoted 1 line

WARNING: modpost: vmlinux.o(.text+0x74fea4): Section mismatch in reference from the function memblock_find_in_range_node() to the function .init.text:memblock_bottom_up()

The function memblock_find_in_range_node() references the function __init memblock_bottom_up().
This is often because memblock_find_in_range_node lacks a __init annotation or the annotation of memblock_bottom_up is wrong.

Replace __init annotations with __init_memblock annotations so that the appropriate section will be selected depending on CONFIG_ARCH_KEEP_MEMBLOCK.

---

@Andrew, please let me know if you'd prefer this merged via memblock tree.

  include/linux/memblock.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/memblock.h +1 -1
index d13e3cd938b4..5984fff3f175 100644
@@ -460,7 +460,7 @@ static inline void memblock_free_late(phys_addr_t base, phys_addr_t size)
  /*
   * Set the allocation direction to bottom-up or top-down.
   */
-static inline __init void memblock_set_bottom_up(bool enable)
+static inline __init_memblock void memblock_set_bottom_up(bool enable)
  {
  	memblock.bottom_up = enable;
  }

include/linux/memblock.h static inline __init void memblock_set_bottom_up(bool enable) · line 476

Quoted 8 lines
include/linux/memblock.h +1 -1
@@ -470,7 +470,7 @@ static inline __init void memblock_set_bottom_up(bool enable)
   * if this is true, that said, memblock will allocate memory
   * in bottom-up direction.
   */
-static inline __init bool memblock_bottom_up(void)
+static inline __init_memblock bool memblock_bottom_up(void)
  {
  	return memblock.bottom_up;
  }
Signature · 3 lines
Thanks,

David / dhildenb
Acked-by on v1 1/1
#2 lore raw
In reply to Mike Rapoport
Quoted 21 lines · Mike Rapoport

From: Mike Rapoport <[email protected]>

Commit 34dc2efb39a2 ("memblock: fix section mismatch warning") marked memblock_bottom_up() and memblock_set_bottom_up() as __init, but they could be referenced from non-init functions like memblock_find_in_range_node() on architectures that enable CONFIG_ARCH_KEEP_MEMBLOCK.

For such builds kernel test robot reports:
All warnings (new ones prefixed by >>, old ones prefixed by <<):

Quoted 1 line
Quoted 1 line

WARNING: modpost: vmlinux.o(.text+0x74fea4): Section mismatch in reference from the function memblock_find_in_range_node() to the function .init.text:memblock_bottom_up()

The function memblock_find_in_range_node() references the function __init memblock_bottom_up().
This is often because memblock_find_in_range_node lacks a __init annotation or the annotation of memblock_bottom_up is wrong.

Replace __init annotations with __init_memblock annotations so that the appropriate section will be selected depending on CONFIG_ARCH_KEEP_MEMBLOCK.

Quoted 5 lines

Thank you Mike.

Quoted 32 lines

---

@Andrew, please let me know if you'd prefer this merged via memblock tree.

 include/linux/memblock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/memblock.h +2 -3
index d13e3cd938b4..5984fff3f175 100644
@@ -460,7 +460,7 @@ static inline void memblock_free_late(phys_addr_t base, phys_addr_t size)
 /*
  * Set the allocation direction to bottom-up or top-down.
  */
-static inline __init void memblock_set_bottom_up(bool enable)
+static inline __init_memblock void memblock_set_bottom_up(bool enable)
 {
        memblock.bottom_up = enable;
 }
@@ -470,7 +470,7 @@ static inline __init void memblock_set_bottom_up(bool enable)
  * if this is true, that said, memblock will allocate memory
  * in bottom-up direction.
  */
-static inline __init bool memblock_bottom_up(void)
+static inline __init_memblock bool memblock_bottom_up(void)
 {
        return memblock.bottom_up;
 }
--

2.28.0

Signature · 2 lines
Thanks,
~Nick Desaulniers