From: David Vrabel <david.vrabel@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: xen: memory initialization/balloon fixes (#3)
Date: Tue, 27 Sep 2011 15:09:13 +0100 [thread overview]
Message-ID: <4E81D909.8020603@citrix.com> (raw)
In-Reply-To: <20110924020759.GA27796@phenom.oracle.com>
On 24/09/11 03:08, Konrad Rzeszutek Wilk wrote:
> On Thu, Sep 15, 2011 at 01:29:21PM +0100, David Vrabel wrote:
>> This set of patches fixes some bugs in the memory initialization under
>> Xen and in Xen's memory balloon driver. They can make 100s of MB of
>> additional RAM available (depending on the system/configuration).
>>
>> Patch 1 is already applied.
>>
>> Patch 2 fixes a bug in patch 1 and should be queued for 3.1 (and along
>> with patch 1 considered for 3.0 stable).
>>
>> Patch 3 is a bug fix and should be queued for 3.1 and possibly
>> queued for the 3.0 stable tree.
>>
>> Patches 5 & 6 increase the amount of low memory in 32 bit domains
>> started with < 1 GiB of RAM. Please queue for 3.2
>>
>> Patch 7 releases all pages in the initial allocation with PFNs that
>> lie within a 1-1 mapping. This seems correct to me as I think that
>> once the 1-1 mapping is set the MFN of the original page is lost so
>> it's no longer accessible by the kernel (and it cannot be used by
>> another domain
>>
>> Changes since #2:
>>
>> - New patch: xen: avoid adding non-existant memory if the reservation
>> is unlimited
>> - Avoid using a hypercall to get the current number of pages in the
>> ballon driver. Apparently the hypercall won't return the right
>> value if paging is used.
>> - Addresses Konrad's review comments.
>
> They don't work on AMD boxes:
It's not specific to AMD boxes.
> (XEN) Xen-e820 RAM map:
> (XEN) 0000000000000000 - 000000000009d800 (usable)
It's because it's not correctly handling the half-page of RAM at the end
of this region.
I don't have access to any test boxes with a dodgy BIOS like this so can
you test this patch? If it works I'll fold it in and post an updated
series.
Can you remember why this page alignment was required? I'd like to
update the comment with the reason because the bare-metal x86 memory
init code doesn't appear to fixup the memory map in this way.
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 986661b..e473c4c 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -178,6 +178,19 @@ static unsigned long __init xen_get_max_pages(void)
return min(max_pages, MAX_DOMAIN_PAGES);
}
+static void xen_e820_add_region(u64 start, u64 size, int type)
+{
+ u64 end = start + size;
+
+ /* Align RAM regions to page boundaries. */
+ if (type == E820_RAM || type == E820_UNUSABLE) {
+ start = PAGE_ALIGN(start);
+ end &= ~((u64)PAGE_SIZE - 1);
+ }
+
+ e820_add_region(start, end - start, type);
+}
+
/**
* machine_specific_memory_setup - Hook for machine specific memory setup.
**/
@@ -253,10 +266,6 @@ char * __init xen_memory_setup(void)
u32 type = map[i].type;
if (type == E820_RAM) {
- /* RAM regions must be page aligned. */
- size -= (addr + size) % PAGE_SIZE;
- addr = PAGE_ALIGN(addr);
-
if (addr < mem_end) {
size = min(size, mem_end - addr);
} else if (extra_pages) {
@@ -267,7 +276,7 @@ char * __init xen_memory_setup(void)
type = E820_UNUSABLE;
}
- e820_add_region(addr, size, type);
+ xen_e820_add_region(addr, size, type);
map[i].addr += size;
map[i].size -= size;
David
next prev parent reply other threads:[~2011-09-27 14:09 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-15 12:29 xen: memory initialization/balloon fixes (#3) David Vrabel
2011-09-15 12:29 ` [PATCH 1/7] xen: use maximum reservation to limit amount of usable RAM David Vrabel
2011-09-21 15:09 ` Konrad Rzeszutek Wilk
2011-09-15 12:29 ` [PATCH 2/7] xen: avoid adding non-existant memory if the reservation is unlimited David Vrabel
2011-09-21 15:08 ` Unknown, Konrad Rzeszutek
2011-09-15 12:29 ` [PATCH 3/7] xen/balloon: account for pages released during memory setup David Vrabel
2011-09-21 15:05 ` Konrad Rzeszutek Wilk
2011-09-15 12:29 ` [PATCH 4/7] xen/balloon: simplify test for the end of usable RAM David Vrabel
2011-09-15 12:29 ` [PATCH 5/7] xen: allow balloon driver to use more than one memory region David Vrabel
2011-09-15 12:29 ` [PATCH 6/7] xen: allow extra memory to be in multiple regions David Vrabel
2011-09-15 12:29 ` [PATCH 7/7] xen: release all pages within 1-1 p2m mappings David Vrabel
2011-09-20 16:57 ` xen: memory initialization/balloon fixes (#3) Dan Magenheimer
2011-09-21 22:29 ` Dan Magenheimer
2011-09-22 12:32 ` David Vrabel
2011-09-22 17:06 ` Dan Magenheimer
2011-09-22 22:34 ` Dan Magenheimer
2011-09-22 22:51 ` Jeremy Fitzhardinge
2011-09-22 23:46 ` Dan Magenheimer
2011-09-23 10:45 ` David Vrabel
2011-09-23 13:28 ` Konrad Rzeszutek Wilk
2011-09-23 19:04 ` Dan Magenheimer
2011-09-21 17:11 ` Konrad Rzeszutek Wilk
2011-09-22 13:08 ` David Vrabel
2011-09-24 2:08 ` Konrad Rzeszutek Wilk
2011-09-26 14:20 ` Konrad Rzeszutek Wilk
2011-09-27 14:09 ` David Vrabel [this message]
2011-09-27 23:10 ` Konrad Rzeszutek Wilk
2011-09-28 10:45 ` David Vrabel
2011-09-28 13:25 ` Konrad Rzeszutek Wilk
2011-09-28 13:47 ` Konrad Rzeszutek Wilk
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=4E81D909.8020603@citrix.com \
--to=david.vrabel@citrix.com \
--cc=konrad.wilk@oracle.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.