This patch does 2 jobs: - Enforce the number of CPUs dom0 will take. See the new variable "dom0-cpus" in xend-config.sxp (you will want to set this variable to 1 on SMP systems) - Balloon out dom0 memory when creating domU, if there is not enough free memory. The lowest level we will balloon out is configured via the new variable "dom0-min-mem" in xend-config.sxp I still have a doubt: where to put the code to enforce dom0-cpus. At the moment I put it into python/xen/xend/server/SrvDaemon.py, and hopefully that is resonable enough. Any comment? Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com> $ diffstat enforce_resource.patch examples/xend-config.sxp | 8 +++++++ python/xen/xend/XendRoot.py | 10 +++++++++ python/xen/xend/server/SrvDaemon.py | 30 +++++++++++++++++++++++++++- python/xen/xm/create.py | 38 ++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ryan Harper
2005-Jul-29 15:17 UTC
Re: [Xen-devel] [PATCH] enforce dom0 cpus and balloon out memory
* aq <aquynh@gmail.com> [2005-07-29 09:01]:> This patch does 2 jobs: > > - Enforce the number of CPUs dom0 will take. See the new variable > "dom0-cpus" in xend-config.sxp (you will want to set this variable to > 1 on SMP systems)You could use vcpu-hotplug to drop the extra cpus from dom0 instead of writing directly into sysfs. The only stopper to that approach is the fact that dom0''s self.channel is not initialized when xend starts and subsequently doesn''t send the control message. Channels are initialized when a domain is built, but since dom0 is built by xen, the routine which sets up channels isn''t called for dom0. Haven''t found a good place for xend to initialized the channel for dom0 yet either. See vcpu_hotplug() in xen/xend/XendDomInfo.py Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Mark Williamson
2005-Jul-29 15:24 UTC
Re: [Xen-devel] [PATCH] enforce dom0 cpus and balloon out memory
> You could use vcpu-hotplug to drop the extra cpus from dom0 instead of > writing directly into sysfs. The only stopper to that approach is the > fact that dom0''s self.channel is not initialized when xend starts and > subsequently doesn''t send the control message. Channels are initialized > when a domain is built, but since dom0 is built by xen, the routine > which sets up channels isn''t called for dom0. Haven''t found a good place > for xend to initialized the channel for dom0 yet either.Hmmm. Is the channel never set up then? It''d certainly be nice if it were: then you can use "xm balloon" to set dom0''s memory footprint, which is preferable to using the /proc interface directly. Cheers, Mark> > See vcpu_hotplug() in xen/xend/XendDomInfo.py > > Ryan Harper > Software Engineer; Linux Technology Center > IBM Corp., Austin, Tx > (512) 838-9253 T/L: 678-9253 > ryanh@us.ibm.com > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ryan Harper
2005-Jul-29 15:43 UTC
Re: [Xen-devel] [PATCH] enforce dom0 cpus and balloon out memory
* Mark Williamson <mark.williamson@cl.cam.ac.uk> [2005-07-29 10:25]:> > You could use vcpu-hotplug to drop the extra cpus from dom0 instead of > > writing directly into sysfs. The only stopper to that approach is the > > fact that dom0''s self.channel is not initialized when xend starts and > > subsequently doesn''t send the control message. Channels are initialized > > when a domain is built, but since dom0 is built by xen, the routine > > which sets up channels isn''t called for dom0. Haven''t found a good place > > for xend to initialized the channel for dom0 yet either. > > Hmmm. Is the channel never set up then? It''d certainly be nice if it were:Correct. As mentioned above, this is only a problem for dom0 since the xend contruct_image() code isn''t called for dom0 as xen is the builder. The fix is as simple as calling create_channel() from dom0''s XendDomInfo object. I''ve not determined the appropriate location to issue the call.> then you can use "xm balloon" to set dom0''s memory footprint, which is > preferable to using the /proc interface directly.Indeed. Same goes for using vcpu_hotplug() versus sysfs -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Pratt
2005-Jul-29 17:26 UTC
RE: [Xen-devel] [PATCH] enforce dom0 cpus and balloon out memory
> You could use vcpu-hotplug to drop the extra cpus from dom0 > instead of writing directly into sysfs. The only stopper to > that approach is the fact that dom0''s self.channel is not > initialized when xend starts and subsequently doesn''t send > the control message. Channels are initialized when a domain > is built, but since dom0 is built by xen, the routine which > sets up channels isn''t called for dom0. Haven''t found a good > place for xend to initialized the channel for dom0 yet either. > > See vcpu_hotplug() in xen/xend/XendDomInfo.pyYep, I''d much prefer this approach -- its annoying the tools don''t work on dom0. Volunteers? Ian _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2005-Jul-29 17:50 UTC
Re: [Xen-devel] [PATCH] enforce dom0 cpus and balloon out memory
On 29 Jul 2005, at 18:26, Ian Pratt wrote:>> >> See vcpu_hotplug() in xen/xend/XendDomInfo.py > > Yep, I''d much prefer this approach -- its annoying the tools don''t work > on dom0. Volunteers?They certainly *ought* to work. I can assure you that xend does connect to domain0''s control interface. Otherwise you could not set up virtual blkif and netif connections to backend drivers running in domain0! This should be a small bugfix: no major implementation effort required. :-) -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ryan Harper
2005-Jul-29 18:26 UTC
Re: [Xen-devel] [PATCH] enforce dom0 cpus and balloon out memory
* Keir Fraser <Keir.Fraser@cl.cam.ac.uk> [2005-07-29 13:20]:> > On 29 Jul 2005, at 18:26, Ian Pratt wrote: > > >> > >>See vcpu_hotplug() in xen/xend/XendDomInfo.py > > > >Yep, I''d much prefer this approach -- its annoying the tools don''t work > >on dom0. Volunteers? > > They certainly *ought* to work. I can assure you that xend does connect > to domain0''s control interface. Otherwise you could not set up virtual > blkif and netif connections to backend drivers running in domain0! > > This should be a small bugfix: no major implementation effort required. > :-)Agreed. It is a simple matter of find the right place in the xend code to initialize the self.channel (calling crate_channel()) for dom0. I reported this a while ago. _something_ is wrong with self.channel in XendDomInfo object for dom0 as I noted in this message: http://lists.xensource.com/archives/html/xen-devel/2005-07/msg00444.html Also in bugzilla #101, I added a patch to show that the control message wasn''t sent because the channel is not valid. http://bugzilla.xensource.com/cgi-bin/bugzilla/show_bug.cgi?id=101 -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel