From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: Claim mode and HVM PoD interact badly Date: Fri, 10 Jan 2014 11:07:38 -0500 Message-ID: <20140110160738.GC21360@phenom.dumpdata.com> References: <20140110115638.GG29180@zion.uk.xensource.com> <1389355182.19142.38.camel@kazak.uk.xensource.com> <20140110145807.GB19124@phenom.dumpdata.com> <20140110151048.GC30581@zion.uk.xensource.com> <20140110154105.GC20640@phenom.dumpdata.com> <52D0253802000078001127F3@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <52D0253802000078001127F3@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Wei Liu , Ian Campbell , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Fri, Jan 10, 2014 at 03:52:08PM +0000, Jan Beulich wrote: > >>> On 10.01.14 at 16:41, Konrad Rzeszutek Wilk wrote: > > On Fri, Jan 10, 2014 at 03:10:48PM +0000, Wei Liu wrote: > >> On Fri, Jan 10, 2014 at 09:58:07AM -0500, Konrad Rzeszutek Wilk wrote: > >> > --- a/tools/libxc/xc_hvm_build_x86.c > >> > +++ b/tools/libxc/xc_hvm_build_x86.c > >> > @@ -335,7 +335,12 @@ static int setup_guest(xc_interface *xch, > >> > > >> > /* try to claim pages for early warning of insufficient memory available */ > >> > if ( claim_enabled ) { > >> > - rc = xc_domain_claim_pages(xch, dom, nr_pages - cur_pages); > >> > + unsigned long nr = nr_pages - cur_pages; > >> > + > >> > + if ( pod_mode ) > >> > + nr = target_pages - 0x20; > >> > + > >> > >> Yes it should work because this makes nr smaller than d->tot_pages and > >> d->max_pages. But according to the comment you pasted above this looks > >> like wrong fix... > > > > It should be: > > > > tot_pages = 128MB > > max_pages = 256MB > > nr = 256MB - 0x20. > > > > So tot_pages < max_pages > nr && nr > tot_pages > > > > If I got my variables right. > > Which means that 'nr' is greater than tot_pages but less than max_pages. > > But that seems conceptually wrong: As was said before, the guest > should only get 128Mb allocated, hence it would be wrong to claim > almost 256Mb for it. At the start of the day (that is when the guest starts) it would only have 128MB allocated to it. But before then it needs 256MB (at least that is based on looking at the code). I do agree it is seems odd that the cache allocates memory, then frees it. But I might also be reading the code wrong. > > Jan >