[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Fix e820 mapping limit

The changeset '12803:df5fa63490f4da7b65c56087a68783dbcb7944f8' added a new
hypercall XENMEM_set_memory_map for specifying the e820 mapping. There was
a small bug in the userspace side of this change though - the e820 mapping
was specified based on the 'memory_static_min' domain info parameter which
means the memory map size is clamped to the value 'memory' config option.

What we actually want is to setup the e820 map limit based on 'maxmem'
config option, so that we can balloon up the guest to its max limit.

  If we boot with 'memory=400' and 'maxmem=800', the e820 map should be
  set to 800 MB, and the guest should allocate  only 400 MB at startup.
  It should then be possible to use 'xm mem-set' after boot to assgin
  upto this 800 MB.

Thus, the attached patch fixed the image.py class to setup the e820 mapping
based on 'memory_static_max' which is in turn based on 'maxmem'. Booting
with this patch I can verify that the guest kernel sees a 800 MB e820 map,
so this fixes the initial problem.

There appears to be a second issue somewhere in the stack though, because
even if do 'xm mem-set <domid> 600', while the ballon driver in the guest
will see the 600 MB target, it will still never try to allocate its 
increased target.


  # grep mem /etc/xen/demo 
  memory = 410
  maxmem = 800
  # xm create demo

In the guest  'dmesg' shows:

  BIOS-provided physical RAM map:
   Xen: 0000000000000000 - 0000000032800000 (usable)

Back on the host:

  # xm list --long demo | grep mem
    (memory 410)
    (maxmem 800)
    (shadow_memory 0)
    (memory_dynamic_min 410)
    (memory_dynamic_max 410)

  # xm mem-set demo 600

  # xm list --long demo | grep mem
    (memory 600)
    (maxmem 800)
    (shadow_memory 0)
    (memory_dynamic_min 410)
    (memory_dynamic_max 410)

Looking at balloon driver in guest:

  $ cat /tmp/balloon 
  Current allocation:   419840 kB
  Requested target:     614400 kB
  Low-mem balloon:      407552 kB
  High-mem balloon:          0 kB
  Driver pages:              0 kB
  Xen hard limit:       419840 kB

And the memory target spceified in xenstore:

  # xenstore-ls | grep target
    target = "614400"

So, for some reason even though the guest e820 map is correct, and the memory
target got increased to 600 MB, the balloon driver is not actually ever trying
to increase its allocation.   Do we need to also fixup the 
parameters in XenD too ?  xm mem-set only affects memory_static_min

Anyway, attaching the patch to fix e820 map limits.

  Signed-off-by: Daniel Berrange <berrange@xxxxxxxxxx

|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

Attachment: xen-mem-e820-size.patch
Description: Text document

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.