|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v4 06/10] memory: batch processing in acquire_resource()
(+ Paul as the author XENMEM_acquire_resource) Hi, On 30/06/2020 13:33, Michał Leszczyński wrote: From: Michal Leszczynski <michal.leszczynski@xxxxxxx> Allow to acquire large resources by allowing acquire_resource() to process items in batches, using hypercall continuation. Signed-off-by: Michal Leszczynski <michal.leszczynski@xxxxxxx> --- xen/common/memory.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/xen/common/memory.c b/xen/common/memory.c index 714077c1e5..3ab06581a2 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -1046,10 +1046,12 @@ static int acquire_grant_table(struct domain *d, unsigned int id, }static int acquire_resource( On 32-bit, the start_extent would be 26-bits wide which is not enough to cover all the xmar.nr_frames. Therefore, you want that check that it is possible to encode a continuation. Something like: /* Is the size too large for us to encode a continuation? */ if ( unlikely(xmar.nr_frames > (UINT_MAX >> MEMOP_EXTENT_SHIFT)) ) As start_extent is exposed to the guest, you want to check if it is not bigger than xmar.nr_frames. The documentation of the hypercall suggests that if you pass NULL, then it will return the maximum number value for nr_frames supported by the implementation. So technically a domain cannot use more than ARRAY_SIZE(mfn_list). However, you new addition conflict with the documentation. Can you clarify how a domain will know that it can use more than ARRAY_SIZE(mfn_list)? rc = rcu_lock_remote_domain_by_id(xmar.domid, &d); Hmmm... it looks like we forgot to check that start_extent is always 0 when the hypercall was added. As this is exposed to the guest, it technically means that there no guarantee that start_extent will always be 0. However, in practice, this was likely the intention and should be the case. So it may just be enough to mention the potential breakage in the commit message. @All: what do you think?
Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |