From: David Vrabel <david.vrabel@citrix.com>
To: Andres Lagar-Cavilla <andreslc@gridcentric.ca>
Cc: <linux-kernel@vger.kernel.orgg>, <xen-devel@lists.xen.org>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
<linux-kernel@vger.kernel.org>,
Andres Lagar-Cavilla <andres@lagarcavilla.org>,
<boris.ostrovsky@oracle.com>
Subject: Re: [PATCH] Xen: Fix retry calls into PRIVCMD_MMAPBATCH*.
Date: Mon, 12 Aug 2013 16:58:18 +0100 [thread overview]
Message-ID: <5209061A.4030304@citrix.com> (raw)
In-Reply-To: <1376057488-1008-1-git-send-email-andreslc@gridcentric.ca>
On 09/08/13 15:11, Andres Lagar-Cavilla wrote:
> From: Andres Lagar-Cavilla <andres@lagarcavilla.org>
>
> When a foreign mapper attempts to map guest frames that are paged out,
> the mapper receives an ENOENT response and will have to try again
> while a helper process pages the target frame back in.
>
> Gating checks on PRIVCMD_MMAPBATCH* ioctl args were preventing retries
> of mapping calls.
>
> V2: Fixed autotranslated physmap mode breakage introduced by V1.
> V3: Enforce full range mapping for first ioctl call on a given VMA.
>
> Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
> ---
> drivers/xen/privcmd.c | 58 +++++++++++++++++++++++++++++++++++++++---------
> 1 files changed, 47 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
> index f8e5dd7..938e6e6 100644
> --- a/drivers/xen/privcmd.c
> +++ b/drivers/xen/privcmd.c
> @@ -43,9 +43,12 @@ MODULE_LICENSE("GPL");
>
> #define PRIV_VMA_LOCKED ((void *)1)
>
> -#ifndef HAVE_ARCH_PRIVCMD_MMAP
> static int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma);
> -#endif
> +
> +static int privcmd_enforce_singleshot_mapping_granular(
> + struct vm_area_struct *vma,
> + unsigned long addr,
> + unsigned long nr_pages);
>
> static long privcmd_ioctl_hypercall(void __user *udata)
> {
> @@ -422,19 +425,26 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
> vma = find_vma(mm, m.addr);
> if (!vma ||
> vma->vm_ops != &privcmd_vm_ops ||
> - (m.addr != vma->vm_start) ||
> - ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) ||
> - !privcmd_enforce_singleshot_mapping(vma)) {
> + (m.addr < vma->vm_start) ||
> + ((m.addr + (nr_pages << PAGE_SHIFT)) > vma->vm_end) ||
> + !privcmd_enforce_singleshot_mapping_granular(vma, m.addr, nr_pages)) {
> up_write(&mm->mmap_sem);
> ret = -EINVAL;
> goto out;
I think this unnecessarily calls
privcmd_enforce_singleshot_mapping_granular() on the first call.
If you change the tests to the following, does it work for you?
/* Suitable VMA? */
if (!vma || vma->vm_ops != &privcmd_vm_ops)
// error
if (!privcmd_enforce_singleshot_mapping(..)) {
/* Already populated into this VMA once, are we populating a
subset that is not yet populated? */
if (is_subset_of_vma(vma, m,addr, nr_pages)
&& privcmd_enforce_single_shot_mapping_granular())
// ok
else
// error
} else {
/* Nothing populated in this VMA, must try to fully populate
it. */
if (is_all_of_vma(vma, m.addr, nr_pages))
// ok
else
// error
}
Thanks.
David
next parent reply other threads:[~2013-08-12 15:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1376057488-1008-1-git-send-email-andreslc@gridcentric.ca>
2013-08-12 15:58 ` David Vrabel [this message]
2013-08-01 14:26 [PATCH] Xen: Fix retry calls into PRIVCMD_MMAPBATCH* Andres Lagar-Cavilla
2013-08-09 10:30 ` David Vrabel
[not found] <1375203632-23854-1-git-send-email-andres@lagarcavilla.org>
2013-08-01 3:30 ` Andres Lagar-Cavilla
2013-08-01 11:23 ` David Vrabel
2013-08-01 11:49 ` Andres Lagar-Cavilla
2013-08-01 12:04 ` David Vrabel
2013-08-01 13:30 ` 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=5209061A.4030304@citrix.com \
--to=david.vrabel@citrix.com \
--cc=andres@lagarcavilla.org \
--cc=andreslc@gridcentric.ca \
--cc=boris.ostrovsky@oracle.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.orgg \
--cc=xen-devel@lists.xen.org \
/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