aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2015-07-22 09:50:37 -0400
committerDavid Vrabel <david.vrabel@citrix.com>2015-10-23 09:20:31 -0400
commit4a69c909deb0dd3cae653d14ac0ff52d5440a19c (patch)
tree13c9a6a80d575d706e8b689604047d0591ffad91
parent8edfcf882eb91ec9028c7334f90f6ef3db5b0fcf (diff)
xen/balloon: pre-allocate p2m entries for ballooned pages
Pages returned by alloc_xenballooned_pages() will be used for grant mapping which will call set_phys_to_machine() (in PV guests). Ballooned pages are set as INVALID_P2M_ENTRY in the p2m and thus may be using the (shared) missing tables and a subsequent set_phys_to_machine() will need to allocate new tables. Since the grant mapping may be done from a context that cannot sleep, the p2m entries must already be allocated. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
-rw-r--r--drivers/xen/balloon.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 25fd1bd949d8..f56662324a47 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -602,6 +602,11 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages)
602 page = balloon_retrieve(true); 602 page = balloon_retrieve(true);
603 if (page) { 603 if (page) {
604 pages[pgno++] = page; 604 pages[pgno++] = page;
605#ifdef CONFIG_XEN_HAVE_PVMMU
606 ret = xen_alloc_p2m_entry(page_to_pfn(page));
607 if (ret < 0)
608 goto out_undo;
609#endif
605 } else { 610 } else {
606 ret = add_ballooned_pages(nr_pages - pgno); 611 ret = add_ballooned_pages(nr_pages - pgno);
607 if (ret < 0) 612 if (ret < 0)