Re: [PATCH 1/1] perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h

From: Arnaldo Carvalho de Melo
Date: Fri Feb 16 2024 - 12:49:00 EST


On Mon, Feb 05, 2024 at 03:16:25PM -0800, Namhyung Kim wrote:
> On Fri, Feb 2, 2024 at 6:01 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> > On Fri, Feb 2, 2024 at 11:35 AM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > > If we instead decide to generate vmlinux.h from BTF info, it will be
> > > there:

> > > $ pahole timespec64
> > > struct timespec64 {
> > > time64_t tv_sec; /* 0 8 */
> > > long int tv_nsec; /* 8 8 */
> > > };

> > Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>

> Hmm.. but it makes it fail to build with GEN_VMLINUX_H=1.

> CLANG linux/tools/perf/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o
> In file included from util/bpf_skel/augmented_raw_syscalls.bpf.c:10:
> linux/tools/include/uapi/linux/bpf.h:55:2: error: redefinition of
> enumerator 'BPF_REG_0'
> BPF_REG_0 = 0,
> ^
> linux/tools/perf/util/bpf_skel/.tmp/../vmlinux.h:46833:2: note:
> previous definition is here
> BPF_REG_0 = 0,
> ^

Right, the following oneliner fixes it (the minimalistic pre-built
vmlinux.h we carry when not using GEN_VMLINUX_H=1 already has it), I'll
squash it, do some container test builds and resend.

- Arnaldo

diff --git a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
index d3b672593c540259..0acbd74e8c760956 100644
--- a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
+++ b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
@@ -7,7 +7,6 @@
*/

#include "vmlinux.h"
-#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <linux/limits.h>