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

[Xen-devel] [PATCH 04/15] xen/arm: p2m: Reduce the locking section in get_page_from_gva



The p2m lock is only necessary to prevent gvirt_to_maddr failing when
break-before-make sequence is used in the P2M update concurrently on
another pCPU. So reduce the locking section.

Signed-off-by: Julien Grall <julien.grall@xxxxxxx>

---

    Note a newline has been dropped to keep the block together.
---
 xen/arch/arm/p2m.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 14791388ad..5ca7ffe41b 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1415,9 +1415,13 @@ struct page_info *get_page_from_gva(struct vcpu *v, 
vaddr_t va,
     if ( v != current )
         return NULL;
 
+    /*
+     * The lock is here to protect us against the break-before-make
+     * sequence used when updating the entry.
+     */
     p2m_read_lock(p2m);
-
     par = gvirt_to_maddr(va, &maddr, flags);
+    p2m_read_unlock(p2m);
 
     if ( par )
     {
@@ -1445,8 +1449,6 @@ struct page_info *get_page_from_gva(struct vcpu *v, 
vaddr_t va,
     }
 
 err:
-    p2m_read_unlock(p2m);
-
     if ( !page && p2m->mem_access_enabled )
         page = p2m_mem_access_check_and_get_page(va, flags, v);
 
-- 
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®.