arch/x86/include/asm/kvm_host.h | 1 + arch/x86/include/asm/kvm_para.h | 1 + arch/x86/include/uapi/asm/kvm_para.h | 11 +++++++++++ arch/x86/kernel/kvm.c | 10 ++++++++++ arch/x86/kernel/kvmclock.c | 7 ++++++- arch/x86/kvm/cpuid.c | 23 ++++++++++++++++++----- 6 files changed, 47 insertions(+), 6 deletions(-)
In https://lkml.org/lkml/2008/10/1/246 VMware proposed a generic standard for harmonising CPUID between hypervisors. It was mostly shot down in flames, but the generic timing leaf at 0x40000010 didn't quite die. Mostly the hypervisor leaves at 0x4000_0xxx are very hypervisor-specific, but XNU and FreeBSD as guests will look for 0x4000_0010 unconditionally, under any hypervisor. The EC2 Nitro hypervisor has also exposed TSC frequency information in this leaf, since 2020. As things stand, KVM guests have to reverse-calculate the TSC frequency from the mul/shift information given to them in the KVM clock to convert ticks into nanoseconds, with a corresponding loss of precision. There's certainly no way we can sanely use 0x4000_0010 for anything *else* at this point. Just adopt it, as both guest and host. We already have the infrastructure for keeping the TSC frequency information up to date for the Xen CPUID leaf anyway, so do precisely the same for this one. David Woodhouse (3): KVM: x86: Restore caching of KVM CPUID base KVM: x86: Provide TSC frequency in "generic" timing infomation CPUID leaf x86/kvm: Obtain TSC frequency from CPUID if present arch/x86/include/asm/kvm_host.h | 1 + arch/x86/include/asm/kvm_para.h | 1 + arch/x86/include/uapi/asm/kvm_para.h | 11 +++++++++++ arch/x86/kernel/kvm.c | 10 ++++++++++ arch/x86/kernel/kvmclock.c | 7 ++++++- arch/x86/kvm/cpuid.c | 23 ++++++++++++++++++----- 6 files changed, 47 insertions(+), 6 deletions(-)
syzbot ci has tested the following series [v1] Support "generic" CPUID timing leaf as KVM guest and host. https://lore.kernel.org/all/20250814120237.2469583-1-dwmw2@infradead.org * [PATCH 1/3] KVM: x86: Restore caching of KVM CPUID base * [PATCH 2/3] KVM: x86: Provide TSC frequency in "generic" timing infomation CPUID leaf * [PATCH 3/3] x86/kvm: Obtain TSC frequency from CPUID if present and found the following issue: kernel build error Full report is available here: https://ci.syzbot.org/series/a9510b1a-8024-41ce-9775-675f5c165e20 *** kernel build error tree: torvalds URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux base: dfc0f6373094dd88e1eaf76c44f2ff01b65db851 arch: amd64 compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7 config: https://ci.syzbot.org/builds/590edf8b-b2a0-4cbd-a80e-35083fe0988e/config arch/x86/kernel/kvm.c:899:30: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] *** If these findings have caused you to resend the series or submit a separate fix, please add the following tag to your commit message: Tested-by: syzbot@syzkaller.appspotmail.com --- This report is generated by a bot. It may contain errors. syzbot ci engineers can be reached at syzkaller@googlegroups.com.
On Fri, 2025-08-15 at 08:24 -0700, syzbot ci wrote: > syzbot ci has tested the following series > > [v1] Support "generic" CPUID timing leaf as KVM guest and host. > https://lore.kernel.org/all/20250814120237.2469583-1-dwmw2@infradead.org > * [PATCH 1/3] KVM: x86: Restore caching of KVM CPUID base > * [PATCH 2/3] KVM: x86: Provide TSC frequency in "generic" timing infomation CPUID leaf > * [PATCH 3/3] x86/kvm: Obtain TSC frequency from CPUID if present > > and found the following issue: > kernel build error > > Full report is available here: > https://ci.syzbot.org/series/a9510b1a-8024-41ce-9775-675f5c165e20 > > *** > > kernel build error > > tree: torvalds > URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux > base: dfc0f6373094dd88e1eaf76c44f2ff01b65db851 > arch: amd64 > compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7 > config: https://ci.syzbot.org/builds/590edf8b-b2a0-4cbd-a80e-35083fe0988e/config > > arch/x86/kernel/kvm.c:899:30: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] > > *** #syz test: git://git.infradead.org/users/dwmw2/linux.git f280e5436b3297ebb3ac282faf5559139b097969
On Fri, Aug 15, 2025 at 5:36 PM David Woodhouse <dwmw2@infradead.org> wrote: > > On Fri, 2025-08-15 at 08:24 -0700, syzbot ci wrote: > > syzbot ci has tested the following series > > > > [v1] Support "generic" CPUID timing leaf as KVM guest and host. > > https://lore.kernel.org/all/20250814120237.2469583-1-dwmw2@infradead.org > > * [PATCH 1/3] KVM: x86: Restore caching of KVM CPUID base > > * [PATCH 2/3] KVM: x86: Provide TSC frequency in "generic" timing infomation CPUID leaf > > * [PATCH 3/3] x86/kvm: Obtain TSC frequency from CPUID if present > > > > and found the following issue: > > kernel build error > > > > Full report is available here: > > https://ci.syzbot.org/series/a9510b1a-8024-41ce-9775-675f5c165e20 > > > > *** > > > > kernel build error > > > > tree: torvalds > > URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux > > base: dfc0f6373094dd88e1eaf76c44f2ff01b65db851 > > arch: amd64 > > compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7 > > config: https://ci.syzbot.org/builds/590edf8b-b2a0-4cbd-a80e-35083fe0988e/config > > > > arch/x86/kernel/kvm.c:899:30: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] > > > > *** > > #syz test: > git://git.infradead.org/users/dwmw2/linux.git f280e5436b3297ebb3ac282faf5559139b097969 > Hi David, (FYI) The syz test command is not supported for "syzbot ci" reports yet (but it's in the plans). -- Aleksandr
© 2016 - 2025 Red Hat, Inc.