|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v4 1/6] xen: do not free reserved memory into heap
Hi Penny, On 10/05/2022 03:27, Penny Zheng wrote: Pages used as guest RAM for static domain, shall be reserved to this domain only. So in case reserved pages being used for other purpose, users shall not free them back to heap, even when last ref gets dropped. free_staticmem_pages will be called by free_heap_pages in runtime for static domain freeing memory resource, so let's drop the __init flag. Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx> --- v4 changes: - no changes --- v3 changes: - fix possible racy issue in free_staticmem_pages() - introduce a stub free_staticmem_pages() for the !CONFIG_STATIC_MEMORY case - move the change to free_heap_pages() to cover other potential call sites - fix the indentation --- v2 changes: - new commit --- xen/common/page_alloc.c | 17 ++++++++++++++--- xen/include/xen/mm.h | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 319029140f..5e569a48a2 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1443,6 +1443,10 @@ static void free_heap_pages(ASSERT(order <= MAX_ORDER); + if ( pg->count_info & PGC_reserved ) NIT: I would suggest to use "unlikely()" here.
Looking at the implementation of free_staticmem_pages(), the page will be scrubbed synchronously. If I am not mistaken, static memory is not yet supported so I would be OK to continue with synchronous scrubbing. However, this will need to be asynchronous before we even consider to security support it. BTW, SUPPORT.md doesn't seem to explicitely say whether static memory is supported. Would you be able to send a patch to update it? I think this should be tech preview for now.
NIT: I understand the flag may have already been set, but I am not convinced if it is worth checking it and then set. + pg[i].count_info |= PGC_reserved;
Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |