public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nuno Das Neves <nunodasneves@linux.microsoft.com>
To: Wei Liu <wei.liu@kernel.org>
Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	mhklinux@outlook.com, kys@microsoft.com, haiyangz@microsoft.com,
	decui@microsoft.com, arnd@arndb.de, mrathor@linux.microsoft.com,
	skinsburskii@linux.microsoft.com
Subject: Re: [PATCH v2] mshv: Fix deposit memory in MSHV_ROOT_HVCALL
Date: Mon, 20 Oct 2025 09:02:55 -0700	[thread overview]
Message-ID: <c673e8da-d770-414a-bd8d-715688238dd1@linux.microsoft.com> (raw)
In-Reply-To: <20251017222633.GA632885@liuwe-devbox-debian-v2.local>

On 10/17/2025 3:26 PM, Wei Liu wrote:
> On Fri, Oct 17, 2025 at 10:06:55PM +0000, Wei Liu wrote:
>> On Fri, Oct 17, 2025 at 11:58:17AM -0700, Nuno Das Neves wrote:
>>> 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@linux.microsoft.com>
>>
>> In v1 you said you will add a "Fixes" tag. Where is it?
> 
> I added this:
> 
> Fixes: 621191d709b1 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
> 
> Let me know if that's not correct.
> 
Oops! That's correct, thanks.

> Wei


      reply	other threads:[~2025-10-20 16:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17 18:58 [PATCH v2] mshv: Fix deposit memory in MSHV_ROOT_HVCALL Nuno Das Neves
2025-10-17 19:25 ` Michael Kelley
2025-10-17 22:06 ` Wei Liu
2025-10-17 22:26   ` Wei Liu
2025-10-20 16:02     ` Nuno Das Neves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c673e8da-d770-414a-bd8d-715688238dd1@linux.microsoft.com \
    --to=nunodasneves@linux.microsoft.com \
    --cc=arnd@arndb.de \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=mrathor@linux.microsoft.com \
    --cc=skinsburskii@linux.microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox