All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Vasiliy G Tolstov <v.tolstov@selfip.ru>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>,
	xen-devel@lists.xensource.com
Subject: Re: memory size inside domU less than memory in domU config
Date: Thu, 16 Jun 2011 15:25:15 -0400	[thread overview]
Message-ID: <20110616192515.GA6100@dumpdata.com> (raw)
In-Reply-To: <1308251938.28653.9.camel@mobile>

[-- Attachment #1: Type: text/plain, Size: 1273 bytes --]

On Thu, Jun 16, 2011 at 11:18:58PM +0400, Vasiliy G Tolstov wrote:
> On Thu, 2011-06-16 at 12:12 -0700, Dan Magenheimer wrote:
> > I'm not sure, but I think Vasiliy's question is:
> > 
> > Why/where is 78MB of memory being "wasted"?  If one specifies
> > 2048MB (4096MB) of memory for the guest, why doesn't the guest
> > kernel report 2048MB (4096MB)?
> > 
> > Using Vasiliy's /proc/meminfo output from below:
> > 2048MB = 2097152KB; - 2016564KB = 80588KB = 78MB
> > 4096MB = 4194304KB; - 4113716KB = 80588KB = 78MB
> > 
> > Dan
> > 
> > Thanks... for the memory!
> > I really could use more / my throughput's on the floor
> > The balloon is flat / my swap disk's fat / I've OOM's in store
> > Overcommitted so much
> > (with apologies to Bob Hope)
> 
> =) Thanks Dan. May be this happening because i check dom0 support. I'm
> try to rebuild kernel to use Daniel's memory hotplug and disable dom0
> support.

Ah, that is what you meant. You are probably hitting a bug introduced
by 24bdb0b62cc82120924762ae6bc85afc8c3f2b26. Can you try the attached patch please?

It might not apply cleanly - if so you will have to manually fix it up.

Or you can merge stable/bug.fixes from

git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git

and that will take care of that.

[-- Attachment #2: xen_extra_mem_start.patch --]
[-- Type: text/x-diff, Size: 2376 bytes --]

commit acd049c6e99d2ad1195666195230f6881d1c1588
Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date:   Thu Jun 16 13:07:19 2011 -0400

    xen/setup: Fix for incorrect xen_extra_mem_start.
    
    The earlier attempts (24bdb0b62cc82120924762ae6bc85afc8c3f2b26)
    at fixing this problem caused other problems to surface (PV guests
    with no PCI passthrough would have SWIOTLB turned on - which meant
    64MB of precious contingous DMA32 memory being eaten up per guest).
    The problem was: "on xen we add an extra memory region at the end of
    the e820, and on this particular machine this extra memory region
    would start below 4g and cross over the 4g boundary:
    
    [0xfee01000-0x192655000)
    
    Unfortunately e820_end_of_low_ram_pfn does not expect an
    e820 layout like that so it returns 4g, therefore initial_memory_mapping
    will map [0 - 0x100000000), that is a memory range that includes some
    reserved memory regions."
    
    The memory range was the IOAPIC regions, and with the 1-1 mapping
    turned on, it would map them as RAM, not as MMIO regions. This caused
    the hypervisor to complain. Fortunately this is experienced only under
    the initial domain so we guard for it.
    
    Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index be1a464..60aeeb5 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -227,11 +227,7 @@ char * __init xen_memory_setup(void)
 
 	memcpy(map_raw, map, sizeof(map));
 	e820.nr_map = 0;
-#ifdef CONFIG_X86_32
 	xen_extra_mem_start = mem_end;
-#else
-	xen_extra_mem_start = max((1ULL << 32), mem_end);
-#endif
 	for (i = 0; i < memmap.nr_entries; i++) {
 		unsigned long long end;
 
@@ -266,6 +262,12 @@ char * __init xen_memory_setup(void)
 		if (map[i].size > 0)
 			e820_add_region(map[i].addr, map[i].size, map[i].type);
 	}
+	/* Align the balloon area so that max_low_pfn does not get set
+	 * to be at the _end_ of the PCI gap at the far end (fee01000).
+	 * Note that xen_extra_mem_start gets set in the loop above to be
+	 * past the last E820 region. */
+	if (xen_initial_domain() && (xen_extra_mem_start < (1ULL<<32)))
+		xen_extra_mem_start = (1ULL<<32);
 
 	/*
 	 * In domU, the ISA region is normal, usable memory, but we

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  reply	other threads:[~2011-06-16 19:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-16 18:19 memory size inside domU less than memory in domU config Vasiliy G Tolstov
2011-06-16 18:40 ` Konrad Rzeszutek Wilk
2011-06-16 18:45   ` Vasiliy G Tolstov
2011-06-16 19:12     ` Dan Magenheimer
2011-06-16 19:18       ` Vasiliy G Tolstov
2011-06-16 19:25         ` Konrad Rzeszutek Wilk [this message]
2011-06-16 21:32           ` Vasiliy G Tolstov
2011-06-17  9:51 ` Jan Beulich
2011-06-17 10:03   ` Vasiliy G Tolstov
2011-06-20 14:36     ` Konrad Rzeszutek Wilk
2011-06-20 14:55       ` Vasiliy G Tolstov
2011-06-20 15:07         ` 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=20110616192515.GA6100@dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=v.tolstov@selfip.ru \
    --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.