[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 05/13] xen/arm: allocate shared memory from heap when host address not provided



Hi Penny,

On 09/01/2023 07:50, Penny Zheng wrote:
-----Original Message-----
From: Julien Grall <julien@xxxxxxx>
Sent: Sunday, January 8, 2023 8:23 PM
To: Penny Zheng <Penny.Zheng@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
Cc: Wei Chen <Wei.Chen@xxxxxxx>; Stefano Stabellini
<sstabellini@xxxxxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>;
Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
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.zheng@xxxxxxx>
---
   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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.