[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] Xen: Fix retry calls into PRIVCMD_MMAPBATCH*.



On 01/08/13 15:26, Andres Lagar-Cavilla wrote:
> From: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
> 
> 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.
> 
> Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
> ---
>  drivers/xen/privcmd.c |   41 +++++++++++++++++++++++++++++++++++------
>  1 files changed, 35 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
> index f8e5dd7..6ebdf98 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,14 +425,15 @@ 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;

This change to the range checks allows the user to partially populate
the VMA on the first call which will result in too few pages being
allocated in the auto_translated_physmap case.

Can you do the following behaviour instead?

On the first call, require the user to try to populate fully the VMA.

On subsequent calls, allow the user to specify a subset of pages
(sub-range) provided all the pages in the subset are not populated.

David

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.