From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: [PATCH 2/3] xen/privcmd: report paged-out frames in PRIVCMD_MMAPBATCH ioctl Date: Thu, 23 Aug 2012 18:13:45 +0100 Message-ID: <1345742026-10569-3-git-send-email-david.vrabel@citrix.com> References: <1345742026-10569-1-git-send-email-david.vrabel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1345742026-10569-1-git-send-email-david.vrabel@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: xen-devel@lists.xensource.com Cc: Andres Lagar-Cavilla , Keir Fraser , David Vrabel , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org From: David Vrabel libxc handles paged-out frames in xc_map_foreign_bulk() and friends by retrying the map operation. libxc expects the PRIVCMD_MMAPBATCH ioctl to report paged out frames by setting bit 31 in the mfn. Do this for the PRIVCMD_MMAPBATCH ioctl if xen_remap_domain_mfn_range() returned -ENOENT. Signed-off-by: David Vrabel --- drivers/xen/privcmd.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index ccee0f1..f8c1b6d 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -255,10 +255,15 @@ static int mmap_batch_fn(void *data, void *state) { xen_pfn_t *mfnp = data; struct mmap_batch_state *st = state; + int ret; - if (xen_remap_domain_mfn_range(st->vma, st->va & PAGE_MASK, *mfnp, 1, - st->vma->vm_page_prot, st->domain) < 0) { - *mfnp |= 0xf0000000U; + ret = xen_remap_domain_mfn_range(st->vma, st->va & PAGE_MASK, *mfnp, 1, + st->vma->vm_page_prot, st->domain); + if (ret < 0) { + if (ret == -ENOENT) + *mfnp |= 0x80000000U; + else + *mfnp |= 0xf0000000U; st->err++; } st->va += PAGE_SIZE; -- 1.7.2.5