From: Magnus Kulke <magnuskulke@linux.microsoft.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Wei Liu <liuwe@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Zhao Liu <zhao1.liu@intel.com>,
Magnus Kulke <magnuskulke@microsoft.com>
Subject: Re: [PATCH 00/10] Support QEMU cpu models in MSHV accelerator
Date: Tue, 3 Mar 2026 14:30:59 +0100 [thread overview]
Message-ID: <aabik4j+PseewLz3@example.com> (raw)
In-Reply-To: <aa442c69-5dd5-4a3a-b42a-299a30aab881@redhat.com>
On Mon, Mar 02, 2026 at 07:34:21PM +0100, Paolo Bonzini wrote:
> Hi Magnus,
>
> I went back to reviewing this series.
>
> More or less, using "-cpu host" should work because MSHV already runs in a
> partition. Therefore, it should be safe to assume that whatever bits were
> allowed in the current partition's CPUID will also be allowed in the nested
> guest.
>
> However, you still need to mask the features corresponding to MSRs that you
> do not save/restore; this includes for example TSC deadline timer, AMX
> (XFD), FRED, PMU, UMWAIT are the first few that came to mind. Or
> alternatively, just add them to get/put_msrs.
>
Hey Paolo,
thanks for taking a look at this. I am currently staging follow up
patch-sets in which the MSR handling is reworked as part of the live
migration support. In those there will be more MSRs that are being
covered in a migration, using a hardcoded list in rust-vmm/mshv as
base, with some additional ones added:
https://docs.rs/crate/mshv-ioctls/0.6.7/source/src/ioctls/system.rs#363
in the future I think we want to have a MSHV_GET_SUPPORTED_MSRS ioctl
that we can query, similar to what's available for KVM.
There are "hv_partition_processor_features" that we query from the
hypervisor to filter out MSRs that are not available for a given
partition, e.g.
uint64_t tsc_adjust_support:1;
> Later on, we probably want to share some of the code to handle MSRs between
> Hyper-V and KVM. Please add some comments about the hypercalls, since they
> are poorly documented, explaining how to find out which MSRs are supported
> by the hypervisor.
>
If the hypercalls are not documented, we probably want to fix it either
in the rust-vmm/mshv create (which at the moment provides authorative
headers (until we have moved everything to the mshv uapi headers), but
i'll double check.
> With respect to live migration, here are a few bits of states that should be
> migrated:
>
> - the FPU registers (MshvFPU is dead code and can be removed; I missed it
> during my initial review).
yup, the FPU registers handling has also been reworked a bit to
accomodate XSAVE migration.
>
> - the PDPTRs. That is probably okay (because you never set nor read
> env->pdptrs_valid) but please check if Hyper-V supports reading them.
>
I'll try to find that out. Haven't stumbled over this so far, but I
understand it's relevant for 32bit PAE guest, which we probably haven't
tested thoroughly yet.
> - KVM also has support for migrating in the middle of an exception being
> delivered (for example if an EPT violation happens due to a write to the
> stack); this is handled with fields such as these:
>
> VMSTATE_UINT8(env.exception_pending, X86CPU),
> VMSTATE_UINT8(env.exception_injected, X86CPU),
> VMSTATE_UINT8(env.exception_has_payload, X86CPU),
> VMSTATE_UINT64(env.exception_payload, X86CPU),
> VMSTATE_INT32(env.exception_nr, X86CPU),
> VMSTATE_INT32(env.interrupt_injected, X86CPU),
> VMSTATE_UINT8(env.soft_interrupt, X86CPU),
> VMSTATE_UINT8(env.nmi_injected, X86CPU),
> VMSTATE_UINT8(env.nmi_pending, X86CPU),
>
> please check how Hyper-V handles this situation so that it can be
> implemented in QEMU as well.
>
Those are covered in MSHV's "vCPU Events", I think they map quite
cleanly to the QEMU representation:
https://docs.rs/mshv-bindings/0.6.7/src/mshv_bindings/x86_64/regs.rs.html#404
thanks,
magnus
next prev parent reply other threads:[~2026-03-03 13:33 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 15:54 [PATCH 00/10] Support QEMU cpu models in MSHV accelerator Magnus Kulke
2026-02-11 15:54 ` [PATCH 01/10] MAINTAINERS: fix magnuskulke email-address Magnus Kulke
2026-03-03 12:14 ` Peter Maydell
2026-03-03 12:53 ` Magnus Kulke
2026-02-11 15:54 ` [PATCH 02/10] include/hw/hyperv: add QEMU_PACKED to uapi structs Magnus Kulke
2026-02-11 15:54 ` [PATCH 03/10] accel/mshv: use mshv_create_partition_v2 payload Magnus Kulke
2026-02-11 23:43 ` Mohamed Mediouni
2026-02-13 9:54 ` Magnus Kulke
2026-02-12 13:32 ` Anirudh Rayabharam
2026-02-13 10:27 ` Magnus Kulke
2026-02-18 6:23 ` Wei Liu
2026-02-19 10:33 ` Anirudh Rayabharam
2026-02-19 20:16 ` Wei Liu
2026-02-11 15:54 ` [PATCH 04/10] target/i386/mshv: fix cpuid propagation bug Magnus Kulke
2026-02-18 6:24 ` Wei Liu
2026-02-11 15:54 ` [PATCH 05/10] target/i386/mshv: fix various cpuid traversal bugs Magnus Kulke
2026-02-11 15:54 ` [PATCH 06/10] target/i386/mshv: change cpuid mask to UINT32_MAX Magnus Kulke
2026-02-11 15:54 ` [PATCH 07/10] target/i386/mshv: set cpu model name on -cpu host Magnus Kulke
2026-02-11 15:54 ` [PATCH 08/10] target/i386: query mshv accel for supported cpuids Magnus Kulke
2026-02-11 23:35 ` Mohamed Mediouni
2026-02-13 9:44 ` Magnus Kulke
2026-02-20 9:50 ` Paolo Bonzini
2026-02-11 15:54 ` [PATCH 09/10] target/i386/mshv: populate xsave area offsets Magnus Kulke
2026-02-11 15:54 ` [PATCH 10/10] target/i386/mshv: filter out CET bits in cpuid Magnus Kulke
2026-03-02 18:34 ` [PATCH 00/10] Support QEMU cpu models in MSHV accelerator Paolo Bonzini
2026-03-03 13:30 ` Magnus Kulke [this message]
2026-03-03 14:04 ` Paolo Bonzini
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=aabik4j+PseewLz3@example.com \
--to=magnuskulke@linux.microsoft.com \
--cc=liuwe@microsoft.com \
--cc=magnuskulke@microsoft.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wei.liu@kernel.org \
--cc=zhao1.liu@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.