From: Jacob Shin <jacob.shin@amd.com>
To: jeremy@goop.org, xen-devel@lists.xensource.com
Subject: [PATCH] xen: allow extra memory stay within lowest available range
Date: Tue, 24 Jan 2012 19:42:40 -0600 [thread overview]
Message-ID: <20120125014240.GA9561@jshin-Toonie> (raw)
We have a machine with 1.5 TB of memory which has a e820 that looks
like this:
(XEN) 0000000000000000 - 000000000008f400 (usable)
(XEN) 000000000008f400 - 00000000000a0000 (reserved)
(XEN) 00000000000d0000 - 0000000000100000 (reserved)
(XEN) 0000000000100000 - 00000000c7eb0000 (usable)
(XEN) 00000000c7eb0000 - 00000000c7ed8000 (ACPI data)
(XEN) 00000000c7ed8000 - 00000000c7eda000 (ACPI NVS)
(XEN) 00000000c7eda000 - 00000000c8000000 (reserved)
(XEN) 00000000c8000000 - 00000000c8001000 (reserved)
(XEN) 00000000d8000000 - 00000000d8001000 (reserved)
(XEN) 00000000d8400000 - 00000000d8401000 (reserved)
(XEN) 00000000d8800000 - 00000000d8801000 (reserved)
(XEN) 00000000fec00000 - 00000000fec10000 (reserved)
(XEN) 00000000fee00000 - 00000000fee01000 (reserved)
(XEN) 00000000fff00000 - 0000000100000000 (reserved)
(XEN) 0000000100000000 - 000000f038000000 (usable)
(XEN) 000000f038000000 - 000000fd00000000 (reserved)
(XEN) 0000010000000000 - 0000018fff000000 (usable)
Booting with dom0_mem=1024M, 2.6.32.48 adds extra pages for ballooning
at the end, and Dom0 panics:
..
[ 0.000000] Xen: 00000000fff00000 - 0000000100000000 (reserved)
[ 0.000000] Xen: 000000f038000000 - 000000fd00000000 (reserved)
[ 0.000000] Xen: 000000fd00000000 - 000000ff40000000 (usable)
..
[ 0.000000] init_memory_mapping: 0000000100000000-000000ff40000000
[ 0.000000] 0100000000 - ff40000000 page 4k
[ 0.000000] Kernel panic - not syncing: Cannot find space for the kernel page tables
..
[ 0.000000] [<ffffffff816699f9>] panic+0x8c/0x1a2
[ 0.000000] [<ffffffff81642da6>] init_memory_mapping+0x3d4/0x4b9
[ 0.000000] [<ffffffff81d068ba>] setup_arch+0x651/0xaaa
[ 0.000000] [<ffffffff81669b4b>] ? printk+0x3c/0x3e
[ 0.000000] [<ffffffff8166ba03>] ? _raw_spin_unlock_irqrestore+0x10/0x12
[ 0.000000] [<ffffffff81d00aa7>] start_kernel+0x8f/0x3ca
[ 0.000000] [<ffffffff81d002cb>] x86_64_start_reservations+0xb6/0xba
[ 0.000000] [<ffffffff81d04002>] xen_start_kernel+0x5a0/0x5a7
Below patch allows extra memory to settle on the first available memory
range that can accommodate it. Resulting e820 looks like this:
[ 0.000000] Xen: 00000000fff00000 - 0000000100000000 (reserved)
[ 0.000000] Xen: 0000000100000000 - 0000000340000000 (usable)
[ 0.000000] Xen: 000000f038000000 - 000000fd00000000 (reserved)
This patch is moot on 3.2 and later because another patch already handles
this case: dc91c728fddc29dfed1ae96f6807216b5f42d3a1 xen: allow extra
memory to be in multiple regions.
Signed-off-by: Jacob Shin <jacob.shin@amd.com>
---
arch/x86/xen/setup.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 46d6d21..1ce626d 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -240,6 +240,7 @@ char * __init xen_memory_setup(void)
memcpy(map_raw, map, sizeof(map));
e820.nr_map = 0;
xen_extra_mem_start = mem_end;
+ extra_limit = xen_get_max_pages();
for (i = 0; i < memmap.nr_entries; i++) {
unsigned long long end;
@@ -268,7 +269,9 @@ char * __init xen_memory_setup(void)
}
if (map[i].size > 0 && end > xen_extra_mem_start)
- xen_extra_mem_start = end;
+ if (PFN_DOWN(map[i].addr - xen_extra_mem_start) <
+ (extra_limit - max_pfn))
+ xen_extra_mem_start = end;
/* Add region if any remains */
if (map[i].size > 0)
@@ -305,7 +308,6 @@ char * __init xen_memory_setup(void)
sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
- extra_limit = xen_get_max_pages();
if (max_pfn + extra_pages > extra_limit) {
if (extra_limit > max_pfn)
extra_pages = extra_limit - max_pfn;
--
1.7.8.4
reply other threads:[~2012-01-25 1:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120125014240.GA9561@jshin-Toonie \
--to=jacob.shin@amd.com \
--cc=jeremy@goop.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).