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

Re: [Xen-devel] [PATCH 05/15] xen/arm: p2m: Limit call to mem access code use in get_page_from_gva



On Mon, 16 Jul 2018, Julien Grall wrote:
> Mem access has only an impact on the hardware translation between a
> guest virtual address and the machine physical address. So it is not
> necessary to fallback to memaccess for all the other case (e.g when it
> is not possible to acquire the page behind the MFN).
> 
> Signed-off-by: Julien Grall <julien.grall@xxxxxxx>

Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>


> ---
> 
> Cc: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
> Cc: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>
> ---
>  xen/arch/arm/p2m.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> index 5ca7ffe41b..ebf74760fa 100644
> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -1425,17 +1425,24 @@ struct page_info *get_page_from_gva(struct vcpu *v, 
> vaddr_t va,
>  
>      if ( par )
>      {
> +        /*
> +         * When memaccess is enabled, the translation GVA to MADDR may
> +         * have failed because of a permission fault.
> +         */
> +        if ( p2m->mem_access_enabled )
> +            return p2m_mem_access_check_and_get_page(va, flags, v);
> +
>          dprintk(XENLOG_G_DEBUG,
>                  "%pv: gvirt_to_maddr failed va=%#"PRIvaddr" flags=0x%lx 
> par=%#"PRIx64"\n",
>                  v, va, flags, par);
> -        goto err;
> +        return NULL;
>      }
>  
>      if ( !mfn_valid(maddr_to_mfn(maddr)) )
>      {
>          dprintk(XENLOG_G_DEBUG, "%pv: Invalid MFN %#"PRI_mfn"\n",
>                  v, mfn_x(maddr_to_mfn(maddr)));
> -        goto err;
> +        return NULL;
>      }
>  
>      page = mfn_to_page(maddr_to_mfn(maddr));
> @@ -1445,13 +1452,9 @@ struct page_info *get_page_from_gva(struct vcpu *v, 
> vaddr_t va,
>      {
>          dprintk(XENLOG_G_DEBUG, "%pv: Failing to acquire the MFN 
> %#"PRI_mfn"\n",
>                  v, mfn_x(maddr_to_mfn(maddr)));
> -        page = NULL;
> +        return NULL;
>      }
>  
> -err:
> -    if ( !page && p2m->mem_access_enabled )
> -        page = p2m_mem_access_check_and_get_page(va, flags, v);
> -
>      return page;
>  }
>  
> -- 
> 2.11.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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