Skip to contentSkip to conversation

powerpc/msi: fix section mismatch warning

PATCH Superseded Denis Kirjanov 3 participants 4 messages Oct 21, 2015 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/msi: fix section mismatch warning

Building with CONFIG_DEBUG_SECTION_MISMATCH
gives the following warning:

WARNING: vmlinux.o(.text+0x41fa8): Section mismatch in reference from the function .msi_bitmap_alloc() to the function .init.text:.memblock_virt_alloc_try_nid()
The function .msi_bitmap_alloc() references
the function __init .memblock_virt_alloc_try_nid().
This is often because .msi_bitmap_alloc lacks a __init annotation or the annotation of .memblock_virt_alloc_try_nid is wrong.

---
 arch/powerpc/include/asm/msi_bitmap.h | 2 +-
 arch/powerpc/sysdev/msi_bitmap.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/msi_bitmap.h +1 -1
index 1ec7125..fbd3424 100644
@@ -29,7 +29,7 @@ void msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq);
 
 int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp);
 
-int msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
+int __init_refok msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
 		     struct device_node *of_node);
 void msi_bitmap_free(struct msi_bitmap *bmp);
 
arch/powerpc/sysdev/msi_bitmap.c +1 -1
index 1a826f3..ed5234e 100644
@@ -112,7 +112,7 @@ int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp)
 	return 0;
 }
 
-int msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
+int __init_refok msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
 		     struct device_node *of_node)
 {
 	int size;
Signature · 1 line
2.4.0
#1 lore raw
Quoted 11 lines · On Wednesday 21 October 2015 08:56:44 Denis Kirjanov wrote:

Building with CONFIG_DEBUG_SECTION_MISMATCH
gives the following warning:

WARNING: vmlinux.o(.text+0x41fa8): Section mismatch in reference from the function .msi_bitmap_alloc() to the function .init.text:.memblock_virt_alloc_try_nid()
The function .msi_bitmap_alloc() references
the function __init .memblock_virt_alloc_try_nid().
This is often because .msi_bitmap_alloc lacks a __init annotation or the annotation of .memblock_virt_alloc_try_nid is wrong.

Quoted 2 lines

A patch like this usually requires an explanation why the warning is a false positive and why there is no way to solve it besides suppressing the warning.

Arnd

#2 lore raw
Quoted 12 lines · Arnd Bergmann
Quoted 11 lines · On Wednesday 21 October 2015 08:56:44 Denis Kirjanov wrote:

Building with CONFIG_DEBUG_SECTION_MISMATCH
gives the following warning:

WARNING: vmlinux.o(.text+0x41fa8): Section mismatch in reference from the function .msi_bitmap_alloc() to the function .init.text:.memblock_virt_alloc_try_nid()
The function .msi_bitmap_alloc() references
the function __init .memblock_virt_alloc_try_nid().
This is often because .msi_bitmap_alloc lacks a __init annotation or the annotation of .memblock_virt_alloc_try_nid is wrong.

Quoted 6 lines
Quoted 2 lines

A patch like this usually requires an explanation why the warning is a false positive and why there is no way to solve it besides suppressing the warning.

Because memory allocation in msi_bitmap_alloc use either slab allocator or memblock boot-time allocator so that's why we need the __init_refok for the latter case. I'll add it to the patch description

Quoted 3 lines

Arnd

#3 lore raw
In reply to Denis Kirjanov

Hi Denis,

arch/powerpc/include/asm/msi_bitmap.h void msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq); · line 33

Quoted 12 lines · On Wed, 21 Oct 2015 08:56:44 +0300 Denis Kirjanov <[email protected]> wrote:
arch/powerpc/include/asm/msi_bitmap.h +1 -1
index 1ec7125..fbd3424 100644
@@ -29,7 +29,7 @@ void msi_bitmap_reserve_hwirq(struct msi_bitmap *bmp, unsigned int hwirq);
 
 int msi_bitmap_reserve_dt_hwirqs(struct msi_bitmap *bmp);
 
-int msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
+int __init_refok msi_bitmap_alloc(struct msi_bitmap *bmp, unsigned int irq_count,
 		     struct device_node *of_node);

I am pretty sure that we don't want or need the annotation in the header file.

Signature · 2 lines
Cheers,
Stephen Rothwell                    [email protected]