From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Yang Jihong <yangjihong1@huawei.com>
Cc: peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com,
alexander.shishkin@linux.intel.com, jolsa@kernel.org,
namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf bpf skels: vmlinux.h uses bpf.h and perf_event.h in the source directory
Date: Tue, 9 May 2023 15:21:29 -0300 [thread overview]
Message-ID: <ZFqPKU0p73sMb+IG@kernel.org> (raw)
In-Reply-To: <20230509063649.239942-1-yangjihong1@huawei.com>
Em Tue, May 09, 2023 at 06:36:49AM +0000, Yang Jihong escreveu:
> Currently, vmlinux.h uses the bpf.h and perf_event.h header files in the
> system path. If the header files in compilation environment are old,
> compilation may fail. For example:
>
> /home/yangjihong/linux/tools/perf/util/bpf_skel/.tmp/../vmlinux.h:151:27: error: field has incomplete type 'union perf_sample_weight'
> union perf_sample_weight weight;
Can this be solved in the Makefile directives for building BPF targets?
- Arnaldo
> Use the bpf.h and perf_event.h files in the source code directory to
> avoid compilation compatibility problems.
>
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> ---
> tools/perf/util/bpf_skel/vmlinux.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/bpf_skel/vmlinux.h b/tools/perf/util/bpf_skel/vmlinux.h
> index 449b1ea91fc4..af79bcc4c4b7 100644
> --- a/tools/perf/util/bpf_skel/vmlinux.h
> +++ b/tools/perf/util/bpf_skel/vmlinux.h
> @@ -1,11 +1,13 @@
> #ifndef __VMLINUX_H
> #define __VMLINUX_H
>
> -#include <linux/bpf.h>
> #include <linux/types.h>
> -#include <linux/perf_event.h>
> #include <stdbool.h>
>
> +// Use header files in source directory to avoid compilation compatibility problems.
> +#include "../../../include/uapi/linux/perf_event.h"
> +#include "../../../include/uapi/linux/bpf.h"
> +
> // non-UAPI kernel data structures, used in the .bpf.c BPF tool component.
>
> // Just the fields used in these tools preserving the access index so that
> --
> 2.30.GIT
>
--
- Arnaldo
next prev parent reply other threads:[~2023-05-09 18:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-09 6:36 [PATCH] perf bpf skels: vmlinux.h uses bpf.h and perf_event.h in the source directory Yang Jihong
2023-05-09 18:21 ` Arnaldo Carvalho de Melo [this message]
2023-05-10 6:47 ` Yang Jihong
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=ZFqPKU0p73sMb+IG@kernel.org \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=yangjihong1@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox