From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v3 2/2] libxc: Defer initialization of start_page for HVM guests Date: Thu, 7 Jan 2016 09:47:59 -0500 Message-ID: <568E7A9F.50901@oracle.com> References: <1452110602-3570-1-git-send-email-boris.ostrovsky@oracle.com> <1452110602-3570-3-git-send-email-boris.ostrovsky@oracle.com> <568E4F59.4080602@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; Format="flowed" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <568E4F59.4080602@citrix.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: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , ian.jackson@eu.citrix.com, stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, wei.liu2@citrix.com Cc: jgross@suse.com, andrew.cooper3@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 01/07/2016 06:43 AM, Roger Pau Monn=E9 wrote: > El 06/01/16 a les 21.03, Boris Ostrovsky ha escrit: >> = >> static int bootlate_hvm(struct xc_dom_image *dom) >> { >> - DOMPRINTF("%s: doing nothing", __func__); >> + uint32_t domid =3D dom->guest_domid; >> + xc_interface *xch =3D dom->xch; >> + >> + if ( !dom->device_model ) >> + { >> + struct hvm_start_info *start_info; >> + size_t start_info_size =3D sizeof(*start_info); >> + void *start_page; >> + struct hvm_modlist_entry *modlist; >> + size_t cmdline_size =3D 0; >> + >> + if ( dom->cmdline ) >> + { >> + cmdline_size =3D ROUNDUP(strlen(dom->cmdline) + 1, 8); >> + start_info_size +=3D cmdline_size; >> + } >> + if ( dom->ramdisk_blob ) >> + start_info_size +=3D sizeof(*modlist); /* Limited to one mo= dule. */ > The size calculations are duplicated, could you either stash > start_info_size into xc_dom_image, or simply do the memory allocation > (xc_dom_alloc_segment) inside of bootlate_hvm? (I think the latter would > be better if possible). I didn't want to do the first because we'd use that information (two = pieces --- we need to to know both the size of the extra chunk and where = modlist starts) only once and it's not on a critical path. You can, of = course, argue that we increase text size. The problem with the second approach is that while it does seem to work = I don't know whether we can delay allocations until bootlate(): notice = how we print dom->virt_alloc_end in xc_dom_build_image() which to me = indicates some "finality" as far as allocations for domain are concerned. -boris