56 lines
1.8 KiB
Diff
56 lines
1.8 KiB
Diff
Date: Fri, 27 Jun 2014 10:51:42 +0100
|
|
From: David Vrabel <david.vrabel@citrix.com>
|
|
Subject: xen/balloon: set ballooned out pages as invalid in p2m
|
|
|
|
Since cd9151e26d31048b2b5e00fd02e110e07d2200c9 (xen/balloon: set a
|
|
mapping for ballooned out pages), a ballooned out page had its entry
|
|
in the p2m set to the MFN of one of the scratch page. This means that
|
|
the p2m will contain many entries pointing to the same MFN.
|
|
|
|
During a domain save, this many-to-one entries are not considered and
|
|
the scratch page is saved multiple times. On restore the ballooned
|
|
pages are populated with new frames and the domain may use up its
|
|
allocation before all pages can be restores.
|
|
|
|
Set ballooned out pages as INVALID_P2M_ENTRY in the p2m (as they
|
|
werebefore), preventing them from being saved and re-populated on
|
|
restore.
|
|
|
|
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
|
|
---
|
|
drivers/xen/balloon.c | 12 +++++-------
|
|
1 file changed, 5 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
|
|
index b7a506f..5c660c7 100644
|
|
--- a/drivers/xen/balloon.c
|
|
+++ b/drivers/xen/balloon.c
|
|
@@ -426,20 +426,18 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp)
|
|
* p2m are consistent.
|
|
*/
|
|
if (!xen_feature(XENFEAT_auto_translated_physmap)) {
|
|
- unsigned long p;
|
|
- struct page *scratch_page = get_balloon_scratch_page();
|
|
-
|
|
if (!PageHighMem(page)) {
|
|
+ struct page *scratch_page = get_balloon_scratch_page();
|
|
+
|
|
ret = HYPERVISOR_update_va_mapping(
|
|
(unsigned long)__va(pfn << PAGE_SHIFT),
|
|
pfn_pte(page_to_pfn(scratch_page),
|
|
PAGE_KERNEL_RO), 0);
|
|
BUG_ON(ret);
|
|
- }
|
|
- p = page_to_pfn(scratch_page);
|
|
- __set_phys_to_machine(pfn, pfn_to_mfn(p));
|
|
|
|
- put_balloon_scratch_page();
|
|
+ put_balloon_scratch_page();
|
|
+ }
|
|
+ __set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
|
|
}
|
|
#endif
|
|
|
|
--
|
|
1.7.10.4
|