From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Knowles Subject: Re: [PATCH 0/2] xl: Add subcommand mem-max and fix mem-set Date: Wed, 12 May 2010 16:33:31 +0100 Message-ID: <4BEACA4B.7050701@eu.citrix.com> References: <4BE3DFBE.2010901@cn.fujitsu.com> <19428.20752.717993.453216@mariner.uk.xensource.com> <4BE67620.7010803@cn.fujitsu.com> <4BEA4A13.3000801@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4BEA4A13.3000801@cn.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Yu Zhiguo Cc: "xen-devel@lists.xensource.com" , Ian Jackson , Keir Fraser , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org 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