On 09/01/2010 10:56 AM, Ian Campbell wrote:
> On Wed, 2010-09-01 at 17:53 +0100, Jeremy Fitzhardinge wrote:
>> On 09/01/2010 05:44 AM, Ian Campbell wrote:
>>> On Wed, 2010-09-01 at 13:31 +0100, Michal Novotny wrote:
>>>> this is the patch to disallow changing the maxmem value to higher value
>>>> than total physical memory size since without this patch I was able to
>>>> set dom0 maxmem to higher (invalid) value which is not correct.
>>> I think it is allowable for a domU though. Consider the scenario where
>>> you have two hosts, one of which has more physical RAM than the other.
>>> You may which to boot a domain on the smaller host, (i.e. booting
>>> ballooned with a current_pages suitable for the small host) and then
>>> migrate it to the large machine where you then want to be able to
>>> balloon to a value larger than was even possible on the previous
>> But max-mem can change between hosts; on the small host it needn't have
>> a maxmem larger than the host's memory. (The domain itself may have a
>> larger notion of maxmem internally, but that's separate.)
> It's not separate, this guest configuration item precisely informs the
> guest how large it can expect it's memory map to ever need to be (the
> setting is also called the static-max in both xend and xapi).
No, that is separate. There are three values:
1. the domain's initial memory allocation
2. the max size the domain will ever grow to
3. the max size Xen will allow the domain to grow to right now
At domain build time, the domain needs to know 1 and 2, but 3 is
irrelevant (so long it is larger than 1).
2 can be arbitrarily large. The domain may not need to know about 2 at
all if it can dynamically add memory at runtime via, say, memory
hotplug. It only matters if it needs to statically allocate space in
its memory map for future balloonings.
There's no need for 3 to ever be larger than the host's physical memory,
and it can be changed at will (if the host memory size changes due to
hotplug memory, save/restore or migrate).
AFAICT, "static-max" is completely useless, at least for PV Linux
domains, because the kernel needs to get that value when its
constructing its basic memory mappings, way before it has any chance to
talk to xenstore. When else is it useful?
> For a PV guest the value is pushed down into the hypervisor by the
> toolstack via XENMEM_set_memory_map and this controls the memory map
> returned to the guest from XENMEM_get_memory_map, which in turn informs
> the guest's choice of maxmem value (for PV guests which can boot
> ballooned that is).
OK, I need to investigate that. But the maxmem size for the domain
should be something derived from the domain's config file, and have no
direct relationship to Xen's current maxmem for that domain (though the
toolstack may choose to make them the same at build time).
> For an HVM guest maxmem sets (via HVM loader) the limit of the e820
> presented to the guest.
Presumably that's a value constructed by the domain builder which -
again - needn't have any relationship to the Xen maxmem.
Xen-devel mailing list