From: Leo Yan <leo.yan@arm.com>
To: Ian Rogers <irogers@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf kvm stat: Fix build error
Date: Thu, 26 Feb 2026 09:52:55 +0000 [thread overview]
Message-ID: <20260226095255.GF4184494@e132581.arm.com> (raw)
In-Reply-To: <CAP-5=fVCdQZ584s_24wQc_+03xL2Npj2qDbqGSjE=Ms1-y8raQ@mail.gmail.com>
On Wed, Feb 25, 2026 at 10:36:26PM -0800, Ian Rogers wrote:
[...]
> Hmm.. it looks like something has gone screwy with the include paths.
> The header you've gotten is:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/arch/x86/include/uapi/asm/svm.h#n137
> rather than:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/arch/x86/include/uapi/asm/svm.h#n137
> where the value differs between -1ull and -1.
>
> In Leo's change he has the include path as:
> #include "../../arch/x86/include/uapi/asm/svm.h"
>
> but I think that is off by one and should be:
> #include "../../../arch/x86/include/uapi/asm/svm.h"
Sorry I did not check the header path carefully. A bit thoughts:
The perf build will not include headers in relative paths as we
expected.
It tries to find headers with appending search paths. As Ian said,
I saw .kvm-stat-x86.o.cmd that includes kernel headers:
/home/niayan01/Work/linux/tools/include/../../arch/x86/include/uapi/asm/svm.h \
/home/niayan01/Work/linux/tools/include/../../arch/x86/include/uapi/asm/vmx.h \
/home/niayan01/Work/linux/tools/include/../../arch/x86/include/uapi/asm/kvm.h \
I'd suggest a fix in Makefile as below. The idea is to give priority to
the lower level folders under perf, so that headers in the deeper perf
directories are searched first. This avoids searching any kernel headers.
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index a8dc72cfe48e..47359f672b6a 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -388,8 +388,10 @@ ifeq ($(DEBUG),0)
endif
endif
-INC_FLAGS += -I$(src-perf)/util/include
INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include
+INC_FLAGS += -I$(src-perf)/util/include
+INC_FLAGS += -I$(src-perf)/util
+INC_FLAGS += -I$(src-perf)
INC_FLAGS += -I$(srctree)/tools/include/
INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
INC_FLAGS += -I$(srctree)/tools/include/uapi
@@ -403,9 +405,6 @@ INC_FLAGS += -I$(obj-perf)/util
INC_FLAGS += -I$(obj-perf)
endif
-INC_FLAGS += -I$(src-perf)/util
-INC_FLAGS += -I$(src-perf)
-
CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_
As a result, I can get the search paths in .kvm-stat-x86.o.cmd:
/home/niayan01/Work/linux/tools/perf/util/../../arch/x86/include/uapi/asm/svm.h \
/home/niayan01/Work/linux/tools/perf/util/../../arch/x86/include/uapi/asm/vmx.h \
/home/niayan01/Work/linux/tools/perf/util/../../arch/x86/include/uapi/asm/kvm.h \
Please let me know if this makes sense.
Thanks,
Leo
next prev parent reply other threads:[~2026-02-26 9:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 11:00 [PATCH] perf kvm stat: Fix build error Leo Yan
2026-02-26 1:56 ` Namhyung Kim
2026-02-26 6:36 ` Ian Rogers
2026-02-26 9:52 ` Leo Yan [this message]
2026-02-26 16:44 ` Ian Rogers
2026-02-27 7:32 ` Namhyung Kim
2026-02-27 17:30 ` Ian Rogers
2026-03-01 17:45 ` Leo Yan
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=20260226095255.GF4184494@e132581.arm.com \
--to=leo.yan@arm.com \
--cc=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@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