On 3/3/26 16:23, Stanislav Kinsburskii wrote:
This series fixes and improves memory pre-depositing in the Microsoft
Hypervisor (MSHV) driver to avoid partition and virtual processor
creation failures due to insufficient deposited memory, and to speed
up guest creation.

The first patch converts hv_call_deposit_pages() into a wrapper that
supports arbitrarily large deposit requests by splitting them into
HV_DEPOSIT_MAX-sized chunks. It also doubles the deposit amount for
L1 virtual hypervisor (L1VH) partitions to reserve memory for
Hypervisor Hot Restart (HHR), since L1VH guests cannot request
additional memory from the root partition during HHR.

The second patch moves partition initialization page depositing from
the hypercall wrapper to the partition initialization ioctl. The
required number of pages is determined empirically. Partitions with
nested virtualization capability require significantly more pages
(20 MB) to accommodate the nested hypervisor. The partition creation
flags are saved in the partition structure to allow selecting the
correct deposit size at initialization time.

The third patch moves virtual processor page depositing from
hv_call_create_vp() to mshv_partition_ioctl_create_vp(). A fixed
deposit of 1 MB per VP is used, which covers both regular and nested
virtualization cases. Deposited memory is now properly withdrawn if
VP creation fails.

The fourth patch adds pre-depositing of pages for guest address space
(SLAT) region creation. The deposit size is calculated based on the
region size rounded up to 1 GB chunks, with 6 MB deposited per GB of
address space. Deposited pages are withdrawn on failure.


Can't we just get away with changing deposit for most cases to just
2M? My theory is with that we won't really find any measurable
performance hits, and it keeps things simple.

Thanks,
-Mukesh


---

Stanislav Kinsburskii (4):
       mshv: Support larger memory deposits
       mshv: Fix pre-depositing of pages for partition initialization
       mshv: Fix pre-depositing of pages for virtual processor initialization
       mshv: Pre-deposit pages for SLAT creation


  drivers/hv/hv_proc.c           |   58 +++++++++++++++++++++++++++++++++------
  drivers/hv/mshv_root.h         |    1 +
  drivers/hv/mshv_root_hv_call.c |    6 ----
  drivers/hv/mshv_root_main.c    |   59 +++++++++++++++++++++++++++++++++++++---
  4 files changed, 104 insertions(+), 20 deletions(-)



Reply via email to