xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andres Lagar-Cavilla <andres@lagarcavilla.org>
To: xen-devel@lists.xen.org
Cc: "Zhang, Yang Z" <yang.z.zhang@intel.com>,
	keir@xen.org, andres@gridcentric.ca, tim@xen.org
Subject: [PATCH 1 of 3] x86/mm: Relieve contention for p2m lock in gva_to_gfn
Date: Tue, 24 Apr 2012 15:34:11 -0400	[thread overview]
Message-ID: <58fd70123787dd0063fe.1335296051@xdev.gridcentric.ca> (raw)
In-Reply-To: <patchbomb.1335296050@xdev.gridcentric.ca>

 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@lagarcavilla.org>

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 )

  reply	other threads:[~2012-04-24 19:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24 19:34 [PATCH 0 of 3] x86/mm: Relieve contention of p2m lock on three hot paths Andres Lagar-Cavilla
2012-04-24 19:34 ` Andres Lagar-Cavilla [this message]
2012-04-25 12:51   ` [PATCH 1 of 3] x86/mm: Relieve contention for p2m lock in gva_to_gfn Tim Deegan
2012-04-25 15:33     ` Andres Lagar-Cavilla
2012-04-24 19:34 ` [PATCH 2 of 3] x86/emulate: Relieve contention of p2m lock in emulation of rep movs Andres Lagar-Cavilla
2012-04-25 12:54   ` Tim Deegan
2012-04-24 19:34 ` [PATCH 3 of 3] x86/emulation: No need to get_gfn on zero ram_gpa Andres Lagar-Cavilla
2012-04-25 13:11   ` Tim Deegan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58fd70123787dd0063fe.1335296051@xdev.gridcentric.ca \
    --to=andres@lagarcavilla.org \
    --cc=andres@gridcentric.ca \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    --cc=yang.z.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).