Hey Paolo, Thanks for the reply.
I am certainly open for suggestions if you have any here. This was originally reported when running the android kernel which I believe is Linux 4.4. I agree that newer kernels do seem to handle #GP more gracefully than others but it doesn’t help down level kernels to boot. The issue is that the Windows Hypervisor Platform will return #GP for any rdmsr/wrmsr that is not a virtualized MSR in the hypervisor by default. A virt stack (QEMU) can override this default behavior by registering for MSR exits. In this configuration the virt stack will receive any non-virtualized MSR exit and from the hypervisors perspective this is now effectively handled. I could certainly list each MSR individually but it seems overly prone to test-matrix errors. For example, each kernel that I try might succeed but a single option difference in another kernel might fail (which was the case here because the 4.4 kernel is different from the 4.14+ it seems). But, I will make any change you see fit to handle this in the way QEMU prefers. As FYI, this is the same logic that Hyper-V uses in its virt stack for any hypervisor exits that are not handled in the hypervisor itself. -Justin > -----Original Message----- > From: Paolo Bonzini <pbonz...@redhat.com> > Sent: Wednesday, June 13, 2018 9:28 AM > To: Justin Terry (VM) <jute...@microsoft.com>; qemu-devel@nongnu.org > Cc: r...@twiddle.net; ehabk...@redhat.com > Subject: Re: [PATCH 2/2] WHPX: register for unrecognized MSR exits > > On 06/06/2018 00:15, Justin Terry (VM) wrote: > > Some variations of Linux kernels end up accessing MSR's that the > > Windows Hypervisor doesn't implement which causes a GP to be returned > to the guest. > > This fix registers QEMU for unimplemented MSR access and globally > > returns 0 on reads and ignores writes. This behavior is allows the > > Linux kernel to probe the MSR with a write/read/check sequence it does > often without failing the access. > > > > Signed-off-by: Justin Terry (VM) <jute...@microsoft.com> > > --- > > target/i386/whpx-all.c | 41 > ++++++++++++++++++++++++++++++++++++++--- > > 1 file changed, 38 insertions(+), 3 deletions(-) > > Hmm, KVM tries to list the MSRs that Linux (or Windows :)) use. It can do the > full whitelist, but it's opt-in. > > Recent Linux kernels also are generally less picky about #GPs from MSRs, so I > don't think a generic whitelist is a good idea. If the "non-hosted" Hyper-V > is > doing the same that would be fine I guess, but then there should probably > be a comment about it in the code. > > While this is discussed a bit more, I've queued patch 1. > > Thanks, > > Paolo