Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Xen: Changelog

[xen master] mem_sharing_nominate_page: p2mt should never change before p2m_change_type()

 

 

Xen changelog RSS feed   Index | Next | Previous | View Threaded


patchbot at xen

Aug 8, 2013, 10:24 PM

Post #1 of 1 (7 views)
Permalink
[xen master] mem_sharing_nominate_page: p2mt should never change before p2m_change_type()

commit fa89d08f329e495f20a561a0dac80c325c8b7784
Author: Nai Xia <nai.xia [at] gmail>
AuthorDate: Wed Aug 7 00:25:48 2013 +0800
Commit: Tim Deegan <tim [at] xen>
CommitDate: Thu Aug 8 11:19:46 2013 +0100

mem_sharing_nominate_page: p2mt should never change before p2m_change_type()

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().

Signed-off-by: Nai Xia <nai.xia [at] gmail>
Acked-by: Andres Lagar-Cavilla <andres [at] lagarcavilla>
Acked-by: Tim Deegan <tim [at] xen>
---
xen/arch/x86/mm/mem_sharing.c | 16 ++--------------
1 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
index 0364bb0..1e89f6c 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);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog [at] lists
http://lists.xensource.com/xen-changelog

Xen changelog RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.