[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SN6PR02MB4157F795F3AA71F437347709D4F6A@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Fri, 17 Oct 2025 19:25:43 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Nuno Das Neves <nunodasneves@...ux.microsoft.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: "kys@...rosoft.com" <kys@...rosoft.com>, "haiyangz@...rosoft.com"
<haiyangz@...rosoft.com>, "wei.liu@...nel.org" <wei.liu@...nel.org>,
"decui@...rosoft.com" <decui@...rosoft.com>, "arnd@...db.de" <arnd@...db.de>,
"mrathor@...ux.microsoft.com" <mrathor@...ux.microsoft.com>,
"skinsburskii@...ux.microsoft.com" <skinsburskii@...ux.microsoft.com>
Subject: RE: [PATCH v2] mshv: Fix deposit memory in MSHV_ROOT_HVCALL
From: Nuno Das Neves <nunodasneves@...ux.microsoft.com> Sent: Friday, October 17, 2025 11:58 AM
>
> When the MSHV_ROOT_HVCALL ioctl is executing a hypercall, and gets
> HV_STATUS_INSUFFICIENT_MEMORY, it deposits memory and then returns
> -EAGAIN to userspace. The expectation is that the VMM will retry.
>
> However, some VMM code in the wild doesn't do this and simply fails.
> Rather than force the VMM to retry, change the ioctl to deposit
> memory on demand and immediately retry the hypercall as is done with
> all the other hypercall helper functions.
>
> In addition to making the ioctl easier to use, removing the need for
> multiple syscalls improves performance.
>
> There is a complication: unlike the other hypercall helper functions,
> in MSHV_ROOT_HVCALL the input is opaque to the kernel. This is
> problematic for rep hypercalls, because the next part of the input
> list can't be copied on each loop after depositing pages (this was
> the original reason for returning -EAGAIN in this case).
>
> Introduce hv_do_rep_hypercall_ex(), which adds a 'rep_start'
> parameter. This solves the issue, allowing the deposit loop in
> MSHV_ROOT_HVCALL to restart a rep hypercall after depositing pages
> partway through.
>
> Signed-off-by: Nuno Das Neves <nunodasneves@...ux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@...look.com>
> ---
>
> Changes in v2:
> - Improve commit message [Michael]
> - Fix up some incorrect/incomplete comments [Michael]
>
> ---
> drivers/hv/mshv_root_main.c | 58 ++++++++++++++++++----------------
> include/asm-generic/mshyperv.h | 17 ++++++++--
> 2 files changed, 44 insertions(+), 31 deletions(-)
>
Powered by blists - more mailing lists