|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] x86/mm: Fix more ballooning+paging and ballooning+sharing bugs
# HG changeset patch
# User Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
# Date 1329406982 0
# Node ID 5a9c571ee39663929d1fe6d57326a40a46753ca2
# Parent 202db6f0907d06887d7bb7bbb708083f956bdce3
x86/mm: Fix more ballooning+paging and ballooning+sharing bugs
If the guest balloons away a page that has been nominated for paging but
not yet paged out, we fix:
- Send EVICT_FAIL flag in the event to the pager
- Do not leak the underlying page
If the page was shared, we were not:
- properly refreshing the mfn to balloon after the unshare.
- unlocking the p2m on the error exit case
Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
Acked-by: Tim Deegan <tim@xxxxxxx>
Committed-by: Tim Deegan <tim@xxxxxxx>
---
diff -r 202db6f0907d -r 5a9c571ee396 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c Thu Feb 16 15:42:59 2012 +0000
+++ b/xen/arch/x86/mm/p2m.c Thu Feb 16 15:43:02 2012 +0000
@@ -929,11 +929,14 @@
req.gfn = gfn;
req.flags = MEM_EVENT_FLAG_DROP_PAGE;
- mem_event_put_request(d, &d->mem_event->paging, &req);
-
/* Update stats unless the page hasn't yet been evicted */
if ( p2mt != p2m_ram_paging_out )
atomic_dec(&d->paged_pages);
+ else
+ /* Evict will fail now, tag this request for pager */
+ req.flags |= MEM_EVENT_FLAG_EVICT_FAIL;
+
+ mem_event_put_request(d, &d->mem_event->paging, &req);
}
/**
diff -r 202db6f0907d -r 5a9c571ee396 xen/common/memory.c
--- a/xen/common/memory.c Thu Feb 16 15:42:59 2012 +0000
+++ b/xen/common/memory.c Thu Feb 16 15:43:02 2012 +0000
@@ -167,6 +167,15 @@
{
guest_physmap_remove_page(d, gmfn, mfn, 0);
put_gfn(d, gmfn);
+ /* If the page hasn't yet been paged out, there is an
+ * actual page that needs to be released. */
+ if ( p2mt == p2m_ram_paging_out )
+ {
+ ASSERT(mfn_valid(mfn));
+ page = mfn_to_page(mfn);
+ if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
+ put_page(page);
+ }
p2m_mem_paging_drop_page(d, gmfn, p2mt);
return 1;
}
@@ -181,7 +190,6 @@
return 0;
}
- page = mfn_to_page(mfn);
#ifdef CONFIG_X86_64
if ( p2m_is_shared(p2mt) )
{
@@ -190,10 +198,17 @@
* need to trigger proper cleanup. Once done, this is
* like any other page. */
if ( mem_sharing_unshare_page(d, gmfn, 0) )
+ {
+ put_gfn(d, gmfn);
return 0;
+ }
+ /* Maybe the mfn changed */
+ mfn = mfn_x(get_gfn_query_unlocked(d, gmfn, &p2mt));
+ ASSERT(!p2m_is_shared(p2mt));
}
#endif /* CONFIG_X86_64 */
+ page = mfn_to_page(mfn);
if ( unlikely(!get_page(page, d)) )
{
put_gfn(d, gmfn);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |