RE: [PATCH v6 7/9] xen/arm: unpopulate memory when domain is static

2022-06-08 Thread Penny Zheng
Hi Julien

> -Original Message-
> From: Julien Grall 
> Sent: Tuesday, June 7, 2022 5:20 PM
> To: Penny Zheng ; xen-devel@lists.xenproject.org
> Cc: Wei Chen ; Stefano Stabellini
> ; Bertrand Marquis ;
> Volodymyr Babchuk ; Andrew Cooper
> ; George Dunlap ;
> Jan Beulich ; Wei Liu 
> Subject: Re: [PATCH v6 7/9] xen/arm: unpopulate memory when domain is
> static
> 
> Hi Penny,
> 
> On 07/06/2022 08:30, Penny Zheng wrote:
> > 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 pages on the new list resv_page_list only
> > after having taken them off the "normal" list, when the last ref dropped.
> >
> > Signed-off-by: Penny Zheng 
> > Acked-by: Jan Beulich 
> > ---
> > v6 changes:
> > - refine in-code comment
> > - move PGC_static !CONFIG_STATIC_MEMORY definition to common header
> 
> I don't understand why this change is necessary for this patch. AFAICT, all 
> the
> users of PGC_static will be protected by #ifdef CONFIG_STATIC_MEMORY and
> therefore PGC_static should always be defined.
> 

True, I notice that arch_free_heap_page has already been guarded with
#ifdef CONFIG_STATIC_MEMORY. I'll revert the change.

> Cheers,
> 
> --
> Julien Grall


Re: [PATCH v6 7/9] xen/arm: unpopulate memory when domain is static

2022-06-07 Thread Julien Grall

Hi Penny,

On 07/06/2022 08:30, Penny Zheng wrote:

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 pages on the new list resv_page_list only after
having taken them off the "normal" list, when the last ref dropped.

Signed-off-by: Penny Zheng 
Acked-by: Jan Beulich 
---
v6 changes:
- refine in-code comment
- move PGC_static !CONFIG_STATIC_MEMORY definition to common header


I don't understand why this change is necessary for this patch. AFAICT, 
all the users of PGC_static will be protected by #ifdef 
CONFIG_STATIC_MEMORY and therefore PGC_static should always be defined.


Cheers,

--
Julien Grall