From: Wei Liu Subject: Re: [RFC][PATCH 10/13] tools: extend XENMEM_set_memory_map Date: Tue, 5 May 2015 10:32:02 +0100 Message-ID: <20150505093202.GC1455@zion.uk.xensource.com> References: <1428657724-3498-1-git-send-email-tiejun.chen@intel.com> <1428657724-3498-11-git-send-email-tiejun.chen@intel.com> <20150410100132.GB16939@zion.uk.xensource.com> <552B256F.2060400@intel.com> <20150413110231.GD17670@zion.uk.xensource.com> <552C627F.8070200@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <552C627F.8070200@intel.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: "Chen, Tiejun" Cc: kevin.tian@intel.com, Wei Liu , ian.campbell@citrix.com, andrew.cooper3@citrix.com, tim@xen.org, xen-devel@lists.xen.org, stefano.stabellini@citrix.com, JBeulich@suse.com, yang.z.zhang@intel.com, Ian.Jackson@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On Tue, Apr 14, 2015 at 08:42:39AM +0800, Chen, Tiejun wrote: > On 2015/4/13 19:02, Wei Liu wrote: > >On Mon, Apr 13, 2015 at 10:09:51AM +0800, Chen, Tiejun wrote: > >[...] > >>>Hardcoded value? > >> > >>Yes. Actually, we intend to use this to present that lowmem entry, > >> > >>tools/firmware/hvmloader/e820.c: > >> > >> /* Low RAM goes here. Reserve space for special pages. */ > >> ... > >> e820[nr].addr = 0x100000; > >> > > > >I don't like the idea of having two hardcoded values in different > > Just one place since based on our logic, hvmloader doesn't have this setting > anymore and actually it really grab that info from here. Please refer to > patch #13. > > >locations. Please put this value into a header file and reference it > >here and in hvmloader. > > Anyway, I'd like to define this here directly since no one consumes this > again. > > diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c > index 5134b33..af747e6 100644 > --- a/tools/libxl/libxl_dom.c > +++ b/tools/libxl/libxl_dom.c > @@ -787,6 +787,7 @@ out: > return rc; > } > > +#define GUEST_LOW_MEM_START_DEFAULT 0x100000 > static int libxl__domain_construct_memmap(libxl__gc *gc, > libxl_domain_config *d_config, > uint32_t domid, > @@ -812,8 +813,8 @@ static int libxl__domain_construct_memmap(libxl__gc *gc, > e820 = libxl__malloc(gc, sizeof(struct e820entry) * e820_entries); > > /* Low memory */ > - e820[nr].addr = 0x100000; > - e820[nr].size = args->lowmem_size - 0x100000; > + e820[nr].addr = GUEST_LOW_MEM_START_DEFAULT; > + e820[nr].size = args->lowmem_size - GUEST_LOW_MEM_START_DEFAULT; > e820[nr].type = E820_RAM; > nr++; > > Is this fine to you? > Having a #define without explaining why it is chosen is still fragile. As Jan pointed out this needs more explanation. Wei. > Thanks > Tiejun