From: Sean Christopherson <seanjc@google.com>
To: Ankit Khushwaha <ankitkhushwaha.linux@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Shuah Khan <shuah@kernel.org>,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-kernel-mentees@vger.kernel.org
Subject: Re: [PATCH] KVM: selftests: Include missing uapi header for *_VECTOR definitions
Date: Mon, 17 Nov 2025 07:06:57 -0800 [thread overview]
Message-ID: <aRs6EbV2gnkertzA@google.com> (raw)
In-Reply-To: <20251115110830.26792-1-ankitkhushwaha.linux@gmail.com>
On Sat, Nov 15, 2025, Ankit Khushwaha wrote:
> The exception vector constants CP_VECTOR, HV_VECTOR, VC_VECTOR, and
> SX_VECTOR are used in ex_str(), but the header that defines
> them is not included. Other exception vectors are picked up through
> indirect includes, but these four are not, which leads to unresolved
That means your build is picking up stale kernel headers (likely the ones installed
system-wide). The "#include <asm/kvm.h>" in kvm_util.h is what pulls in the kernel
uAPI headers.
Selftests uapi headers are a bit of a mess. In the past, selftests would
automatically do "make headers_install" as part of the build, but commit
3bb267a36185 ("selftests: drop khdr make target") yanked that out because there
are scenarios where it broke the build.
So the "right" way to build selftest is to first do "make headers_install", and
then build selftests.
Note, if you build KVM selftests directly, tools/testing/selftests/lib.mk will
define the includes to be relative to the source directory, i.e. expects the
headers to be installed in the source.
ifeq ($(KHDR_INCLUDES),)
KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include
endif
You can explicitly set KHDR_INCLUDES when building if you install headers somewhere
else. E.g. my build invocation looks something like this, where "$output" is an
out-of-tree directory.
KHDR_INCLUDES="-isystem $output/usr/include" EXTRA_CFLAGS="-static -Werror -gdwarf-4" make \
INSTALL_HDR_PATH="$output/usr" OUTPUT=$output
next prev parent reply other threads:[~2025-11-17 15:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-15 11:08 [PATCH] KVM: selftests: Include missing uapi header for *_VECTOR definitions Ankit Khushwaha
2025-11-17 15:06 ` Sean Christopherson [this message]
2025-11-28 15:50 ` Ankit Khushwaha
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=aRs6EbV2gnkertzA@google.com \
--to=seanjc@google.com \
--cc=ankitkhushwaha.linux@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel-mentees@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=shuah@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 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.