Hi all,
After merging the perf tree, today's linux-next build (native perf)
failed like this:
util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'
__u32 size = sizeof(struct timespec64);
^ ~~~~~~~~~~~~~~~~~~~
util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64'
__u32 size = sizeof(struct timespec64);
^
Caused by commit
29d16de26df1 ("perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h")
This is a ppc64 le build.
I have used the perf tree from next-20240221 for today.
--
Cheers,
Stephen Rothwell
On Thu, Feb 22, 2024 at 10:06:56AM +1100, Stephen Rothwell wrote:
> Hi all,
>
> After merging the perf tree, today's linux-next build (native perf)
> failed like this:
>
> util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'
> __u32 size = sizeof(struct timespec64);
> ^ ~~~~~~~~~~~~~~~~~~~
> util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64'
> __u32 size = sizeof(struct timespec64);
> ^
>
> Caused by commit
>
> 29d16de26df1 ("perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h")
>
> This is a ppc64 le build.
>
> I have used the perf tree from next-20240221 for today.
Ok, finally I managed to secure a ppc64 machine to test this and
sometimes I reproduce just like you reported, but sometimes I can't do
it, didn't manage to isolate what is that makes it fail sometimes, make
-C tools/perf clean, nuking the O= target directory, etc, when I
reproduce it:
GENSKEL /tmp/build/perf-tools-next/util/bpf_skel/lock_contention.skel.h
util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'
329 | __u32 size = sizeof(struct timespec64);
| ^ ~~~~~~~~~~~~~~~~~~~
util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64'
329 | __u32 size = sizeof(struct timespec64);
| ^
1 error generated.
make[2]: *** [Makefile.perf:1161: /tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile.perf:264: sub-make] Error 2
make: *** [Makefile:113: install-bin] Error 2
make: Leaving directory '/home/acme/git/perf-tools-next/tools/perf'
$ cat /etc/redhat-release
Red Hat Enterprise Linux release 9.5 Beta (Plow)
$
Linux host 5.14.0-425.el9.ppc64le #1 SMP Wed Feb 21 15:29:04 EST 2024 ppc64le ppc64le ppc64le GNU/Linux
$ clang -v
clang version 17.0.6 (Red Hat, Inc. 17.0.6-5.el9)
Target: ppc64le-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /opt/rh/gcc-toolset-13/root/usr/lib/gcc/ppc64le-redhat-linux/13
Selected GCC installation: /opt/rh/gcc-toolset-13/root/usr/lib/gcc/ppc64le-redhat-linux/13
Candidate multilib: .;@m64
Selected multilib: .;@m64
But this is an elusive bug, its not always that it fails :-\
$ git log --oneline -1
659663f0bccc (HEAD -> perf-tools-next, perf-tools-next/perf-tools-next) perf: script: prefer capstone to XED
$ file /tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o
/tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o: ELF 64-bit LSB relocatable, eBPF, version 1 (SYSV), with debug_info, not stripped
$
That "incomplete" type is defined in:
$ grep timespec64 -B10 -A3 tools/perf/util/bpf_skel/vmlinux/vmlinux.h
typedef __u8 u8;
typedef __u32 u32;
typedef __u64 u64;
typedef __s64 s64;
typedef int pid_t;
typedef __s64 time64_t;
struct timespec64 {
time64_t tv_sec;
long int tv_nsec;
};
$
But it is used only on this sizeof expression, that is used only by
clang and for the BPF target...
$ grep timespec64 tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
__u32 size = sizeof(struct timespec64);
$
Stephen, can you try to reproduce this again? And if it fails, try
reproducing that 'sizeof(struct timespec64)' with 16, which is, in
ppc64:
$ uname -m
ppc64le
$ pahole timespec64
struct timespec64 {
time64_t tv_sec; /* 0 8 */
long int tv_nsec; /* 8 8 */
/* size: 16, cachelines: 1, members: 2 */
/* last cacheline: 16 bytes */
};
$
And on x86_64:
acme@x1:~$ uname -m
x86_64
acme@x1:~$ pahole timespec64
struct timespec64 {
time64_t tv_sec; /* 0 8 */
long int tv_nsec; /* 8 8 */
/* size: 16, cachelines: 1, members: 2 */
/* last cacheline: 16 bytes */
};
acme@x1:~$
- Arnaldo
On Fri, Feb 23, 2024 at 04:50:47PM -0300, Arnaldo Carvalho de Melo wrote:
> On Thu, Feb 22, 2024 at 10:06:56AM +1100, Stephen Rothwell wrote:
> > Hi all,
> >
> > After merging the perf tree, today's linux-next build (native perf)
> > failed like this:
> >
> > util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'
> > __u32 size = sizeof(struct timespec64);
> > ^ ~~~~~~~~~~~~~~~~~~~
> > util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64'
> > __u32 size = sizeof(struct timespec64);
> > ^
> >
> > Caused by commit
> >
> > 29d16de26df1 ("perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h")
> >
> > This is a ppc64 le build.
> >
> > I have used the perf tree from next-20240221 for today.
>
> Ok, finally I managed to secure a ppc64 machine to test this and
> sometimes I reproduce just like you reported, but sometimes I can't do
> it, didn't manage to isolate what is that makes it fail sometimes, make
> -C tools/perf clean, nuking the O= target directory, etc, when I
> reproduce it:
So I think I see the problem, I now left the build directory with a
previous build from torvalds/master, then switched to the
perf-tools-branch and tried to build from there, without first removing
the old build, it fails:
CLANG /tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o
util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'
329 | __u32 size = sizeof(struct timespec64);
| ^ ~~~~~~~~~~~~~~~~~~~
util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64'
329 | __u32 size = sizeof(struct timespec64);
| ^
1 error generated.
make[2]: *** [Makefile.perf:1161: /tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o] Error 1
make[1]: *** [Makefile.perf:264: sub-make] Error 2
Because it will use what was installed before in the build dir:
[acme@ibm-p9z-16-lp5 perf-tools-next]$ ls -la /tmp/build/perf-tools-next/util/bpf_skel/vmlinux.h
-rw-r--r--. 1 acme acme 4319 Feb 23 14:59 /tmp/build/perf-tools-next/util/bpf_skel/vmlinux.h
[acme@ibm-p9z-16-lp5 perf-tools-next]$
And that one doesn't have 'struct timespec64':
[acme@ibm-p9z-16-lp5 perf-tools-next]$ grep timespec64 /tmp/build/perf-tools-next/util/bpf_skel/vmlinux.h
[acme@ibm-p9z-16-lp5 perf-tools-next]$
If I remove that directory contents:
[acme@ibm-p9z-16-lp5 perf-tools-next]$ rm -rf /tmp/build/perf-tools-next/
[acme@ibm-p9z-16-lp5 perf-tools-next]$ mkdir /tmp/build/perf-tools-next/
[acme@ibm-p9z-16-lp5 perf-tools-next]$
And then try to build again:
make -k O=/tmp/build/perf-tools-next/ -C tools/perf install-bin
It works.
I reproduced the problem on x86_64, so, on this transition period, the
problem happens, probably we need to robustify the installation of
tools/perf/util/bpf_skel/vmlinux/vmlinux.h in the O= target directory,
but if you just make sure the build directory is clean before trying to
build it, this time, it should work, wdyt?
Ian, ideas?
- Arnaldo
Hi Arnaldo,
On Fri, Feb 23, 2024 at 12:11 PM Arnaldo Carvalho de Melo
<[email protected]> wrote:
>
> On Fri, Feb 23, 2024 at 04:50:47PM -0300, Arnaldo Carvalho de Melo wrote:
> > On Thu, Feb 22, 2024 at 10:06:56AM +1100, Stephen Rothwell wrote:
> > > Hi all,
> > >
> > > After merging the perf tree, today's linux-next build (native perf)
> > > failed like this:
> > >
> > > util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'
> > > __u32 size = sizeof(struct timespec64);
> > > ^ ~~~~~~~~~~~~~~~~~~~
> > > util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64'
> > > __u32 size = sizeof(struct timespec64);
> > > ^
> > >
> > > Caused by commit
> > >
> > > 29d16de26df1 ("perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h")
> > >
> > > This is a ppc64 le build.
> > >
> > > I have used the perf tree from next-20240221 for today.
> >
> > Ok, finally I managed to secure a ppc64 machine to test this and
> > sometimes I reproduce just like you reported, but sometimes I can't do
> > it, didn't manage to isolate what is that makes it fail sometimes, make
> > -C tools/perf clean, nuking the O= target directory, etc, when I
> > reproduce it:
>
> So I think I see the problem, I now left the build directory with a
> previous build from torvalds/master, then switched to the
> perf-tools-branch and tried to build from there, without first removing
> the old build, it fails:
>
> CLANG /tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o
> util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'
> 329 | __u32 size = sizeof(struct timespec64);
> | ^ ~~~~~~~~~~~~~~~~~~~
> util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64'
> 329 | __u32 size = sizeof(struct timespec64);
> | ^
> 1 error generated.
> make[2]: *** [Makefile.perf:1161: /tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o] Error 1
> make[1]: *** [Makefile.perf:264: sub-make] Error 2
>
>
> Because it will use what was installed before in the build dir:
>
> [acme@ibm-p9z-16-lp5 perf-tools-next]$ ls -la /tmp/build/perf-tools-next/util/bpf_skel/vmlinux.h
> -rw-r--r--. 1 acme acme 4319 Feb 23 14:59 /tmp/build/perf-tools-next/util/bpf_skel/vmlinux.h
> [acme@ibm-p9z-16-lp5 perf-tools-next]$
>
> And that one doesn't have 'struct timespec64':
>
> [acme@ibm-p9z-16-lp5 perf-tools-next]$ grep timespec64 /tmp/build/perf-tools-next/util/bpf_skel/vmlinux.h
> [acme@ibm-p9z-16-lp5 perf-tools-next]$
>
> If I remove that directory contents:
>
> [acme@ibm-p9z-16-lp5 perf-tools-next]$ rm -rf /tmp/build/perf-tools-next/
> [acme@ibm-p9z-16-lp5 perf-tools-next]$ mkdir /tmp/build/perf-tools-next/
> [acme@ibm-p9z-16-lp5 perf-tools-next]$
>
> And then try to build again:
>
> make -k O=/tmp/build/perf-tools-next/ -C tools/perf install-bin
>
> It works.
>
> I reproduced the problem on x86_64, so, on this transition period, the
> problem happens, probably we need to robustify the installation of
> tools/perf/util/bpf_skel/vmlinux/vmlinux.h in the O= target directory,
> but if you just make sure the build directory is clean before trying to
> build it, this time, it should work, wdyt?
Can we add a dependency to the minimal vmlinux.h?
Thanks,
Namhyung
---8<---
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 3cecd51b2397..33621114135e 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -1147,7 +1147,7 @@ ifeq ($(VMLINUX_H),)
endif
endif
-$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL)
+$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) $(VMLINUX_H)
ifeq ($(VMLINUX_H),)
$(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@
else
On Fri, Feb 23, 2024 at 12:34:40PM -0800, Namhyung Kim wrote:
> Hi Arnaldo,
>
> On Fri, Feb 23, 2024 at 12:11 PM Arnaldo Carvalho de Melo
> <[email protected]> wrote:
> >
> > On Fri, Feb 23, 2024 at 04:50:47PM -0300, Arnaldo Carvalho de Melo wrote:
> > > On Thu, Feb 22, 2024 at 10:06:56AM +1100, Stephen Rothwell wrote:
> > > > Hi all,
> > > >
> > > > After merging the perf tree, today's linux-next build (native perf)
> > > > failed like this:
> > > >
> > > > util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'
> > > > __u32 size = sizeof(struct timespec64);
> > > > ^ ~~~~~~~~~~~~~~~~~~~
> > > > util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64'
> > > > __u32 size = sizeof(struct timespec64);
> > > > ^
> > > >
> > > > Caused by commit
> > > >
> > > > 29d16de26df1 ("perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h")
> > > >
> > > > This is a ppc64 le build.
> > > >
> > > > I have used the perf tree from next-20240221 for today.
> > >
> > > Ok, finally I managed to secure a ppc64 machine to test this and
> > > sometimes I reproduce just like you reported, but sometimes I can't do
> > > it, didn't manage to isolate what is that makes it fail sometimes, make
> > > -C tools/perf clean, nuking the O= target directory, etc, when I
> > > reproduce it:
> >
> > So I think I see the problem, I now left the build directory with a
> > previous build from torvalds/master, then switched to the
> > perf-tools-branch and tried to build from there, without first removing
> > the old build, it fails:
> >
> > CLANG /tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o
> > util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'
> > 329 | __u32 size = sizeof(struct timespec64);
> > | ^ ~~~~~~~~~~~~~~~~~~~
> > util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64'
> > 329 | __u32 size = sizeof(struct timespec64);
> > | ^
> > 1 error generated.
> > make[2]: *** [Makefile.perf:1161: /tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o] Error 1
> > make[1]: *** [Makefile.perf:264: sub-make] Error 2
> >
> >
> > Because it will use what was installed before in the build dir:
> >
> > [acme@ibm-p9z-16-lp5 perf-tools-next]$ ls -la /tmp/build/perf-tools-next/util/bpf_skel/vmlinux.h
> > -rw-r--r--. 1 acme acme 4319 Feb 23 14:59 /tmp/build/perf-tools-next/util/bpf_skel/vmlinux.h
> > [acme@ibm-p9z-16-lp5 perf-tools-next]$
> >
> > And that one doesn't have 'struct timespec64':
> >
> > [acme@ibm-p9z-16-lp5 perf-tools-next]$ grep timespec64 /tmp/build/perf-tools-next/util/bpf_skel/vmlinux.h
> > [acme@ibm-p9z-16-lp5 perf-tools-next]$
> >
> > If I remove that directory contents:
> >
> > [acme@ibm-p9z-16-lp5 perf-tools-next]$ rm -rf /tmp/build/perf-tools-next/
> > [acme@ibm-p9z-16-lp5 perf-tools-next]$ mkdir /tmp/build/perf-tools-next/
> > [acme@ibm-p9z-16-lp5 perf-tools-next]$
> >
> > And then try to build again:
> >
> > make -k O=/tmp/build/perf-tools-next/ -C tools/perf install-bin
> >
> > It works.
> >
> > I reproduced the problem on x86_64, so, on this transition period, the
> > problem happens, probably we need to robustify the installation of
> > tools/perf/util/bpf_skel/vmlinux/vmlinux.h in the O= target directory,
> > but if you just make sure the build directory is clean before trying to
> > build it, this time, it should work, wdyt?
>
> Can we add a dependency to the minimal vmlinux.h?
That fixes it, I'll submit a formal patch
- Arnaldo
> Thanks,
> Namhyung
>
> ---8<---
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 3cecd51b2397..33621114135e 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -1147,7 +1147,7 @@ ifeq ($(VMLINUX_H),)
> endif
> endif
>
> -$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL)
> +$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) $(VMLINUX_H)
> ifeq ($(VMLINUX_H),)
> $(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@
> else