From: David Woodhouse <dwmw2@infradead.org>
To: Sean Christopherson <seanjc@google.com>,
Colin Percival <cperciva@tarsnap.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
graf@amazon.de, Ajay Kaher <ajay.kaher@broadcom.com>,
Alexey Makhalov <alexey.makhalov@broadcom.com>
Subject: Re: [PATCH v2 0/3] Support "generic" CPUID timing leaf as KVM guest and host
Date: Wed, 27 Aug 2025 10:30:12 +0100 [thread overview]
Message-ID: <e6dd6de527d2eb92f4a2b4df0be593e2cf7a44d3.camel@infradead.org> (raw)
In-Reply-To: <aK4LamiDBhKb-Nm_@google.com>
[-- Attachment #1: Type: text/plain, Size: 2673 bytes --]
On Tue, 2025-08-26 at 12:30 -0700, Sean Christopherson wrote:
> On Fri, Aug 22, 2025, Colin Percival wrote:
> > On 8/21/25 14:10, David Woodhouse wrote:
> > > On Thu, 2025-08-21 at 13:48 -0700, Sean Christopherson wrote:
> > > > > I think I'm a lot happier with the explicit CPUID leaf exposed by the
> > > > > hypervisor.
> > > >
> > > > Why? If the hypervisor is ultimately the one defining the state, why does it
> > > > matter which CPUID leaf its in?
> > > [...]
> > >
> > > If you tell me that 0x15 is *never* wrong when seen by a KVM guest, and
> > > that it's OK to extend the hardware CPUID support up to 0x15 even on
> > > older CPUs and there'll never be any adverse consequences from weird
> > > assumptions in guest operating systems if we do the latter... well, for
> > > a start, I won't believe you. And even if I do, I won't think it's
> > > worth the risk. Just use a hypervisor leaf :)
>
> But for CoCo VMs (TDX in particular), using a hypervisor leaf is objectively worse,
> because the hypervisor leaf is emulated by the untrusted world, whereas CPUID.0x15
> is emulated by the trusted world (TDX-Module).
>
> If the issue is one of trust, what if we carve out a KVM_FEATURE_xxx bit that
> userspace can set to pinky swear it isn't broken?
>
> > FreeBSD developer here. I'm with David on this, we'll consult the 0x15/0x16
> > CPUID leaves if we don't have anything better, but I'm not going to trust
> > those nearly as much as the 0x40000010 leaf.
> >
> > Also, the 0x40000010 leaf provides the lapic frequency, which AFAIK is not
> > exposed in any other way.
>
> On Intel CPUs, CPUID.0x15 defines the APIC timer frequency:
>
> The APIC timer frequency will be the processor’s bus clock or core crystal clock
> frequency (when TSC/core crystal clock ratio is enumerated in CPUID leaf 0x15)
> divided by the value specified in the divide configuration register.
>
> Thanks to TDX (again), that is also now KVM's ABI.
And AMD's Secure TSC provides it in a GUEST_TSC_FREQ MSR, I believe.
For the non-CoCo cases, I do think we'd need at least that 'I pinky
swear that CPUID 0x15 is telling the truth' bit — because right now, on
today's hypervisors, I believe it might not be correct. So a guest
can't trust it without that bit.
But I'm also concerned about the side-effects of advertising to guests
that everything up to 0x15 is present, on older and AMD CPUs. And I
just don't see the point in that 'pinky swear' bit, when there's an
*existing* hypervisor leaf which just gives the information directly,
which is implemented in QEMU and EC2, as well as various guests.
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5069 bytes --]
next prev parent reply other threads:[~2025-08-27 9:30 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-16 10:09 David Woodhouse
2025-08-16 10:10 ` [PATCH v2 1/3] KVM: x86: Restore caching of KVM CPUID base David Woodhouse
2025-08-16 10:10 ` [PATCH v2 2/3] KVM: x86: Provide TSC frequency in "generic" timing infomation CPUID leaf David Woodhouse
2025-12-16 20:27 ` Sean Christopherson
2025-12-16 21:10 ` Doug Covelli
2025-12-16 22:59 ` Sean Christopherson
2025-08-16 10:10 ` [PATCH v2 3/3] x86/kvm: Obtain TSC frequency from CPUID if present David Woodhouse
2025-08-21 16:26 ` [PATCH v2 0/3] Support "generic" CPUID timing leaf as KVM guest and host Sean Christopherson
2025-08-21 17:37 ` David Woodhouse
2025-08-21 19:27 ` Sean Christopherson
2025-08-21 20:42 ` David Woodhouse
2025-08-21 20:48 ` Sean Christopherson
2025-08-21 21:10 ` David Woodhouse
2025-08-22 1:57 ` Colin Percival
2025-08-26 19:30 ` Sean Christopherson
2025-08-27 9:30 ` David Woodhouse [this message]
2025-08-28 23:40 ` Sean Christopherson
2025-08-29 9:50 ` David Woodhouse
2025-08-29 11:08 ` Durrant, Paul
2025-08-29 11:19 ` David Woodhouse
2025-08-29 20:36 ` Sean Christopherson
2025-09-02 8:31 ` David Woodhouse
2025-09-02 17:49 ` Sean Christopherson
2025-09-02 18:23 ` David Woodhouse
2025-09-04 11:59 ` Sean Christopherson
2025-09-04 12:14 ` David Woodhouse
2025-09-04 13:25 ` Sean Christopherson
2025-09-04 13:51 ` David Woodhouse
2025-09-05 7:57 ` Sean Christopherson
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=e6dd6de527d2eb92f4a2b4df0be593e2cf7a44d3.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=ajay.kaher@broadcom.com \
--cc=alexey.makhalov@broadcom.com \
--cc=bp@alien8.de \
--cc=cperciva@tarsnap.com \
--cc=dave.hansen@linux.intel.com \
--cc=graf@amazon.de \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@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
all inboxes | Powered by JetHome®