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

Re: [PATCH for-4.17 1/2] docs: Document the minimal requirement of static heap





On 14/10/2022 09:58, Henry Wang wrote:
Hi Julien,

-----Original Message-----
From: Julien Grall <julien@xxxxxxx>
Subject: Re: [PATCH for-4.17 1/2] docs: Document the minimal requirement
of static heap

Hi Henry,

+Users should be mindful that the static heap should at least satisfy the
+allocation of the P2M maps for all guests. Currently, the minimal
requirement
+of per-domain P2M pages pool is in-sync with function
+libxl__get_required_paging_memory() (for xl-created domUs) and
+domain_p2m_pages() (for dom0less domUs), that is, 1MB per vCPU, plus
4KiB per
+MiB of RAM for the P2M map, and plus 512KiB to cover extended regions.

I think this wording is OK if the feature is a tech preview. However, if
this is security supported, we need to provide some more details about
the size.

In particular, this doesn't tell a user how they can find the size that
would fit them. Can this be decided with a formula?

My feeling of the formula would be:

My feeling of the formula would be:

Total heap size needed per guest =  1MB * num_guest_vcpu +
     4KB * guest_ram_size_in_mb + 512KB +
     the memory allocated from heap by xzalloc/xzalloc_array for        various 
uses
     for example alloc_domain_struct(), d->shared_info, evtchn_bucket, etc.

There are also some pages allocated using alloc_{xen,dom}heap_pages(). We also need to take into account runtime allocation done by some hypercalls (I can't remember which one) or subsystem like OPTee.

In addition to that, you also have memory for the system. E.g frametables, Xen page-tables, various driver allocations...


Is this formula somehow make sense to you? I think we need to have a
rough estimation of the last part (boot time allocation) though.

That's going to be hard. It will vary depending on your system and this could change in the future as we add more features. For instance, I expect the PCI passthrough will need some memory to keep track of all the devices.

I am worry the formula will become complex. Ideally we need to have a very simple formula. If that's not possible, then we need to provide a way for the user to estimate it at runtime (like what I suggested before).

Cheers,

--
Julien Grall



 


Rackspace

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