[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1273796396-29649-16-git-send-email-yinghai@kernel.org>
Date: Thu, 13 May 2010 17:19:36 -0700
From: Yinghai Lu <yinghai@...nel.org>
To: Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: David Miller <davem@...emloft.net>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org,
Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH 15/35] x86, lmb: Add lmb_reserve_area_overlap_ok()
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>
---
arch/x86/include/asm/lmb.h | 1 +
arch/x86/mm/lmb.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/lmb.h b/arch/x86/include/asm/lmb.h
index dd42ac1..9329e09 100644
--- a/arch/x86/include/asm/lmb.h
+++ b/arch/x86/include/asm/lmb.h
@@ -7,6 +7,7 @@ u64 lmb_find_area_size(u64 start, u64 *sizep, u64 align);
void lmb_to_bootmem(u64 start, u64 end);
void lmb_reserve_area(u64 start, u64 end, char *name);
+void lmb_reserve_area_overlap_ok(u64 start, u64 end, char *name);
void lmb_free_area(u64 start, u64 end);
void lmb_add_memory(u64 start, u64 end);
struct range;
diff --git a/arch/x86/mm/lmb.c b/arch/x86/mm/lmb.c
index 19a5f49..1100c18 100644
--- a/arch/x86/mm/lmb.c
+++ b/arch/x86/mm/lmb.c
@@ -309,6 +309,24 @@ void __init lmb_reserve_area(u64 start, u64 end, char *name)
lmb_add_region(&lmb.reserved, start, end - start);
}
+/*
+ * 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_add_region(&lmb.reserved, start, end - start);
+}
+
void __init lmb_free_area(u64 start, u64 end)
{
if (start == end)
--
1.6.4.2
--
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