From: Tim Deegan Subject: Re: Live vm migration broken in latest xen-unstable Date: Thu, 7 Sep 2006 22:29:32 +0100 Message-ID: <20060907212932.GA7244@york.uk.xensource.com> References: <2717599f0609011436k25d05be3l50ebb8120ea30dd1@mail.gmail.com> <20060905155746.GJ7810@leeni.uk.xensource.com> <2717599f0609051209s6a7e80baxefa99ba1909fff2c@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="h31gzZEtNLTqOjlF" Return-path: Content-Disposition: inline In-Reply-To: <2717599f0609051209s6a7e80baxefa99ba1909fff2c@mail.gmail.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: sanjay kushwaha Cc: xen-devel List-Id: xen-devel@lists.xenproject.org --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Hi Sanjay, Does the attached patch fix this problem for you? It tries to make sure there is enough spare memory to enable shadow pagetables on the domain before starting the migration. Cheers, Tim At 15:09 -0400 on 05 Sep (1157468999), sanjay kushwaha wrote: > Hi Ewan, > I did a "hg pull -u" on my tree which also got the changeset 11422. but I am > still facing the same problem. btw this changeset seems to be specific to > hvm domain while I am facing this problem with paravirtualized domain. > > Thanks, > Sanjay > > On 9/5/06, Ewan Mellor wrote: > > > >On Fri, Sep 01, 2006 at 05:36:00PM -0400, sanjay kushwaha wrote: > > > >> Folks, > >> I am experiencing that live migration is not working in latest > >> xen-unstable. I get the following message during migration > >> > >> [root@pc5 ksanjay]# xm migrate --live 1 [1]199.77.138.23 > >> Error: /usr/lib/xen/bin/xc_save 18 1 0 0 1 failed > >> [root@pc5 ksanjay]# > >> > >> I traced the problem to a function in xen named set_sh_allocation() in > >> file xen/arch/x86/mm/shadow/common.c > >> > >> tools/libxc/xc_linux_save.c:xc_linux_save() is called from the python > >> script which makes the following hypercall > >> > >> if (live) { > >> if (xc_shadow_control(xc_handle, dom, > >> XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY, > >> NULL, 0, NULL, 0, NULL) < 0) { > >> ERR("Couldn't enable shadow mode"); > >> goto out; > >> } > >> last_iter = 0; > >> } else { > >> ----------- > >> > >> this particular hypercall leads to the call of set_sh_allocation which > >> fails in the following code > >> > >> if ( d-> arch.shadow.total_pages < pages ) > >> { > >> /* Need to allocate more memory from domheap */ > >> pg = alloc_domheap_pages(NULL, SHADOW_MAX_ORDER, 0); > >> if ( pg == NULL ) > >> { > >> SHADOW_PRINTK("failed to allocate shadow pages.\n"); > >> return -ENOMEM; > >> } > >> > >> alloc_domheap_pages fails and returns NULL. however I think I have > >enough > >> memory available so this function should not fail. > >> > >> Is there anybody else experiencing the same problem? Could someone > >please > >> tell me how to fix it? > > > >I've put some changes into xen-unstable today which might help. The last > >fix > >is on its way through testing now. Look out for xen-unstable changeset > >11422, and try that, see how you get on. > > > >Cheers, > > > >Ewan. > > > > > > -- > ---------------------- > PhD Student, Georgia Tech > http://www.cc.gatech.edu/~ksanjay/ > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename="lm.diff" diff -r 1de184deaa9c tools/python/xen/xend/XendDomain.py --- a/tools/python/xen/xend/XendDomain.py Wed Sep 06 13:16:02 2006 +0100 +++ b/tools/python/xen/xend/XendDomain.py Thu Sep 07 18:54:45 2006 +0100 @@ -420,6 +420,10 @@ class XendDomain: """ The following call may raise a XendError exception """ dominfo.testMigrateDevices(True, dst) + if live: + """ Make sure there's memory free for enabling shadow mode """ + dominfo.checkLiveMigrateMemory() + if port == 0: port = xroot.get_xend_relocation_port() try: diff -r 1de184deaa9c tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Wed Sep 06 13:16:02 2006 +0100 +++ b/tools/python/xen/xend/XendDomainInfo.py Thu Sep 07 22:05:10 2006 +0100 @@ -49,6 +49,7 @@ from xen.xend.xenstore.xsutil import Get from xen.xend.xenstore.xsutil import GetDomainPath, IntroduceDomain from xen.xend.xenstore.xswatch import xswatch +from xen.xend import arch """Shutdown code for poweroff.""" DOMAIN_POWEROFF = 0 @@ -1502,6 +1503,19 @@ class XendDomainInfo: self.image.createDeviceModel() ## public: + + def checkLiveMigrateMemory(self): + """ Make sure there's enough memory to migrate this domain """ + overhead_kb = 0 + if arch.type == "x86": + # 1MB per vcpu plus 4Kib/Mib of RAM. This is higher than + # the minimum that Xen would allocate if no value were given. + overhead_kb = self.info['vcpus'] * 1024 + self.info['maxmem'] * 4 + overhead_kb = ((overhead_kb + 1023) / 1024) * 1024 + # The domain might already have some shadow memory + overhead_kb -= xc.shadow_mem_control(self.domid) * 1024 + if overhead_kb > 0: + balloon.free(overhead_kb) def testMigrateDevices(self, network, dst): """ Notify all device about intention of migration --h31gzZEtNLTqOjlF Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --h31gzZEtNLTqOjlF--