Re: Section mismatches in memblock

From: H. Peter Anvin
Date: Tue Oct 05 2010 - 22:31:11 EST


On 10/05/2010 04:30 PM, Yinghai Lu wrote:
>
> looks like gcc problem.

What makes you say that?

> | 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.
>

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

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/