From: Sean Christopherson <seanjc@google.com>
To: Jim Mattson <jmattson@google.com>
Cc: Gao Shiyuan <gaoshiyuan@baidu.com>,
pbonzini@redhat.com, x86@kernel.org, kvm@vger.kernel.org,
likexu@tencent.com
Subject: Re: [PATCH] KVM: x86/vPMU: ignore the check of IA32_PERF_GLOBAL_CTRL bit35
Date: Fri, 2 Jun 2023 15:52:15 -0700 [thread overview]
Message-ID: <ZHpyn7GqM0O0QkwO@google.com> (raw)
In-Reply-To: <CALMp9eRLhNu-x24acfHvySf6K1EOFW_+rAqeLJ6bBbLp3kCc=Q@mail.gmail.com>
On Fri, Jun 02, 2023, Jim Mattson wrote:
> On Fri, Jun 2, 2023 at 2:48 PM Sean Christopherson <seanjc@google.com> wrote:
> >
> > On Fri, Jun 02, 2023, Jim Mattson wrote:
> > > On Fri, Jun 2, 2023 at 12:16 PM Sean Christopherson <seanjc@google.com> wrote:
> > > >
> > > > On Fri, Jun 02, 2023, Jim Mattson wrote:
> > > > > On Fri, Jun 2, 2023 at 12:18 AM Gao Shiyuan <gaoshiyuan@baidu.com> wrote:
> > > > > >
> > > > > > From: Shiyuan Gao <gaoshiyuan@baidu.com>
> > > > > >
> > > > > > When live-migrate VM on icelake microarchitecture, if the source
> > > > > > host kernel before commit 2e8cd7a3b828 ("kvm: x86: limit the maximum
> > > > > > number of vPMU fixed counters to 3") and the dest host kernel after this
> > > > > > commit, the migration will fail.
> > > > > >
> > > > > > The source VM's CPUID.0xA.edx[0..4]=4 that is reported by KVM and
> > > > > > the IA32_PERF_GLOBAL_CTRL MSR is 0xf000000ff. However the dest VM's
> > > > > > CPUID.0xA.edx[0..4]=3 and the IA32_PERF_GLOBAL_CTRL MSR is 0x7000000ff.
> > > > > > This inconsistency leads to migration failure.
> > > >
> > > > IMO, this is a userspace bug. KVM provided userspace all the information it needed
> > > > to know that the target is incompatible (3 counters instead of 4), it's userspace's
> > > > fault for not sanity checking that the target is compatible.
> > > >
> > > > I agree that KVM isn't blame free, but hacking KVM to cover up userspace mistakes
> > > > everytime a feature appears or disappears across kernel versions or configs isn't
> > > > maintainable.
> > >
> > > Um...
> > >
> > > "You may never migrate this VM to a newer kernel. Sucks to be you."
> >
> > Userspace can fudge/fixup state to migrate the VM.
>
> Um, yeah. Userspace can clear bit 35 from the saved
> IA32_PERF_GLOBAL_CTRL MSR so that the migration will complete. But
> what happens the next time the guest tries to set bit 35 in
> IA32_PERF_GLOBAL_CTRL, which it will probably do, since it cached
> CPUID.0AH at boot?
Ah, right. Yeah, guest is hosed.
I'm still not convinced this is KVM's problem to fix.
next prev parent reply other threads:[~2023-06-02 22:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-02 7:02 [PATCH] KVM: x86/vPMU: ignore the check of IA32_PERF_GLOBAL_CTRL bit35 Gao Shiyuan
2023-06-02 18:43 ` Jim Mattson
2023-06-02 19:16 ` Sean Christopherson
2023-06-02 19:30 ` Jim Mattson
2023-06-02 21:48 ` Sean Christopherson
2023-06-02 22:38 ` Jim Mattson
2023-06-02 22:52 ` Sean Christopherson [this message]
2023-06-02 23:09 ` Jim Mattson
2023-06-05 3:53 ` Gao,Shiyuan
2023-06-13 21:00 ` Sean Christopherson
2023-06-14 12:36 ` Gao,Shiyuan
2023-06-05 3:31 ` Gao,Shiyuan
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=ZHpyn7GqM0O0QkwO@google.com \
--to=seanjc@google.com \
--cc=gaoshiyuan@baidu.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=likexu@tencent.com \
--cc=pbonzini@redhat.com \
--cc=x86@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