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

[Xen-devel] [PATCH 1 of 3] x86/mm: Relieve contention for p2m lock in gva_to_gfn


  • To: xen-devel@xxxxxxxxxxxxx
  • From: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
  • Date: Tue, 24 Apr 2012 15:34:11 -0400
  • Cc: "Zhang, Yang Z" <yang.z.zhang@xxxxxxxxx>, keir@xxxxxxx, andres@xxxxxxxxxxxxxx, tim@xxxxxxx
  • Delivery-date: Tue, 24 Apr 2012 19:28:58 +0000
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=lagarcavilla.org; h=content-type :mime-version:content-transfer-encoding:subject:message-id :in-reply-to:references:date:from:to:cc; q=dns; s= lagarcavilla.org; b=dhQT3xE8+A9rf4eXgEtwQgJ8WuGmhxZeJDIq1vbUn8EK vAp6JFnIBNDwmsCoIQ2kPXd3NHN5kCxBytomd6XlHjxdT/x4LZ4N/CGWAFy+t1Wv IE9QDJxI73SuGxSrttFbxYpTDmrPfNHULX+1pCXrjWR4KnoTmRpEq7Y9el4iD70=
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

 xen/arch/x86/mm/hap/guest_walk.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)


We don't need to hold the p2m lock for the duration of the guest walk. We need
to ensure livenes of the top level page.

Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>

diff -r 34c7e6be9265 -r 58fd70123787 xen/arch/x86/mm/hap/guest_walk.c
--- a/xen/arch/x86/mm/hap/guest_walk.c
+++ b/xen/arch/x86/mm/hap/guest_walk.c
@@ -52,6 +52,7 @@ unsigned long hap_p2m_ga_to_gfn(GUEST_PA
 {
     uint32_t missing;
     mfn_t top_mfn;
+    struct page_info *top_page;
     void *top_map;
     p2m_type_t p2mt;
     p2m_access_t p2ma;
@@ -85,13 +86,16 @@ unsigned long hap_p2m_ga_to_gfn(GUEST_PA
 
     /* Map the top-level table and call the tree-walker */
     ASSERT(mfn_valid(mfn_x(top_mfn)));
+    top_page = mfn_to_page(mfn_x(top_mfn));
+    ASSERT(get_page(top_page, p2m->domain));
+    __put_gfn(p2m, top_gfn);
     top_map = map_domain_page(mfn_x(top_mfn));
 #if GUEST_PAGING_LEVELS == 3
     top_map += (cr3 & ~(PAGE_MASK | 31));
 #endif
     missing = guest_walk_tables(v, p2m, ga, &gw, pfec[0], top_mfn, top_map);
     unmap_domain_page(top_map);
-    __put_gfn(p2m, top_gfn);
+    put_page(top_page);
 
     /* Interpret the answer */
     if ( missing == 0 )

_______________________________________________
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®.