From: Benjamin Herrenschmidt on
On Tue, 2010-07-27 at 22:53 -0700, H. Peter Anvin wrote:
> On 07/27/2010 10:19 PM, Benjamin Herrenschmidt wrote:
> >
> > Screw it, I don't like it but I'll just split your patch in two for now
> > and keep 0. It's a bit fishy but memblock does mostly top-down
> > allocations and so shouldn't hit 0, and in practice the region at 0 is,
> > I beleive, reserved, but we need to be extra careful and might need to
> > revisit that a bit.
> >
> > That's an area where I don't completely agree with Linus, ie, 0 is a
> > perfectly valid physical address for memblock to return :-)
> >
>
> On x86, physical address 0 contains the real-mode IVT and will thus be
> reserved, at least for the forseeable future. Other architectures may
> very well have non-special RAM there.

Right, that's my point. Anyways, I'm making 0 special for now and adding
a wart to prevent the allocator from returning something below
PAGE_SIZE. If we want to revisit that later we can.

Cheers,
Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Benjamin Herrenschmidt on
On Tue, 2010-07-27 at 23:01 -0700, David Miller wrote:
> > On x86, physical address 0 contains the real-mode IVT and will thus be
> > reserved, at least for the forseeable future. Other architectures may
> > very well have non-special RAM there.
>
> 0 is very much possible on sparc64

Yup, we need to fix that.

For now I made MEMBLOCK_ERROR 0 and added a blurb to prevent allocating
the first page since it would cause other problems with the current code
(0 is after all the normal error result from membloc_alloc(), ie, our
API wasn't quite consistent there).

So I don't think I'm introducing a regression here, on the contrary. But
if we are going to allow lmb_alloc() to return 0, we need to fix all
callers first and then we can look into turning MEMBLOCK_ERROR back to
~0

Cheers,
Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Benjamin Herrenschmidt on
On Tue, 2010-07-27 at 23:13 -0700, Yinghai Lu wrote:
> So still keep MEMBLOCK_ERROR to (~(phys_addr_t)0) ?

No point for now. lmb_alloc() etc... are defined as returning 0 for
failure so we would need to fix that too.

As I said in a previous email we do need to revisit the memblock error
handling.

> We can change some variable from unsigned long to phys_addr_t that
> will be assigned by memblock_find_base().
>
> that could avoid casting too.

That would be a good idea anyways if those are indeed carrying a
physical address.

Ben.


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