[PATCH V2 0/6] populate/unpopulate memory when domain on static

Penny Zheng posted 6 patches 2 years ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20220418122251.3583049-1-Penny.Zheng@arm.com
Test gitlab-ci passed
There is a newer version of this series
xen/arch/arm/domain.c             |  2 --
xen/arch/arm/domain_build.c       |  5 +++-
xen/arch/arm/include/asm/domain.h |  5 ++--
xen/arch/arm/include/asm/mm.h     | 17 +++++++++++++
xen/common/domain.c               |  7 ++++++
xen/common/memory.c               | 29 ++++++++++++++++++++++
xen/common/page_alloc.c           | 40 +++++++++++++++++++++++++++++--
xen/include/xen/domain.h          |  2 ++
xen/include/xen/mm.h              |  1 +
xen/include/xen/sched.h           |  9 +++++++
10 files changed, 110 insertions(+), 7 deletions(-)
[PATCH V2 0/6] populate/unpopulate memory when domain on static
Posted by Penny Zheng 2 years ago
Today when a domain unpopulates the memory on runtime, they will always
hand the memory over to the heap allocator. And it will be a problem if it
is a static domain. Pages as guest RAM for static domain shall always be
reserved to only this domain and not be used for any other purposes, so
they shall never go back to heap allocator.

This patch serie intends to fix this issue, by adding pages on the new list
resv_page_list after having taken them off the "normal" list, when unpopulating
memory, and retrieving pages from resv page list(resv_page_list) when
populating memory.

---
v2 changes:
- let "flags" live in the struct domain. So other arch can take
advantage of it in the future
- change name from "is_domain_on_static_allocation" to "is_domain_static()"
- put reserved pages on resv_page_list after having taken them off
the "normal" list
- introduce acquire_reserved_page to retrieve reserved pages from
resv_page_list
- forbid non-zero-order requests in populate_physmap
- let is_domain_static return ((void)(d), false) on x86
- fix coding style

Penny Zheng (6):
  xen/arm: do not free reserved memory into heap
  xen/arm: do not merge reserved pages in free_heap_pages()
  xen: add field "flags" to cover all internal CDF_XXX
  xen/arm: introduce CDF_staticmem
  xen/arm: unpopulate memory when domain is static
  xen/arm: retrieve reserved pages on populate_physmap

 xen/arch/arm/domain.c             |  2 --
 xen/arch/arm/domain_build.c       |  5 +++-
 xen/arch/arm/include/asm/domain.h |  5 ++--
 xen/arch/arm/include/asm/mm.h     | 17 +++++++++++++
 xen/common/domain.c               |  7 ++++++
 xen/common/memory.c               | 29 ++++++++++++++++++++++
 xen/common/page_alloc.c           | 40 +++++++++++++++++++++++++++++--
 xen/include/xen/domain.h          |  2 ++
 xen/include/xen/mm.h              |  1 +
 xen/include/xen/sched.h           |  9 +++++++
 10 files changed, 110 insertions(+), 7 deletions(-)

-- 
2.25.1
Re: [PATCH V2 0/6] populate/unpopulate memory when domain on static
Posted by Jan Beulich 2 years ago
On 18.04.2022 14:22, Penny Zheng wrote:
> Today when a domain unpopulates the memory on runtime, they will always
> hand the memory over to the heap allocator. And it will be a problem if it
> is a static domain. Pages as guest RAM for static domain shall always be
> reserved to only this domain and not be used for any other purposes, so
> they shall never go back to heap allocator.
> 
> This patch serie intends to fix this issue, by adding pages on the new list
> resv_page_list after having taken them off the "normal" list, when unpopulating
> memory, and retrieving pages from resv page list(resv_page_list) when
> populating memory.
> 
> ---
> v2 changes:
> - let "flags" live in the struct domain. So other arch can take
> advantage of it in the future
> - change name from "is_domain_on_static_allocation" to "is_domain_static()"

I have reservations against this new name: This could mean far more aspects
of the domain are static than just its memory assignment. Was this intended
(or at least considered)?

Jan
RE: [PATCH V2 0/6] populate/unpopulate memory when domain on static
Posted by Penny Zheng 2 years ago
Hi jan

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Tuesday, April 19, 2022 4:47 PM
> To: Penny Zheng <Penny.Zheng@arm.com>
> Cc: Wei Chen <Wei.Chen@arm.com>; Andrew Cooper
> <andrew.cooper3@citrix.com>; George Dunlap <george.dunlap@citrix.com>;
> Julien Grall <julien@xen.org>; Stefano Stabellini <sstabellini@kernel.org>; Wei
> Liu <wl@xen.org>; Bertrand Marquis <Bertrand.Marquis@arm.com>;
> Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>; xen-
> devel@lists.xenproject.org
> Subject: Re: [PATCH V2 0/6] populate/unpopulate memory when domain on
> static
> 
> On 18.04.2022 14:22, Penny Zheng wrote:
> > Today when a domain unpopulates the memory on runtime, they will
> > always hand the memory over to the heap allocator. And it will be a
> > problem if it is a static domain. Pages as guest RAM for static domain
> > shall always be reserved to only this domain and not be used for any
> > other purposes, so they shall never go back to heap allocator.
> >
> > This patch serie intends to fix this issue, by adding pages on the new
> > list resv_page_list after having taken them off the "normal" list,
> > when unpopulating memory, and retrieving pages from resv page
> > list(resv_page_list) when populating memory.
> >
> > ---
> > v2 changes:
> > - let "flags" live in the struct domain. So other arch can take
> > advantage of it in the future
> > - change name from "is_domain_on_static_allocation" to
> "is_domain_static()"
> 
> I have reservations against this new name: This could mean far more aspects of
> the domain are static than just its memory assignment. Was this intended (or
> at least considered)?
> 

Ok. Julien gave me two suggestions back the day, maybe the other "is_domain_using_staticmem()"
is better and to the point. I'll change it in the next serie.

> Jan