From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v6 04/23] libxc: duplicate snippet to allocate p2m_host array Date: Mon, 2 Mar 2015 15:26:58 +0000 Message-ID: <1425310018.21151.84.camel@citrix.com> References: <1424966166-2388-1-git-send-email-wei.liu2@citrix.com> <1424966166-2388-5-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1424966166-2388-5-git-send-email-wei.liu2@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: Wei Liu Cc: Ian Jackson , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, 2015-02-26 at 15:55 +0000, Wei Liu wrote: > Currently all in tree code doesn't set the superpage flag, but Konrad > wants it retained for the moment. ... because? I can't seem to see any relevant mails from Konrad in my vnuma patch folder. In any case, the why is far more important than the who here. > > As I'm going to change the p2m_host array allocation, duplicate the code > snippet to allocate p2m_host array in this patch, so that we retain the > behaviour in superpage case. > > This patch introduces no functional change and it will make future patch > easier to review. Also removed one stray tab while I was there. > > Signed-off-by: Wei Liu > Cc: Ian Campbell > Cc: Ian Jackson > CC: Konrad Wilk > --- > tools/libxc/xc_dom_x86.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c > index bf06fe4..9dbaedb 100644 > --- a/tools/libxc/xc_dom_x86.c > +++ b/tools/libxc/xc_dom_x86.c > @@ -772,15 +772,16 @@ int arch_setup_meminit(struct xc_dom_image *dom) > return rc; > } > > - dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages); > - if ( dom->p2m_host == NULL ) > - return -EINVAL; > - > if ( dom->superpages ) > { > int count = dom->total_pages >> SUPERPAGE_PFN_SHIFT; > xen_pfn_t extents[count]; > > + dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * > + dom->total_pages); > + if ( dom->p2m_host == NULL ) > + return -EINVAL; > + > DOMPRINTF("Populating memory with %d superpages", count); > for ( pfn = 0; pfn < count; pfn++ ) > extents[pfn] = pfn << SUPERPAGE_PFN_SHIFT; > @@ -809,9 +810,13 @@ int arch_setup_meminit(struct xc_dom_image *dom) > return rc; > } > /* setup initial p2m */ > + dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * > + dom->total_pages); > + if ( dom->p2m_host == NULL ) > + return -EINVAL; > for ( pfn = 0; pfn < dom->total_pages; pfn++ ) > dom->p2m_host[pfn] = pfn; > - > + > /* allocate guest memory */ > for ( i = rc = allocsz = 0; > (i < dom->total_pages) && !rc;