Re: [PATCH] mshv: remove page order restriction to enable 1G hugepage support

From: Stanislav Kinsburskii

Date: Mon Apr 20 2026 - 14:24:34 EST


On Thu, Apr 16, 2026 at 01:37:15PM +0000, Anirudh Rayabharam (Microsoft) wrote:
> The hypervisor's map GPA hypercall handles large pages intelligently,
> combining 2M pages into 1G mappings when alignment allows.
>
> Remove the PMD_ORDER check in mshv_chunk_stride() so that 1G hugepages
> and other large page orders are passed through as 2M-aligned chunks,
> letting the hypervisor promote them to 1G mappings automatically.
>
> Signed-off-by: Anirudh Rayabharam (Microsoft) <anirudh@xxxxxxxxxxxxx>
> ---
> drivers/hv/mshv_regions.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/hv/mshv_regions.c b/drivers/hv/mshv_regions.c
> index fdffd4f002f6..5f617a96d97a 100644
> --- a/drivers/hv/mshv_regions.c
> +++ b/drivers/hv/mshv_regions.c
> @@ -29,7 +29,7 @@
> * Uses huge page stride if the backing page is huge and the guest mapping
> * is properly aligned; otherwise falls back to single page stride.
> *
> - * Return: Stride in pages, or -EINVAL if page order is unsupported.
> + * Return: Stride in pages.
> */
> static int mshv_chunk_stride(struct page *page,
> u64 gfn, u64 page_count)

Nit: the return type of the function should now become unsigned.

Reviewed-by: Stanislav Kinsburskii <skinsburskii@xxxxxxxxxxxxxxxxxxx>

> @@ -47,9 +47,6 @@ static int mshv_chunk_stride(struct page *page,
> return 1;
>
> page_order = folio_order(page_folio(page));
> - /* The hypervisor only supports 2M huge page */
> - if (page_order != PMD_ORDER)
> - return -EINVAL;
>
> return 1 << page_order;
> }
>
> ---
> base-commit: cd9f2e7d6e5b1837ef40b96e300fa28b73ab5a77
> change-id: 20260416-huge_1g-e44461393c8f
>
> Best regards,
> --
> Anirudh Rayabharam (Microsoft) <anirudh@xxxxxxxxxxxxx>
>