xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: xen-devel@lists.xensource.com
Cc: Andres Lagar-Cavilla <andres@gridcentric.ca>,
	Keir Fraser <keir@xen.org>,
	David Vrabel <david.vrabel@citrix.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 2/3] xen/privcmd: report paged-out frames in PRIVCMD_MMAPBATCH ioctl
Date: Thu, 23 Aug 2012 18:13:45 +0100	[thread overview]
Message-ID: <1345742026-10569-3-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1345742026-10569-1-git-send-email-david.vrabel@citrix.com>

From: David Vrabel <david.vrabel@citrix.com>

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 <david.vrabel@citrix.com>
---
 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

  parent reply	other threads:[~2012-08-23 17:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23 17:13 [RFC PATCH 0/3] xen/privcmd: support for paged-out frames David Vrabel
2012-08-23 17:13 ` [PATCH 1/3] xen/mm: return more precise error from xen_remap_domain_range() David Vrabel
2012-08-23 17:13 ` David Vrabel [this message]
2012-08-24  1:34   ` [PATCH 2/3] xen/privcmd: report paged-out frames in PRIVCMD_MMAPBATCH ioctl Andres Lagar-Cavilla
2012-08-24 18:01   ` Bastian Blank
2012-08-23 17:13 ` [PATCH 3/3] xen/privcmd: add PRIVCMD_MMAPBATCH_V2 ioctl David Vrabel
2012-08-23 19:40   ` Konrad Rzeszutek Wilk
2012-08-24 11:14     ` David Vrabel
2012-08-24 11:41       ` Konrad Rzeszutek Wilk
2012-08-24 11:50         ` Ian Campbell
2012-08-24 12:00         ` David Vrabel
2012-08-24 12:14           ` Ian Campbell
2012-08-24  1:35   ` Andres Lagar-Cavilla
2012-08-24  1:32 ` [RFC PATCH 0/3] xen/privcmd: support for paged-out frames Andres Lagar-Cavilla
2012-08-24 11:58   ` David Vrabel
2012-08-24 12:14     ` Ian Campbell
2012-08-24 15:06       ` Andres Lagar-Cavilla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1345742026-10569-3-git-send-email-david.vrabel@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=andres@gridcentric.ca \
    --cc=keir@xen.org \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).