From: Sean Christopherson <seanjc@google.com>
To: Jim Mattson <jmattson@google.com>
Cc: pbonzini@redhat.com, chao.gao@intel.com, kvm@vger.kernel.org
Subject: Re: [PATCH v5 2/2] KVM: VMX: Cap VMX preemption timer to work around Intel erratum
Date: Tue, 28 Jul 2026 08:40:50 -0700 [thread overview]
Message-ID: <amjNgqFq5ZmYplzP@google.com> (raw)
In-Reply-To: <CALMp9eRFinq-wUPJ27OvvB5pUsAC+Mxvw9W0uordbx8jSbFdCw@mail.gmail.com>
On Tue, Jul 28, 2026, Jim Mattson wrote:
> On Tue, Jul 28, 2026 at 8:03 AM Sean Christopherson <seanjc@google.com> wrote:
> > > +
> > > + cpuid(0x15, &eax, &ebx, &ecx, &edx);
> > > + if (!eax || !ebx)
> > > + return 1ULL << 32;
> > > +
> > > + return min_t(u64, 1ULL << 32, ((u64)ebx << 25) / eax);
> >
> > While I appreciate Sashiko's paranoia about "((u64)ebx << 25) / eax)" yielding
> > zero, I think we should treat that as a WARNable offence. And to avoid a false
> > positive due to running as a VM of a misconfigured hypervisor, I think we should
> > only apply the erratum workaround on bare metal, i.e. use the maximum value if
> > KVM detects X86_FEATURE_HYPERVISOR.
>
> That's fair. We always emulate the VMCS12 VMX preemption timer with an
> hr_timer, right?
Yep. And even if KVM (or any hypervisor) as L0 used the hardware VMX timer to
emulate vmcs12's timer, it would be L0's responsibility to deal with the erratum.
Checking CPUID when running as a VM isn't obviously flawed right now, because
there's nothing that enumerates the erratum or its fix, but I'm guessing we'll
end up with FMS-based detection of the bug, at which point we'll run into the
typical issues with trying to do FMS matching when running as a VM.
prev parent reply other threads:[~2026-07-28 15:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-24 23:49 [PATCH v5 0/2] Compute safe bound for VMX preemption timer Jim Mattson
2026-07-24 23:49 ` [PATCH v5 1/2] KVM: VMX: Bury all of the VMX preemption timer code under CONFIG_X86_64=y Jim Mattson
2026-07-28 5:16 ` Chao Gao
2026-07-28 7:13 ` Binbin Wu
2026-07-24 23:49 ` [PATCH v5 2/2] KVM: VMX: Cap VMX preemption timer to work around Intel erratum Jim Mattson
2026-07-28 7:22 ` Binbin Wu
2026-07-28 15:03 ` Sean Christopherson
2026-07-28 15:28 ` Jim Mattson
2026-07-28 15:40 ` Sean Christopherson [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=amjNgqFq5ZmYplzP@google.com \
--to=seanjc@google.com \
--cc=chao.gao@intel.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox