* [PATCH] perf bpf skels: vmlinux.h uses bpf.h and perf_event.h in the source directory
@ 2023-05-09 6:36 Yang Jihong
2023-05-09 18:21 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Yang Jihong @ 2023-05-09 6:36 UTC (permalink / raw)
To: peterz, mingo, acme, mark.rutland, alexander.shishkin, jolsa,
namhyung, irogers, adrian.hunter, linux-perf-users, linux-kernel
Cc: yangjihong1
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;
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf bpf skels: vmlinux.h uses bpf.h and perf_event.h in the source directory
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
2023-05-10 6:47 ` Yang Jihong
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-05-09 18:21 UTC (permalink / raw)
To: Yang Jihong
Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung,
irogers, adrian.hunter, linux-perf-users, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf bpf skels: vmlinux.h uses bpf.h and perf_event.h in the source directory
2023-05-09 18:21 ` Arnaldo Carvalho de Melo
@ 2023-05-10 6:47 ` Yang Jihong
0 siblings, 0 replies; 3+ messages in thread
From: Yang Jihong @ 2023-05-10 6:47 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: peterz, mingo, mark.rutland, alexander.shishkin, jolsa, namhyung,
irogers, adrian.hunter, linux-perf-users, linux-kernel
Hello,
On 2023/5/10 2:21, Arnaldo Carvalho de Melo wrote:
> 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?
>
OK, will send v2 patch, use Makefile to specify path of header file that
is preferentially used. Pls check whether the solution is OK.
Thanks,
Yang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-10 6:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2023-05-10 6:47 ` Yang Jihong
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.