Commit 4a69c909 authored by David Vrabel's avatar David Vrabel

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: default avatarDavid Vrabel <david.vrabel@citrix.com>
Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
parent 8edfcf88
...@@ -602,6 +602,11 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages) ...@@ -602,6 +602,11 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages)
page = balloon_retrieve(true); page = balloon_retrieve(true);
if (page) { if (page) {
pages[pgno++] = page; pages[pgno++] = page;
#ifdef CONFIG_XEN_HAVE_PVMMU
ret = xen_alloc_p2m_entry(page_to_pfn(page));
if (ret < 0)
goto out_undo;
#endif
} else { } else {
ret = add_ballooned_pages(nr_pages - pgno); ret = add_ballooned_pages(nr_pages - pgno);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment