From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: Re: [PATCH v1] tools/libxc: use superpages during restore of HVM guest Date: Fri, 4 Aug 2017 07:43:47 +0200 Message-ID: <20170804054347.GI28455@aepfle.de> References: <20170802134525.19597-1-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9106627048408805762==" Return-path: In-Reply-To: <20170802134525.19597-1-olaf@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Ian Jackson , Wei Liu , xen-devel@lists.xen.org Cc: Andrew Cooper List-Id: xen-devel@lists.xenproject.org --===============9106627048408805762== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k1BdFSKqAqVdu8k/" Content-Disposition: inline --k1BdFSKqAqVdu8k/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On Wed, Aug 02, Olaf Hering wrote: > +++ b/tools/libxc/xc_sr_restore_x86_hvm.c > +#define SUPERPAGE_2MB_SHIFT 9 > +#define SUPERPAGE_2MB_NR_PFNS (1UL << SUPERPAGE_2MB_SHIFT) > +#define SUPERPAGE_1GB_SHIFT 18 > +#define SUPERPAGE_1GB_NR_PFNS (1UL << SUPERPAGE_1GB_SHIFT) I think these can be moved to a header file. xc_dom_x86.c and xc_sr_restore_x86_hvm.c use xc_dom.h. > +static int x86_hvm_populate_pfns(struct xc_sr_context *ctx, unsigned count, > + const xen_pfn_t *original_pfns, > + const uint32_t *types) > +{ > + xc_interface *xch = ctx->xch; > + xen_pfn_t min_pfn = original_pfns[0], max_pfn = original_pfns[0]; > + unsigned i; > + int rc = -1; > + > + for ( i = 0; i < count; ++i ) > + { > + if (original_pfns[i] < min_pfn) > + min_pfn = original_pfns[i]; > + if (original_pfns[i] > max_pfn) > + max_pfn = original_pfns[i]; > + if ( (types[i] != XEN_DOMCTL_PFINFO_XTAB && > + types[i] != XEN_DOMCTL_PFINFO_BROKEN) && > + !pfn_is_populated(ctx, original_pfns[i]) ) Are these types used at all for a HVM domU? Otherwise this condition can be simplified to just check the populated state. Olaf --k1BdFSKqAqVdu8k/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSkRyP6Rn//f03pRUBdQqD6ppg2fgUCWYQJjQAKCRBdQqD6ppg2 fu9PAKDDS/NZv5cHYwC+/6Q4YNxGbvgBsgCfe1nGQ/tqaCvkLKBA6pQhXiquwFY= =JgcA -----END PGP SIGNATURE----- --k1BdFSKqAqVdu8k/-- --===============9106627048408805762== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --===============9106627048408805762==--