On 07.09.21 11:53, Henry Wang wrote:
Hi Oleksandr,
Hi Henry
-----Original Message-----
From: Xen-devel <[email protected]> On Behalf Of
Oleksandr Tyshchenko
Sent: Thursday, July 29, 2021 12:19 AM
To: [email protected]
Cc: Oleksandr Tyshchenko <[email protected]>; Daniel De
Graaf <[email protected]>; Daniel P. Smith
<[email protected]>; Ian Jackson <[email protected]>; Wei
Liu <[email protected]>; Andrew Cooper <[email protected]>; George
Dunlap <[email protected]>; Jan Beulich <[email protected]>;
Julien Grall <[email protected]>; Stefano Stabellini <[email protected]>;
Volodymyr Babchuk <[email protected]>; Roger Pau Monné
<[email protected]>; Bertrand Marquis <[email protected]>;
Wei Chen <[email protected]>
Subject: [RFC PATCH] xen/memory: Introduce a hypercall to provide
unallocated space
From: Oleksandr Tyshchenko <[email protected]>
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 <[email protected]>
Tested-by: Henry Wang <[email protected]>
Thank you!
Please note, I have pushed new version (which is notably different)
based on the discussion in current thread:
https://lore.kernel.org/xen-devel/[email protected]/
Kind regards,
Henry
--
Regards,
Oleksandr Tyshchenko