From: Mukesh R <mrathor@linux.microsoft.com>
To: wei.liu@kernel.org, Linux on Hyper-V List <linux-hyperv@vger.kernel.org>
Cc: mukeshrathor@linux.microsoft.com,
magnuskulke@linux.microsoft.com, dblanzeanu@linux.microsoft.com,
John Starks <jostarks@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Dexuan Cui <decui@microsoft.com>,
Michael Kelley <mhklinux@outlook.com>,
Naman Jain <namjain@linux.microsoft.com>,
Nuno Das Neves <nunodasneves@linux.microsoft.com>,
Muminul Islam <muislam@microsoft.com>,
Anatol Belski <anbelski@linux.microsoft.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mshv: Add an ioctl to scrub partition state
Date: Thu, 5 Nov 2026 16:47:25 -0800 [thread overview]
Message-ID: <efc63cbe-c406-a41e-60f4-df0659517435@linux.microsoft.com> (raw)
In-Reply-To: <20261029062801.28598-2-wei.liu@kernel.org>
On 10/28/26 23:27, wei.liu@kernel.org wrote:
> From: John Starks <jostarks@microsoft.com>
>
> Userspace VMMs need to reset a child partition's hypervisor-managed state
> without destroying its VPs or rebuilding its memory and eventfd
> registrations. Exposing HvCallScrubPartition through generic hypercall
> passthrough would bypass the synchronization and cached-state updates
> needed by the driver.
>
> Add MSHV_SCRUB_PARTITION as a no-argument partition-fd ioctl. Hold the
> partition mutex and try-lock each populated VP mutex in index order,
> using the partition mutex as the lockdep nesting lock. Return -EBUSY
> without issuing the hypercall if a VP is busy. This excludes VP ioctls
> without waiting indefinitely for a running VP; userspace must stop its
> run threads before requesting scrub.
>
> After a successful scrub, clear cached intercept suspend so the next run
> clears explicit suspend rather than trying to consume a stale intercept.
> Preserve deferred blocked waits and notification accounting: a VP becoming
> dispatchable does not imply its host notification has already arrived.
> Keep the locks through this update and unwind them on every exit.
>
> Scrub is nonallocating, so issue one fast hypercall, trace its status and
> return the existing errno translation. Let the hypervisor determine which
> partition configurations support scrub. Device quiescing and restoring
> guest execution state remain userspace responsibilities.
>
> Signed-off-by: John Starks <jostarks@microsoft.com>
> Signed-off-by: Wei Liu <wei.liu@kernel.org>
>
> ---
> Tested repeated scrub/run, sparse and 64-VP locking, busy unwinding,
> interrupted blocked runs, concurrent memory invalidation and irqfd
> activity on x86-64, and delayed notifications with separate diagnostic
> instrumentation. The affected ARM64 objects compile. ARM64 runtime and
> hypervisor scheduling remain untested. Doorbell delivery across scrub
> works, but exposes an existing eventfd hardirq wait-context warning under
> lockdep, separate from this change.
>
> GitHub Copilot generated the implementation and test probes, investigated
> locking and notification handling, ran builds and Incubator tests, and
> drafted this description. Human review selected the dedicated ioctl and
> try-lock policy and corrected the nonallocating hypercall contract.
> ---
> drivers/hv/mshv_root.h | 1 +
> drivers/hv/mshv_root_hv_call.c | 11 ++++++++
> drivers/hv/mshv_root_main.c | 50 ++++++++++++++++++++++++++++++++++
> drivers/hv/mshv_trace.h | 17 ++++++++++++
> include/hyperv/hvgdk_mini.h | 1 +
> include/hyperv/hvhdk.h | 4 +++
> include/uapi/linux/mshv.h | 11 ++++++++
> 7 files changed, 95 insertions(+)
> <snip>
Reviewed-by: Mukesh R <mrathor@linux.microsoft.com>
prev parent reply other threads:[~2026-11-06 0:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 6:27 wei.liu
2026-11-05 11:14 ` Doru Blânzeanu
2026-11-06 0:47 ` Mukesh R [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=efc63cbe-c406-a41e-60f4-df0659517435@linux.microsoft.com \
--to=mrathor@linux.microsoft.com \
--cc=anbelski@linux.microsoft.com \
--cc=dblanzeanu@linux.microsoft.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=jostarks@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=magnuskulke@linux.microsoft.com \
--cc=mhklinux@outlook.com \
--cc=muislam@microsoft.com \
--cc=mukeshrathor@linux.microsoft.com \
--cc=namjain@linux.microsoft.com \
--cc=nunodasneves@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
all inboxes | Powered by JetHome®