Today when a domain unpopulates the memory on runtime, they will always
hand the memory back to the heap allocator. And it will be a problem if domain
is static.
Pages as guest RAM for static domain shall be reserved to only this domain
and not be used for any other purposes, so they shall never go back to heap
allocator.
This commit puts reserved page on the new list resv_page_list after
it has been freed.
Signed-off-by: Penny Zheng <penny.zheng@arm.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
INIT_PAGE_LIST_HEAD(&d->page_list);
INIT_PAGE_LIST_HEAD(&d->extra_page_list);
INIT_PAGE_LIST_HEAD(&d->xenpage_list);
+#ifdef CONFIG_STATIC_MEMORY
+ INIT_PAGE_LIST_HEAD(&d->resv_page_list);
+#endif
+
spin_lock_init(&d->node_affinity_lock);
d->node_affinity = NODE_MASK_ALL;
drop_dom_ref = !domain_adjust_tot_pages(d, -1);
- spin_unlock_recursive(&d->page_alloc_lock);
-
free_staticmem_pages(page, 1, scrub_debug);
+ /* Add page on the resv_page_list *after* it has been freed. */
+ page_list_add_tail(page, &d->resv_page_list);
+
+ spin_unlock_recursive(&d->page_alloc_lock);
+
if ( drop_dom_ref )
put_domain(d);
}
struct page_list_head page_list; /* linked list */
struct page_list_head extra_page_list; /* linked list (size extra_pages) */
struct page_list_head xenpage_list; /* linked list (size xenheap_pages) */
+#ifdef CONFIG_STATIC_MEMORY
+ struct page_list_head resv_page_list; /* linked list */
+#endif
/*
* This field should only be directly accessed by domain_adjust_tot_pages()