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

[Xen-changelog] [xen staging] xen/arm: p2m: Limit call to mem access code use in get_page_from_gva



commit 7bb3a9ae34b95eb944217abc377242ccd66d5e7b
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Mon Jul 16 18:27:02 2018 +0100
Commit:     Julien Grall <julien.grall@xxxxxxx>
CommitDate: Wed Aug 22 16:33:10 2018 +0100

    xen/arm: p2m: Limit call to mem access code use in get_page_from_gva
    
    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>
    Acked-by Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 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;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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