Skip to contentSkip to conversation

Section mismatches in memblock

DISCUSSION H. Peter Anvin 4 participants 5 messages Oct 5, 2010 – Oct 8, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

o.i386-allconfig/make.log:WARNING: mm/built-in.o(.text+0x48b6f): Section mismatch in reference from the function memblock_is_memory() to the variable .init.data:memblock
o.i386-allconfig/make.log:The function memblock_is_memory() references o.i386-allconfig/make.log:This is often because memblock_is_memory lacks a __initdata
o.i386-allconfig/make.log:WARNING: mm/built-in.o(.text+0x48bb0): Section mismatch in reference from the function memblock_is_region_memory() to the variable .init.data:memblock o.i386-allconfig/make.log:The function memblock_is_region_memory() references
o.i386-allconfig/make.log:This is often because memblock_is_region_memory lacks a __initdata o.i386-allconfig/make.log:WARNING: mm/built-in.o(.text+0x48bd5): Section mismatch in reference from the function memblock_is_region_memory() to the variable .init.data:memblock o.i386-allconfig/make.log:The function memblock_is_region_memory() references
o.i386-allconfig/make.log:This is often because memblock_is_region_memory lacks a __initdata

Happens with both i386 and x86-64.

-hpa

#1 lore raw
Quoted 21 lines · H. Peter Anvin

o.i386-allconfig/make.log:WARNING: mm/built-in.o(.text+0x48b6f): Section mismatch in reference from the function memblock_is_memory() to the variable .init.data:memblock
o.i386-allconfig/make.log:The function memblock_is_memory() references o.i386-allconfig/make.log:This is often because memblock_is_memory lacks a __initdata
o.i386-allconfig/make.log:WARNING: mm/built-in.o(.text+0x48bb0): Section mismatch in reference from the function memblock_is_region_memory() to the variable .init.data:memblock o.i386-allconfig/make.log:The function memblock_is_region_memory() references
o.i386-allconfig/make.log:This is often because memblock_is_region_memory lacks a __initdata o.i386-allconfig/make.log:WARNING: mm/built-in.o(.text+0x48bd5): Section mismatch in reference from the function memblock_is_region_memory() to the variable .init.data:memblock o.i386-allconfig/make.log:The function memblock_is_region_memory() references
o.i386-allconfig/make.log:This is often because memblock_is_region_memory lacks a __initdata

Quoted 1 line

Happens with both i386 and x86-64.

[PATCH] memblock: Fix section mismatch warnings with memblock_search()

HPA found
o.i386-allconfig/make.log:WARNING: mm/built-in.o(.text+0x48b6f): Section mismatch in reference from the function memblock_is_memory() to the variable .init.data:memblock
o.i386-allconfig/make.log:The function memblock_is_memory() references o.i386-allconfig/make.log:This is often because memblock_is_memory lacks a __initdata
o.i386-allconfig/make.log:WARNING: mm/built-in.o(.text+0x48bb0): Section mismatch in reference from the function memblock_is_region_memory() to the variable .init.data:memblock o.i386-allconfig/make.log:The function memblock_is_region_memory() references
o.i386-allconfig/make.log:This is often because memblock_is_region_memory lacks a __initdata

looks like gcc problem.

| static int memblock_search(struct memblock_type *type, phys_addr_t addr)
| {
|	.....
| }
|
|int __init memblock_is_reserved(phys_addr_t addr)
|{
|        return memblock_search(&memblock.reserved, addr) != -1;
|}
|
|int __init_memblock memblock_is_memory(phys_addr_t addr)
|{
|        return memblock_search(&memblock.memory, addr) != -1;
|}

Because We already have __init for those two functions.

Just make memblock_search to have __init_memblock atribute.

---
 mm/memblock.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memblock.c +1 -1
Index: linux-2.6/mm/memblock.c
===================================================================
@@ -653,7 +653,7 @@ void __init memblock_enforce_memory_limi
 	}
 }
 
-static int memblock_search(struct memblock_type *type, phys_addr_t addr)
+static int __init_memblock memblock_search(struct memblock_type *type, phys_addr_t addr)
 {
 	unsigned int left = 0, right = type->cnt;
 
#2 lore raw
Quoted 2 lines · Yinghai Lu

looks like gcc problem.

What makes you say that?

Quoted 15 lines
| static int memblock_search(struct memblock_type *type, phys_addr_t addr)
| {
|	.....
| }
|
|int __init memblock_is_reserved(phys_addr_t addr)
|{
|        return memblock_search(&memblock.reserved, addr) != -1;
|}
|
|int __init_memblock memblock_is_memory(phys_addr_t addr)
|{
|        return memblock_search(&memblock.memory, addr) != -1;
|}
Quoted 4 lines

Because We already have __init for those two functions.

Just make memblock_search to have __init_memblock atribute.

Wrong functions! Furhtermore, at least the tip tree definitely does not have __init_memblock here:

static int memblock_search(struct memblock_type *type, phys_addr_t addr)

{
        unsigned int left = 0, right = type->cnt;

        do {
                unsigned int mid = (right + left) / 2;

                if (addr < type->regions[mid].base)
                        right = mid;
                else if (addr >= (type->regions[mid].base +
                                  type->regions[mid].size))
                        left = mid + 1;
                else
                        return mid;
        } while (left < right);
        return -1;
}

int __init memblock_is_reserved(phys_addr_t addr)

{
        return memblock_search(&memblock.reserved, addr) != -1;
}

int memblock_is_memory(phys_addr_t addr)

{
        return memblock_search(&memblock.memory, addr) != -1;
}

int memblock_is_region_memory(phys_addr_t base, phys_addr_t size)

{
        int idx = memblock_search(&memblock.reserved, base);

        if (idx == -1)
                return 0;
        return memblock.reserved.regions[idx].base <= base &&
                (memblock.reserved.regions[idx].base +
                 memblock.reserved.regions[idx].size) >= (base + size);
}

... so I don't know why you're saying that you already have them.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#3 lore raw
Quoted 4 lines · H. Peter Anvin

Wrong functions! Furhtermore, at least the tip tree definitely does not have __init_memblock here:

Nevermind. I had missed that Ingo had put stuff into core/memblock on top of x86/memblock, just to be confusing.

-hpa

#4 lore raw
Quoted 8 lines · H. Peter Anvin
Quoted 4 lines · H. Peter Anvin

Wrong functions! Furhtermore, at least the tip tree definitely does not have __init_memblock here:

Nevermind. I had missed that Ingo had put stuff into core/memblock on top of x86/memblock, just to be confusing.

Correct - we better keep it as a generic, non-x86 topic as it affects other architectures. We can zap x86/memblock (it's fully contained in core/memblock) so that it's not confusing.

Thanks,

Ingo