From: Ian Campbell Subject: Re: [PATCH 2/6] xc: use XENMEM_claim_pages during guest creation. Date: Wed, 13 Mar 2013 14:46:27 +0000 Message-ID: <1363185987.32410.192.camel@zakaz.uk.xensource.com> References: <1363011652-25949-1-git-send-email-konrad.wilk@oracle.com> <1363011652-25949-3-git-send-email-konrad.wilk@oracle.com> <1363170195.32410.124.camel@zakaz.uk.xensource.com> <20130313144230.GF25782@phenom.dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20130313144230.GF25782@phenom.dumpdata.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: Konrad Rzeszutek Wilk Cc: "Tim (Xen.org)" , Dan Magenheimer , "xen-devel@lists.xensource.com" , "Keir (Xen.org)" , "konrad@kernel.org" List-Id: xen-devel@lists.xenproject.org On Wed, 2013-03-13 at 14:42 +0000, Konrad Rzeszutek Wilk wrote: > > > @@ -506,10 +517,16 @@ static int setup_guest(xc_interface *xch, > > > munmap(page0, PAGE_SIZE); > > > } > > > > > > + /* ensure no unclaimed pages are left unused */ > > > + xc_domain_claim_pages(xch, dom, 0 /* cancels the claim */); > > > > This cannot fail? > > It can (say we use an older hypervisor that does not have this subop), in > which case any of the operations would return -ENOSYS - which is OK. Right, that's seems ok > But in case of the hypervisor having this implemented - yes - this call > should not fail. > > Thought I should probably redo the first call to be more like: > > if (claim_mode) { > > rc =.. > if ( rc == -ENOSYS) > rc = 0; // Whatever, hypervisor is out sync. > if ( rc != 0 ) If I follow correctly then yes, I think that would be better. I wonder if + PERROR("Could not allocate memory for HVM guest."); and friends ought to say "claim" to distinguish from a later failure to allocate memory? Ian.