[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86/mm: Make asserts on types and counts of shared pages more accurate
# HG changeset patch # User Tim Deegan <tim@xxxxxxx> # Date 1329406979 0 # Node ID 202db6f0907d06887d7bb7bbb708083f956bdce3 # Parent 01c1bcbc62224833304ede44187400f65e8a6b4c x86/mm: Make asserts on types and counts of shared pages more accurate Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx> Signed-off-by: Tim Deegan <tim@xxxxxxx> Committed-by: Tim Deegan <tim@xxxxxxx> --- diff -r 01c1bcbc6222 -r 202db6f0907d xen/arch/x86/mm/mem_sharing.c --- a/xen/arch/x86/mm/mem_sharing.c Thu Feb 16 08:48:23 2012 +0100 +++ b/xen/arch/x86/mm/mem_sharing.c Thu Feb 16 15:42:59 2012 +0000 @@ -201,7 +201,9 @@ /* 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); + unsigned long t = read_atomic(&page->u.inuse.type_info); + ASSERT((t & PGT_type_mask) == PGT_shared_page); + ASSERT((t & PGT_count_mask) >= 2); ASSERT(get_gpfn_from_mfn(mfn) == SHARED_M2P_ENTRY); return page; } diff -r 01c1bcbc6222 -r 202db6f0907d xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Thu Feb 16 08:48:23 2012 +0100 +++ b/xen/arch/x86/mm/p2m.c Thu Feb 16 15:42:59 2012 +0000 @@ -735,6 +735,7 @@ p2m_access_t a; p2m_type_t ot; mfn_t omfn; + unsigned long pg_type; if ( !paging_mode_translate(p2m->domain) ) return 0; @@ -745,8 +746,11 @@ * 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 */ + pg_type = read_atomic(&(mfn_to_page(omfn)->u.inuse.type_info)); + if ( (pg_type & PGT_count_mask) == 0 + || (pg_type & PGT_type_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)); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |