Hi Penny,
On 09/01/2023 07:50, Penny Zheng wrote:
-----Original Message-----
From: Julien Grall <jul...@xen.org>
Sent: Sunday, January 8, 2023 8:23 PM
To: Penny Zheng <penny.zh...@arm.com>; xen-devel@lists.xenproject.org
Cc: Wei Chen <wei.c...@arm.com>; Stefano Stabellini
<sstabell...@kernel.org>; Bertrand Marquis <bertrand.marq...@arm.com>;
Volodymyr Babchuk <volodymyr_babc...@epam.com>
Subject: Re: [PATCH v1 05/13] xen/arm: allocate shared memory from heap
when host address not provided
Hi Penny,
Hi Julien,
On 15/11/2022 02:52, Penny Zheng wrote:
when host address is not provided in "xen,shared-mem", we let Xen
allocate requested shared memory from heap, and once the shared
memory
is allocated, it will be marked as static(PGC_static), which means
that it will be reserved as static memory, and will not go back to heap even
on freeing.
Please don't move pages from the {xen,dom}heap to the static heap. If you
need to keep the pages for longer, then get an extra reference so they will
not be released.
Signed-off-by: Penny Zheng <penny.zh...@arm.com>
---
xen/arch/arm/domain_build.c | 83
++++++++++++++++++++++++++++++++++++-
1 file changed, 82 insertions(+), 1 deletion(-)
+static int __init allocate_shared_memory(struct shm_membank
*shm_membank,
+ paddr_t psize) {
+ struct meminfo *banks;
+ int ret;
+
+ BUG_ON(shm_membank->mem.banks.meminfo != NULL);
+
+ banks = xmalloc_bytes(sizeof(struct meminfo));
Where is this freed?
These kinds of info will be only used in boot-time, so maybe I shall
free them in init_done()?
I don't think you can free it in init_done() because we don't keep a
pointer to kinfo past construct_dom*().
Or just after process_shm() ?
This might work. But I think it would be better to avoid the dynamic
memory allocation if we can.
Cheers,
--
Julien Grall