[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1271132476.13059.66.camel@pasglop>
Date: Tue, 13 Apr 2010 14:21:16 +1000
From: Benjamin Herrenschmidt <benh@...nel.crashing.org>
To: Yinghai Lu <yinghai@...nel.org>
Cc: Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>,
Andrew Morton <akpm@...ux-foundation.org>,
David Miller <davem@...emloft.net>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Subject: Re: [PATCH 18/39] lmb: Add lmb_reserve_area_overlap_ok()
On Thu, 2010-04-08 at 23:03 -0700, Yinghai Lu wrote:
> Some areas from firmware could be reserved several times from different callers.
>
> If these area are overlapped, We may have overlapped entries in lmb.reserved.
>
> Try to free the area at first, before rerserve them again.
>
> Signed-off-by: Yinghai Lu <yinghai@...nel.org>
> ---
> +
> +/*
> + * Could be used to avoid having overlap entries in lmb.reserved.region.
> + * Don't need to use it with area that is from lmb_find_area()
> + * Only use it for the area that fw hidden area.
> + */
> +void __init lmb_reserve_area_overlap_ok(u64 start, u64 end, char *name)
> +{
> + if (start == end)
> + return;
> +
> + if (WARN_ONCE(start > end, "lmb_reserve_area_overlap_ok: wrong range [%#llx, %#llx]\n", start, end))
> + return;
> +
> + /* Free that region at first */
> + lmb_free(start, end - start);
> + __lmb_reserve_area(start, end, name);
> }
That is going to only work with one overlap. IE. lmb_free() will not do
very well unless it's a one and only match.
You should modify it to work in a loop.
Besides, lmb_reserve_area_overlap_ok() sucks as a name :-)
Cheers,
Ben.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists