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] x86/mm: Make asserts on types and counts of shared pages more accurate
Date: Thu, 09 Feb 2012 01:01:37 -0500 [thread overview]
Message-ID: <f2efbfaa8d26e3b527b2.1328767297@xdev.gridcentric.ca> (raw)
xen/arch/x86/mm/mem_sharing.c | 4 +++-
xen/arch/x86/mm/p2m.c | 6 ++++--
2 files changed, 7 insertions(+), 3 deletions(-)
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
diff -r 667191f054c3 -r f2efbfaa8d26 xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -200,7 +200,9 @@ static struct page_info* mem_sharing_loo
/* Count has to be at least two, because we're called
* with the mfn locked (1) and this is supposed to be
* a shared page (1). */
- ASSERT((page->u.inuse.type_info & PGT_count_mask) >= 2);
+ ASSERT((page->u.inuse.type_info &
+ (PGT_shared_page | PGT_count_mask)) >=
+ (PGT_shared_page | 2));
ASSERT(get_gpfn_from_mfn(mfn) == SHARED_M2P_ENTRY);
return page;
}
diff -r 667191f054c3 -r f2efbfaa8d26 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -745,8 +745,10 @@ set_shared_p2m_entry(struct domain *d, u
* sharable first */
ASSERT(p2m_is_shared(ot));
ASSERT(mfn_valid(omfn));
- if ( ((mfn_to_page(omfn)->u.inuse.type_info & PGT_type_mask)
- != PGT_shared_page) )
+ /* Set the m2p entry to invalid only if there are no further type
+ * refs to this page as shared */
+ if ( (mfn_to_page(omfn)->u.inuse.type_info &
+ (PGT_shared_page | PGT_count_mask)) <= PGT_shared_page )
set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
P2M_DEBUG("set shared %lx %lx\n", gfn, mfn_x(mfn));
next reply other threads:[~2012-02-09 6:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 6:01 Andres Lagar-Cavilla [this message]
2012-02-09 7:42 ` [PATCH] x86/mm: Make asserts on types and counts of shared pages more accurate Tim Deegan
2012-02-09 14:50 ` Andres Lagar-Cavilla
2012-02-09 23:32 ` 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=f2efbfaa8d26e3b527b2.1328767297@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 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).