WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 0/2] xl: Add subcommand mem-max and fix mem-set

To: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 0/2] xl: Add subcommand mem-max and fix mem-set
From: Jonathan Knowles <jonathan.knowles@xxxxxxxxxxxxx>
Date: Wed, 12 May 2010 16:33:31 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxxx>, Stefano Stabellini <Stefano.Stabellini@xxxxxxxxxxxxx>
Delivery-date: Wed, 12 May 2010 08:34:30 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4BEA4A13.3000801@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4BE3DFBE.2010901@xxxxxxxxxxxxxx> <19428.20752.717993.453216@xxxxxxxxxxxxxxxxxxxxxxxx> <4BE67620.7010803@xxxxxxxxxxxxxx> <4BEA4A13.3000801@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.5) Gecko/20091204 Lightning/1.0b1 Thunderbird/3.0
Hi all

As one of the maintainers of the Xen API tool-stack [1], I have
a couple of comments about these patches.

Currently, the Xen API tool-stack does not use libxenlight, but
we're interested in moving to it in the near future.

Yu Zhiguo wrote:
I'm trying to add subcommand 'mem-max', I think
xc_domain_setmaxmem should be used in it but not here.

I'll move this code to 'mem-max', and in 'mem-set', a check
should be added because setting memory larger than max memory
is invalid.

1. Add 'mem-max' Add libxl_domain_setmaxmem, it calls
xc_domain_setmaxmem. /local/domain/$domid/memory/static-max
should be updated when set max memory, it is missing now.

From the point of view of the Xen API tool-stack, these values
have different purposes.

1. The XenStore value: /local/domain/$domid/memory/static-max

   This value reflects the maximum amount of physical host memory
   that's addressable by the guest OS.

   The Xen API tool-stack writes this value into XenStore at the
   time of domain construction, and leaves the value alone until
   the domain is destroyed.

   I think it would make sense for libxenlight to do the same.

   Many balloon drivers read this value, along with the "target"
   field, in order to determine how large they should make their
   balloons:

   balloon size = (static-max - target)

   In the absence of hotplug support, balloon drivers expect the
   value of "static-max" to remain constant for the lifetime of
   the domain.

2. The Xen value: maxmem

  Xen uses this value as a sort of "ratchet", to prevent a domain
  that's currently ballooned down from growing too large.

  Xen will reject any call to domain_memory_increase_reservation
  that would increase the reservation beyond the value of maxmex.

  It's possible to change the value of "maxmex" while a domain is
  running. Indeed, whenever the Xen API tool-stack writes a new
  balloon target into XenStore, it also calls xc_domain_setmaxmem
  with the same value.

  This mechanism allows the tool-stack to prevent a balloon driver
  from claiming back more memory if the guest is already using more
  than its target memory allocation.

So, I think it's fair to say that locking these two values
together does not make sense from the point of view of the Xen API
tool-stack.

2. fix 'mem-set' Delete xc_domain_setmaxmem. Get max
 memory from /local/domain/$domid/memory/static-max,
 and then do value check. It seems that we cannot get
 max memory use libxc routines.

If the purpose of "mem-set" is to set a balloon target for a
guest, then it might also make sense to call xc_domain_setmaxmem
with the same value, whenever the target changes, for the reasons
stated above (preventing a domain that's currently ballooned down
from growing too large).

I fixed it, please check.

[PATCH 1/2] xl: Add command 'xl mem-max' [PATCH 2/2]
xl: Add check for command 'xl mem-set'

Cheers,
Jonathan

[1] http://www.xen.org/products/cloud_source.html

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