RE: [PATCH v2 0/7] mshv: Refactor memory region management and map pages at creation

From: Michael Kelley

Date: Tue Apr 21 2026 - 21:43:08 EST


From: Stanislav Kinsburskii <skinsburskii@xxxxxxxxxxxxxxxxxxx> Sent: Tuesday, April 21, 2026 7:35 AM
>
> This series refactors the mshv memory region subsystem in preparation
> for mapping populated pages into the hypervisor at movable region
> creation time, rather than relying solely on demand faulting.
>
> The primary motivation is to ensure that when userspace passes a
> pre-populated mapping for a movable memory region, those pages are
> immediately visible to the hypervisor. Previously, all movable regions
> were created with HV_MAP_GPA_NO_ACCESS on every page regardless of
> whether the backing pages were already present, deferring all mapping
> to the fault handler. This added unnecessary fault overhead and
> complicated the initial setup of child partitions with pre-populated
> memory.

[snip]

>
> v2:
> - Rebased on top of latest mainline, simplified the check for valid PFNs,
> added other minor cleanups and improvements.

I'm confused about "simplified the check for valid PFNs".
I see one place in mshv_region_process_pfns() where a PFN
from the mreg_pfns[] array is checked against
MSHV_INVALID_PFN instead of doing pfn_valid(). But there
are 11 other places in the patch set where pfn_valid() is still
used, including in mshv_region_process_pfns().

Michael

>
> ---
>
> Stanislav Kinsburskii (7):
> mshv: Convert from page pointers to PFNs
> mshv: Add support to address range holes remapping
> mshv: Support regions with different VMAs
> mshv: Move pinned region setup to mshv_regions.c
> mshv: Map populated pages on movable region creation
> mshv: Extract MMIO region mapping into separate function
> mshv: Add tracepoint for map GPA hypercall
>
>
> drivers/hv/mshv_regions.c | 589 +++++++++++++++++++++++++++++-----------
> drivers/hv/mshv_root.h | 29 +-
> drivers/hv/mshv_root_hv_call.c | 53 ++--
> drivers/hv/mshv_root_main.c | 99 +------
> drivers/hv/mshv_trace.h | 36 ++
> 5 files changed, 508 insertions(+), 298 deletions(-)
>