All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andres Lagar-Cavilla <andres@lagarcavilla.org>
To: xen-devel@lists.xensource.com
Cc: andres@gridcentric.ca, tim@xen.org, adin@gridcentric.ca
Subject: [PATCH 2 of 2] Correct p2m unlocking during grant table map
Date: Fri, 13 Jan 2012 00:33:39 -0500	[thread overview]
Message-ID: <abdb908c0aedfee298c4.1326432819@xdev.gridcentric.ca> (raw)
In-Reply-To: <patchbomb.1326432817@xdev.gridcentric.ca>

 xen/common/grant_table.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)


We were not putting gfn's consistently.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>

diff -r 1ab50ad829d6 -r abdb908c0aed xen/common/grant_table.c
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -141,7 +141,7 @@ shared_entry_header(struct grant_table *
 #define active_entry(t, e) \
     ((t)->active[(e)/ACGNT_PER_PAGE][(e)%ACGNT_PER_PAGE])
 
-/* Check if the page has been paged out */
+/* Check if the page has been paged out. If rc == GNTST_okay, caller must do put_gfn(rd, gfn) */
 static int __get_paged_frame(unsigned long gfn, unsigned long *frame, int readonly, struct domain *rd)
 {
     int rc = GNTST_okay;
@@ -573,7 +573,10 @@ __gnttab_map_grant_ref(
             gfn = sha1 ? sha1->frame : sha2->full_page.frame;
             rc = __get_paged_frame(gfn, &frame, !!(op->flags & GNTMAP_readonly), rd);
             if ( rc != GNTST_okay )
+            {
+                gfn = INVALID_GFN;
                 goto unlock_out;
+            }
             act->gfn = gfn;
             act->domid = ld->domain_id;
             act->frame = frame;
@@ -700,7 +703,8 @@ __gnttab_map_grant_ref(
     op->handle       = handle;
     op->status       = GNTST_okay;
 
-    put_gfn(rd, gfn);
+    if ( gfn != INVALID_GFN )
+        put_gfn(rd, gfn);
     rcu_unlock_domain(rd);
     return;

  parent reply	other threads:[~2012-01-13  5:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-13  5:33 [PATCH 0 of 2] Two p2m bug fixes Andres Lagar-Cavilla
2012-01-13  5:33 ` [PATCH 1 of 2] x86/mm: Don't ASSERT() for a valid mfn on paged p2m entries in guest_physmap_add Andres Lagar-Cavilla
2012-01-13  5:33 ` Andres Lagar-Cavilla [this message]
2012-01-19 10:44 ` [PATCH 0 of 2] Two p2m bug fixes 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=abdb908c0aedfee298c4.1326432819@xdev.gridcentric.ca \
    --to=andres@lagarcavilla.org \
    --cc=adin@gridcentric.ca \
    --cc=andres@gridcentric.ca \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.