Re: [PATCH 13/13] memblock, x86: Replace memblock_x86_reserve/free_range() with generic ones

H. Peter Anvin
2011-07-14T20:10:35Z

On 07/12/2011 02:16 AM, Tejun Heo wrote:
> --- a/mm/memblock.c
> +++ b/mm/memblock.c
> @@ -449,6 +449,9 @@ long __init_memblock memblock_remove(phys_addr_t base, phys_addr_t size)
>
> long __init_memblock memblock_free(phys_addr_t base, phys_addr_t size)
> {
> + memblock_dbg(" memblock_free: [%#016llx-%#016llx] %pF\n",
> + base, base + size, (void *)_RET_IP_);
> +
> return __memblock_remove(&memblock.reserved, base, size);
> }
>
> @@ -456,6 +459,8 @@ long __init_memblock memblock_reserve(phys_addr_t base, phys_addr_t size)
> {
> struct memblock_type *_rgn = &memblock.reserved;
>
> + memblock_dbg("memblock_reserve: [%#016llx-%#016llx] %pF\n",
> + base, base + size, (void *)_RET_IP_);
> BUG_ON(0 == size);
>
> return memblock_add_region(_rgn, base, size);

This assumes phys_addr_t == unsigned long long, which is just plain
wrong. I will fix it up, but please take more care with that in the
future. This triggers a warning when building for i386 non-PAE, which
is a good thing because it is a real error.

Also, don't we usually display resources as an *inclusive* range,
meaning that the last one should be base + size - 1?

-hpa