From: Sean Christopherson <seanjc@google.com>
To: Jon Kohler <jon@nutanix.com>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [kvm-unit-tests PATCH 00/17] x86/vmx: align with Linux kernel VMX definitions
Date: Mon, 17 Nov 2025 09:41:33 -0800 [thread overview]
Message-ID: <aRteTRY2Z5Z3fL51@google.com> (raw)
In-Reply-To: <E413E048-EA97-4386-8A88-B9552A823AE3@nutanix.com>
On Fri, Nov 14, 2025, Jon Kohler wrote:
> > On Nov 12, 2025, at 2:02 PM, Sean Christopherson <seanjc@google.com> wrote:
> > On Tue, Sep 16, 2025, Jon Kohler wrote:
> >> This series modernizes VMX definitions to align with the canonical ones
> >> within Linux kernel source. Currently, kvm-unit-tests uses custom VMX
> >> constant definitions that have grown organically and have diverged from
> >> the kernel, increasing the overhead to grok from one code base to
> >> another.
> >>
> >> This alignment provides several benefits:
> >> - Reduces maintenance overhead by using authoritative definitions
> >> - Eliminates potential bugs from definition mismatches
> >> - Makes the test suite more consistent with kernel code
> >> - Simplifies future updates when new VMX features are added
> >>
> >> Given the lines touched, I've broken this up into two groups within the
> >> series:
> >>
> >> Group 1: Import various headers from Linux kernel 6.16 (P01-04)
> >
> > Hrm. I'm definitely in favor of aligning names, and not opposed to pulling
> > information from the kernel, but I don't think I like the idea of doing a straight
> > copy+paste. The arch/x86/include/asm/vmxfeatures.h insanity in particular is pure
> > overhead/noise in KUT. E.g. the layer of indirection to find out the bit number is
> > _really_ annoying, and the shifting done for VMFUNC is downright gross, but at
> > least in the kernel we get pretty printing in /proc/cpuinfo.
> >
> > Similarly, I don't want to pull in trapnr.h verbatim, because KVM already provides
> > <nr>_VECTOR in a uapi header, and I strongly prefer the <nr>_VECTOR macros
> > ("trap" is very misleading when considering fault-like vs. trap-like exceptions).
> >
> > This is also a good opportunity to align the third player: KVM selftests. Which
> > kinda sorta copy the kernel headers, but with stale and annoying differences.
> >
> > Lastly, if we're going to pull from the kernel, ideally we would have a script to
> > semi-automate updating the KUT side of things.
> >
> > So, I think/hope we can kill a bunch of birds at once by creating a script to
> > parse the kernel's vmxfeatures.h, vmx.h, trapnr.h, msr-index.h (to replace lib/x86/msr.h),
> > and generate the pieces we want. And if we do that for KVM selftests, then we
> > can commit the script to the kernel repo, i.e. we can make it the kernel's
> > responsibility to keep the script up-to-date, e.g. if there's a big rename or
> > something.
>
> Thanks, Sean - Happy to take a swing at if you don’t already have something
> cooked up to magic that into existence. Any chance any other subsystems do
> something similar? Want to make sure we don’t re-invent the wheel if so.
AFAIK, there's no prior art. :-/
People do have scripts to manage headers, but they're for simple use cases of
copying kernel headers elsewhere.
prev parent reply other threads:[~2025-11-17 17:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 17:22 [kvm-unit-tests PATCH 00/17] x86/vmx: align with Linux kernel VMX definitions Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 01/17] lib: add linux vmx.h clone from 6.16 Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 02/17] lib: add linux trapnr.h " Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 03/17] lib: add vmxfeatures.h " Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 04/17] lib: define __aligned() in compiler.h Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 05/17] x86/vmx: basic integration for new vmx.h Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 06/17] x86/vmx: switch to new vmx.h EPT violation defs Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 07/17] x86/vmx: switch to new vmx.h EPT RWX defs Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 08/17] x86/vmx: switch to new vmx.h EPT access and dirty defs Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 09/17] x86/vmx: switch to new vmx.h EPT capability and memory type defs Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 10/17] x86/vmx: switch to new vmx.h primary processor-based VM-execution controls Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 11/17] x86/vmx: switch to new vmx.h secondary execution control bit Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 12/17] x86/vmx: switch to new vmx.h secondary execution controls Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 13/17] x86/vmx: switch to new vmx.h pin based VM-execution controls Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 14/17] x86/vmx: switch to new vmx.h exit controls Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 15/17] x86/vmx: switch to new vmx.h entry controls Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 16/17] x86/vmx: switch to new vmx.h interrupt defs Jon Kohler
2025-09-16 17:22 ` [kvm-unit-tests PATCH 17/17] x86/vmx: align exit reasons with Linux uapi Jon Kohler
2025-11-12 19:02 ` [kvm-unit-tests PATCH 00/17] x86/vmx: align with Linux kernel VMX definitions Sean Christopherson
2025-11-14 14:52 ` Jon Kohler
2025-11-17 17:41 ` 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=aRteTRY2Z5Z3fL51@google.com \
--to=seanjc@google.com \
--cc=jon@nutanix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.