From: Nai Xia <nai.xia@gmail.com>
To: xen-devel@lists.xensource.com
Cc: Tim Deegan <tim@xen.org>
Subject: [PATCH] mem_sharing_nominate_page: p2mt should never change before p2m_change_type()
Date: Sun, 04 Aug 2013 21:31:04 +0800 [thread overview]
Message-ID: <51FE5798.6060009@gmail.com> (raw)
The p2mt change check for p2m_change_type() was first introduced when this code path was not protected by p2m_lock().
Now this code path is protected by p2m_lock. So p2mt should never change before p2m_change_type().
---
diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
index 0364bb0..b3940cb 100644
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -900,20 +900,8 @@ int mem_sharing_nominate_page(struct domain *d,
goto out;
}
- /* Change the p2m type */
- if ( p2m_change_type(d, gfn, p2mt, p2m_ram_shared) != p2mt )
- {
- /* This is unlikely, as the type must have changed since we've checked
- * it a few lines above.
- * The mfn needs to revert back to rw type. This should never fail,
- * since no-one knew that the mfn was temporarily sharable */
- mem_sharing_gfn_destroy(page, d, gfn_info);
- xfree(page->sharing);
- page->sharing = NULL;
- /* NOTE: We haven't yet added this to the audit list. */
- BUG_ON(page_make_private(d, page) != 0);
- goto out;
- }
+ /* Change the p2m type, should never fail with p2m locked. */
+ BUG_ON(p2m_change_type(d, gfn, p2mt, p2m_ram_shared) != p2mt);
/* Account for this page. */
atomic_inc(&nr_shared_mfns);
reply other threads:[~2013-08-04 13:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=51FE5798.6060009@gmail.com \
--to=nai.xia@gmail.com \
--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.