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

Re: [RFC PATCH] xen/memory: Introduce a hypercall to provide unallocated space

On 07.09.21 11:53, Henry Wang wrote:
Hi Oleksandr,

Hi Henry

-----Original Message-----
From: Xen-devel <xen-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of
Oleksandr Tyshchenko
Sent: Thursday, July 29, 2021 12:19 AM
To: xen-devel@xxxxxxxxxxxxxxxxxxxx
Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>; Daniel De
Graaf <dgdegra@xxxxxxxxxxxxx>; Daniel P. Smith
<dpsmith@xxxxxxxxxxxxxxxxxxxx>; Ian Jackson <iwj@xxxxxxxxxxxxxx>; Wei
Liu <wl@xxxxxxx>; Andrew Cooper <andrew.cooper3@xxxxxxxxxx>; George
Dunlap <george.dunlap@xxxxxxxxxx>; Jan Beulich <jbeulich@xxxxxxxx>;
Julien Grall <julien@xxxxxxx>; Stefano Stabellini <sstabellini@xxxxxxxxxx>;
Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>; Roger Pau Monné
<roger.pau@xxxxxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>;
Wei Chen <Wei.Chen@xxxxxxx>
Subject: [RFC PATCH] xen/memory: Introduce a hypercall to provide
unallocated space

From: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>

Add XENMEM_get_unallocated_space hypercall which purpose is to
query hypervisor to find regions of guest physical address space
which are unused and can be used to create grant/foreign mappings
instead of wasting real pages from the domain memory for
establishing these mappings. The problem with the current Linux
on Xen on Arm behaviour is if we want to map some guest memory
regions in advance or to perform cache mappings in the backend
we might run out of memory in the host (see XSA-300).
This of course, depends on the both host and guest memory sizes.

The "unallocated space" can't be figured out precisely by
the domain on Arm without hypervisor involvement:
- not all device I/O regions are known by the time domain starts
   creating grant/foreign mappings
- the Dom0 is not aware of memory regions used for the identity
   mappings needed for the PV drivers to work
In both cases we might end up re-using these regions by
a mistake. So, the hypervisor which maintains the P2M for the domain
is in the best position to provide "unallocated space".

The arch code is in charge of finding these regions and filling
in corresponding array in new helper arch_get_unallocated_space().

This patch implements common and Arm parts, the x86 specific bits
are left uniplemented for now.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
Tested-by: Henry Wang <Henry.Wang@xxxxxxx>

Thank you!

Please note, I have pushed new version (which is notably different) based on the discussion in current thread:


Kind regards,



Oleksandr Tyshchenko



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