2024-04-01 22:42:10

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the perf tree

Hi all,

After merging the perf tree, today's linux-next build (native i.e. ppc64le
perf) failed like this:

make[3]: *** No rule to make target '/home/sfr/next/next/tools/include/uapi/linux/stat.h', needed by '/home/sfr/next/perf/libbpf/staticobjs/libbpf.o'. Stop.

Maybe caused by commit

f122b3d6d179 ("perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument")

or

a672af9139a8 ("tools headers: Remove almost unused copy of uapi/stat.h, add few conditional defines")

or a combination of them?

This is an incremental build but doing 'make -C tools/perf clean' and then
rebuilding works, so maybe there is a dependency missing?

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2024-04-02 20:47:36

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the perf tree

On Tue, Apr 02, 2024 at 09:41:16AM +1100, Stephen Rothwell wrote:
> Hi all,
>
> After merging the perf tree, today's linux-next build (native i.e. ppc64le
> perf) failed like this:
>
> make[3]: *** No rule to make target '/home/sfr/next/next/tools/include/uapi/linux/stat.h', needed by '/home/sfr/next/perf/libbpf/staticobjs/libbpf.o'. Stop.
>
> Maybe caused by commit
>
> f122b3d6d179 ("perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument")
>
> or
>
> a672af9139a8 ("tools headers: Remove almost unused copy of uapi/stat.h, add few conditional defines")
>
> or a combination of them?

Right, these are headers that were used to extract string tables but
were added to a directory that was also used to build tools, sometimes
because headers contained new defines that wouldn't be available in
older distros.

We're trying to move things that are needed just for creating string
tables to a separate directory, as done in the second cset you mentioned
above, how to do it in a way that is noticed by the dependency files
cached by the tools build processes is what is needed here.

I planned to investigate and fix this, but this was preventing
development work to proceed as 6.9-rc was released, so I ended up moving
these to perf-tools-next, I'll try again to investigate the deps issue
to make this (and further work in this area) to avoid requiring these
'make clean' steps.

> This is an incremental build but doing 'make -C tools/perf clean' and then
> rebuilding works, so maybe there is a dependency missing?

Thanks for reporting.

- Arnaldo

2024-04-12 15:31:52

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the perf tree

On Tue, Apr 02, 2024 at 09:41:16AM +1100, Stephen Rothwell wrote:
> Hi all,
>
> After merging the perf tree, today's linux-next build (native i.e. ppc64le
> perf) failed like this:
>
> make[3]: *** No rule to make target '/home/sfr/next/next/tools/include/uapi/linux/stat.h', needed by '/home/sfr/next/perf/libbpf/staticobjs/libbpf.o'. Stop.

How is this built? Using O=/home/sfr/next/perf?

> Maybe caused by commit
>
> f122b3d6d179 ("perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument")
>
> or
>
> a672af9139a8 ("tools headers: Remove almost unused copy of uapi/stat.h, add few conditional defines")
>
> or a combination of them?
>
> This is an incremental build but doing 'make -C tools/perf clean' and then
> rebuilding works, so maybe there is a dependency missing?

So I'm trying to revisit this, I did:

⬢[acme@toolbox perf-tools-next]$ rm -rf /tmp/build/$(basename $PWD)/ ; mkdir -p /tmp/build/$(basename $PWD)/
⬢[acme@toolbox perf-tools-next]$ alias m='rm -rf ~/libexec/perf-core/ ; make -k CORESIGHT=1 O=/tmp/build/$(basename $PWD)/ -C tools/perf install-bin && perf test python'
⬢[acme@toolbox perf-tools-next]$ git remote update torvalds
Fetching torvalds
⬢[acme@toolbox perf-tools-next]$ m
<SNIP>
LD /tmp/build/perf-tools-next/perf-in.o
CC /tmp/build/perf-tools-next/pmu-events/pmu-events.o
LD /tmp/build/perf-tools-next/pmu-events/pmu-events-in.o
LINK /tmp/build/perf-tools-next/perf
INSTALL binaries
INSTALL tests
INSTALL libperf-jvmti.so
INSTALL libexec
INSTALL perf-archive
INSTALL perf-iostat
INSTALL strace/groups
INSTALL perl-scripts
INSTALL python-scripts
INSTALL dlfilters
INSTALL perf_completion-script
INSTALL perf-tip
make: Leaving directory '/home/acme/git/perf-tools-next/tools/perf'
17: 'import perf' in python : Ok
⬢[acme@toolbox perf-tools-next]$

Then left this there and merged perf-tools-next:

⬢[acme@toolbox perf-tools-next]$ git merge perf-tools-next
Auto-merging MAINTAINERS
Merge made by the 'ort' strategy.
MAINTAINERS | 1 +
tools/include/uapi/asm-generic/fcntl.h | 221 -----------
tools/include/uapi/linux/openat2.h | 43 ---
tools/lib/perf/cpumap.c | 33 +-
tools/lib/perf/include/perf/cpumap.h | 16 +
tools/lib/perf/libperf.map | 4 +
<SNIP>
tools/perf/util/vdso.c | 48 +--
186 files changed, 7217 insertions(+), 3829 deletions(-)
delete mode 100644 tools/include/uapi/asm-generic/fcntl.h
delete mode 100644 tools/include/uapi/linux/openat2.h
rename tools/{ => perf/trace/beauty}/arch/x86/include/asm/irq_vectors.h (100%)
rename tools/{ => perf/trace/beauty}/arch/x86/include/uapi/asm/prctl.h (100%)
create mode 100755 tools/perf/trace/beauty/clone.sh
create mode 100644 tools/perf/trace/beauty/fs_at_flags.c
create mode 100755 tools/perf/trace/beauty/fs_at_flags.sh
rename tools/{ => perf/trace/beauty}/include/uapi/linux/fcntl.h (100%)
rename tools/{ => perf/trace/beauty}/include/uapi/linux/fs.h (100%)
rename tools/{ => perf/trace/beauty}/include/uapi/linux/mount.h (100%)
rename tools/{ => perf/trace/beauty}/include/uapi/linux/prctl.h (100%)
rename tools/{ => perf/trace/beauty}/include/uapi/linux/sched.h (100%)
rename tools/{ => perf/trace/beauty}/include/uapi/linux/stat.h (100%)
rename tools/{ => perf/trace/beauty}/include/uapi/linux/usbdevice_fs.h (100%)
rename tools/{ => perf/trace/beauty}/include/uapi/linux/vhost.h (100%)
rename tools/{ => perf/trace/beauty}/include/uapi/sound/asound.h (100%)
create mode 100755 tools/perf/trace/beauty/statx_mask.sh
create mode 100644 tools/perf/ui/browsers/annotate-data.c
create mode 100644 tools/perf/util/disasm.c
create mode 100644 tools/perf/util/disasm.h
⬢[acme@toolbox perf-tools-next]$

And:

⬢[acme@toolbox perf-tools-next]$ m
rm: cannot remove '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace/__pycache__/Core.cpython-312.pyc': Permission denied
make: Entering directory '/home/acme/git/perf-tools-next/tools/perf'
BUILD: Doing 'make -j28' parallel build
Warning: Kernel ABI header differences:
<SNIP>
Auto-detecting system features:
.. dwarf: [ on ]
.. dwarf_getlocations: [ on ]
.. glibc: [ on ]
.. libbfd: [ on ]
.. libbfd-buildid: [ on ]
.. libcap: [ on ]
.. libelf: [ on ]
.. libnuma: [ on ]
.. numa_num_possible_cpus: [ on ]
.. libperl: [ on ]
.. libpython: [ on ]
.. libcrypto: [ on ]
.. libunwind: [ on ]
.. libdw-dwarf-unwind: [ on ]
.. libcapstone: [ on ]
.. zlib: [ on ]
.. lzma: [ on ]
.. get_cpuid: [ on ]
.. bpf: [ on ]
.. libaio: [ on ]
.. libzstd: [ on ]

GEN /tmp/build/perf-tools-next/common-cmds.h
LINK /tmp/build/perf-tools-next/libperf-jvmti.so
INSTALL /tmp/build/perf-tools-next/libsubcmd/include/subcmd/run-command.h
<SNIP>
INSTALL libbpf_headers
LD /tmp/build/perf-tools-next/libperf/libperf-in.o
CLANG /tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o
AR /tmp/build/perf-tools-next/libperf/libperf.a
GENSKEL /tmp/build/perf-tools-next/util/bpf_skel/augmented_raw_syscalls.skel.h
GEN /tmp/build/perf-tools-next/python/perf.cpython-312-x86_64-linux-gnu.so
GEN /tmp/build/perf-tools-next/pmu-events/pmu-events.c
CC /tmp/build/perf-tools-next/builtin-bench.o
CC /tmp/build/perf-tools-next/builtin-annotate.o
<SNIP>
CC /tmp/build/perf-tools-next/util/bpf-event.o
CC /tmp/build/perf-tools-next/util/bpf-utils.o
CC /tmp/build/perf-tools-next/util/pfm.o
LD /tmp/build/perf-tools-next/util/scripting-engines/perf-in.o
LD /tmp/build/perf-tools-next/util/perf-in.o
LD /tmp/build/perf-tools-next/perf-in.o
CC /tmp/build/perf-tools-next/pmu-events/pmu-events.o
LD /tmp/build/perf-tools-next/pmu-events/pmu-events-in.o
LINK /tmp/build/perf-tools-next/perf
INSTALL binaries
INSTALL tests
INSTALL libperf-jvmti.so
INSTALL libexec
INSTALL perf-archive
INSTALL perf-iostat
INSTALL strace/groups
INSTALL perl-scripts
INSTALL python-scripts
INSTALL dlfilters
INSTALL perf_completion-script
INSTALL perf-tip
make: Leaving directory '/home/acme/git/perf-tools-next/tools/perf'
17: 'import perf' in python : Ok
⬢[acme@toolbox perf-tools-next]$

⬢[acme@toolbox perf-tools-next]$ ls -la tools/include/uapi/linux/stat.h
ls: cannot access 'tools/include/uapi/linux/stat.h': No such file or directory
⬢[acme@toolbox perf-tools-next]$

I'm not being able to reproduce that problem, can you see where am I
doing some mistake in the above steps?

Thanks,

- Arnaldo

2024-04-13 02:43:56

by Stephen Rothwell

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the perf tree

Hi Arnaldo,

On Fri, 12 Apr 2024 12:22:07 -0300 Arnaldo Carvalho de Melo <[email protected]> wrote:
>
> On Tue, Apr 02, 2024 at 09:41:16AM +1100, Stephen Rothwell wrote:
> > Hi all,
> >
> > After merging the perf tree, today's linux-next build (native i.e. ppc64le
> > perf) failed like this:
> >
> > make[3]: *** No rule to make target '/home/sfr/next/next/tools/include/uapi/linux/stat.h', needed by '/home/sfr/next/perf/libbpf/staticobjs/libbpfo'. Stop.
>
> How is this built? Using O=/home/sfr/next/perf?

Yes. The actual command line is:

make -C tools/perf -f Makefile.perf -s -O -j60 O=/home/sfr/next/perf NO_BPF_SKEL=1

The source directory is /home/sfr/next/next. This is a PowerPC 64 little endian
build (on a PowerPC 64 little endian host).

OK, I just tested on my x86_64 laptop:
(I started with a clone of Linus' current tree)

pine:~/next/next (master)$ rm -rf ../perf
pine:~/next/next (master)$ mkdir ../perf
pine:~/next/next (master)$ make -C tools/perf -f Makefile.perf -s -O -j10 O=/home/sfr/next/perf NO_BPF_SKEL=1
Warning: Kernel ABI header differences:
diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
diff -u tools/include/uapi/linux/fs.h include/uapi/linux/fs.h
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h
diff -u tools/include/uapi/sound/asound.h include/uapi/sound/asound.h
diff -u tools/include/linux/bits.h include/linux/bits.h
diff -u tools/arch/x86/include/asm/disabled-features.h arch/x86/include/asm/disabled-features.h
diff -u tools/arch/x86/include/asm/required-features.h arch/x86/include/asm/required-features.h
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
diff -u tools/arch/x86/include/asm/irq_vectors.h arch/x86/include/asm/irq_vectors.h
diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h
diff -u tools/arch/powerpc/include/uapi/asm/kvm.h arch/powerpc/include/uapi/asm/kvm.h
diff -u tools/arch/s390/include/uapi/asm/kvm.h arch/s390/include/uapi/asm/kvm.h
diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
diff -u tools/include/asm-generic/bitops/__fls.h include/asm-generic/bitops/__fls.h
diff -u tools/include/asm-generic/bitops/fls.h include/asm-generic/bitops/fls.h
diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
Makefile.config:455: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR
Makefile.config:460: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
Makefile.config:602: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev
Makefile.config:688: Warning: Disabled BPF skeletons as clang (clang) is missing
Makefile.config:800: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev
Makefile.config:1083: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
Makefile.config:1147: No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel
Makefile.config:1160: libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev

Auto-detecting system features:
.. dwarf: [ OFF ]
.. dwarf_getlocations: [ OFF ]
.. glibc: [ on ]
.. libbfd: [ on ]
.. libbfd-buildid: [ on ]
.. libcap: [ on ]
.. libelf: [ on ]
.. libnuma: [ on ]
.. numa_num_possible_cpus: [ on ]
.. libperl: [ on ]
.. libpython: [ on ]
.. libcrypto: [ on ]
.. libunwind: [ on ]
.. libdw-dwarf-unwind: [ OFF ]
.. libcapstone: [ on ]
.. zlib: [ on ]
.. lzma: [ on ]
.. get_cpuid: [ on ]
.. bpf: [ on ]
.. libaio: [ on ]
.. libzstd: [ on ]

PERF_VERSION = 6.9.rc3.g8f2c057754b2
pine:~/next/next (master)$ git merge perf-tools-next
Auto-merging MAINTAINERS
Merge made by the 'ort' strategy.
MAINTAINERS | 1 +
tools/include/uapi/asm-generic/fcntl.h | 221 --
.
.
.
create mode 100644 tools/perf/util/disasm.h
pine:~/next/next (master)$ make -C tools/perf -f Makefile.perf -s -O -j10 O=/home/sfr/next/perf NO_BPF_SKEL=1
Warning: Kernel ABI header differences:
diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
diff -u tools/include/linux/bits.h include/linux/bits.h
diff -u tools/arch/x86/include/asm/disabled-features.h arch/x86/include/asm/disabled-features.h
diff -u tools/arch/x86/include/asm/required-features.h arch/x86/include/asm/required-features.h
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
diff -u tools/arch/x86/include/uapi/asm/kvm.h arch/x86/include/uapi/asm/kvm.h
diff -u tools/arch/powerpc/include/uapi/asm/kvm.h arch/powerpc/include/uapi/asm/kvm.h
diff -u tools/arch/s390/include/uapi/asm/kvm.h arch/s390/include/uapi/asm/kvm.h
diff -u tools/arch/arm64/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h
diff -u tools/include/asm-generic/bitops/__fls.h include/asm-generic/bitops/__fls.h
diff -u tools/include/asm-generic/bitops/fls.h include/asm-generic/bitops/fls.h
diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
diff -u tools/perf/trace/beauty/arch/x86/include/asm/irq_vectors.h arch/x86/include/asm/irq_vectors.h
diff -u tools/perf/trace/beauty/include/uapi/linux/fs.h include/uapi/linux/fs.h
diff -u tools/perf/trace/beauty/include/uapi/linux/vhost.h include/uapi/linux/vhost.h
diff -u tools/perf/trace/beauty/include/uapi/sound/asound.h include/uapi/sound/asound.h
Makefile.config:465: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR
Makefile.config:470: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
Makefile.config:612: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev
Makefile.config:698: Warning: Disabled BPF skeletons as clang (clang) is missing
Makefile.config:810: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev
Makefile.config:1093: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
Makefile.config:1157: No openjdk development package found, please install JDK package, e.g. openjdk-8-jdk, java-1.8.0-openjdk-devel
Makefile.config:1170: libpfm4 not found, disables libpfm4 support. Please install libpfm4-dev

Auto-detecting system features:
.. dwarf: [ OFF ]
.. dwarf_getlocations: [ OFF ]
.. glibc: [ on ]
.. libbfd: [ on ]
.. libbfd-buildid: [ on ]
.. libcap: [ on ]
.. libelf: [ on ]
.. libnuma: [ on ]
.. numa_num_possible_cpus: [ on ]
.. libperl: [ on ]
.. libpython: [ on ]
.. libcrypto: [ on ]
.. libunwind: [ on ]
.. libdw-dwarf-unwind: [ OFF ]
.. libcapstone: [ on ]
.. zlib: [ on ]
.. lzma: [ on ]
.. get_cpuid: [ on ]
.. bpf: [ on ]
.. libaio: [ on ]
.. libzstd: [ on ]

PERF_VERSION = 6.9.rc3.g42c4635c8dee
make[3]: *** No rule to make target '/home/sfr/next/next/tools/include/uapi/linux/stat.h', needed by '/home/sfr/next/perf/libbpf/staticobjs/libbpf.o'. Stop.
make[2]: *** [Makefile:157: /home/sfr/next/perf/libbpf/staticobjs/libbpf-ino] Error 2
make[1]: *** [Makefile.perf:892: /home/sfr/next/perf/libbpf/libbpf.a] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile.perf:264: sub-make] Error 2

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2024-04-18 21:33:22

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: [PATCH][RFT] Re: linux-next: build failure after merge of the perf tree

On Sat, Apr 13, 2024 at 12:43:40PM +1000, Stephen Rothwell wrote:
> Hi Arnaldo,
>
> On Fri, 12 Apr 2024 12:22:07 -0300 Arnaldo Carvalho de Melo <[email protected]> wrote:
> >
> > On Tue, Apr 02, 2024 at 09:41:16AM +1100, Stephen Rothwell wrote:
> > > Hi all,
> > >
> > > After merging the perf tree, today's linux-next build (native i.e. ppc64le
> > > perf) failed like this:
> > >
> > > make[3]: *** No rule to make target '/home/sfr/next/next/tools/include/uapi/linux/stat.h', needed by '/home/sfr/next/perf/libbpf/staticobjs/libbpf.o'. Stop.
> >
> > How is this built? Using O=/home/sfr/next/perf?
>
> Yes. The actual command line is:
>
> make -C tools/perf -f Makefile.perf -s -O -j60 O=/home/sfr/next/perf NO_BPF_SKEL=1
>
> The source directory is /home/sfr/next/next. This is a PowerPC 64 little endian
> build (on a PowerPC 64 little endian host).
>
> OK, I just tested on my x86_64 laptop:
> (I started with a clone of Linus' current tree)

Ok, I did that sequence:

1. checkout torvalds/master
2. use the make command line above
3. git merge perf-tools-next
4. use the make command line above

And reproduced the problem, find below a patch that reverts the patch
that removes tools/include/uapi/linux/stat.h, with it applied in the
sequence above right after the merge of perf-tools-next it seems to
work, i.e. it builds without problems.

Can you please test this so that I can get it into perf-tools-next?

Thanks again for the report!

- Arnaldo

From cec45ef1ad23059aac607d0db959c73c2198bc2a Mon Sep 17 00:00:00 2001
From: Arnaldo Carvalho de Melo <[email protected]>
Date: Thu, 18 Apr 2024 18:15:33 -0300
Subject: [PATCH 1/1] Revert "tools headers: Remove almost unused copy of
uapi/stat.h, add few conditional defines"

This reverts commit a672af9139a843eb7a48fd7846bb6df8f81b5f86.

By now it is not used for building tools/perf, but Stephen Rothwell
reported that when building on a O= directory that had been built with
torvalds/master and this perf build command line:

$ make -C tools/perf -f Makefile.perf -s -O -j60 O=/home/sfr/next/perf NO_BPF_SKEL=1

If we then merge perf-tools-next, as he did for linux-next, then we end
up with a build failure for libbpf:

PERF_VERSION = 6.9.rc3.g42c4635c8dee
make[3]: *** No rule to make target '/home/sfr/next/next/tools/include/uapi/linux/stat.h', needed by '/home/sfr/next/perf/libbpf/staticobjs/libbpf.o'. Stop.
make[2]: *** [Makefile:157: /home/sfr/next/perf/libbpf/staticobjs/libbpf-in.o] Error 2
make[1]: *** [Makefile.perf:892: /home/sfr/next/perf/libbpf/libbpf.a] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile.perf:264: sub-make] Error 2

This needs to be further investigated to figure out how to check if
libbpf really needs something that is in that
tools/include/uapi/linux/stat.h file and if not to remove that file in a
way that we don't break the build in any situation, to avoid requiring
doing a 'make clean'.

Reported-by: Stephen Rothwell <[email protected]>
Cc: Namhyung Kim <[email protected]>
Link: https://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
---
tools/include/uapi/linux/stat.h | 195 ++++++++++++++++++++++++++++++++
tools/perf/check-headers.sh | 1 +
2 files changed, 196 insertions(+)
create mode 100644 tools/include/uapi/linux/stat.h

diff --git a/tools/include/uapi/linux/stat.h b/tools/include/uapi/linux/stat.h
new file mode 100644
index 0000000000000000..2f2ee82d55175d05
--- /dev/null
+++ b/tools/include/uapi/linux/stat.h
@@ -0,0 +1,195 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_STAT_H
+#define _UAPI_LINUX_STAT_H
+
+#include <linux/types.h>
+
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
+#define S_IFMT 00170000
+#define S_IFSOCK 0140000
+#define S_IFLNK 0120000
+#define S_IFREG 0100000
+#define S_IFBLK 0060000
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFIFO 0010000
+#define S_ISUID 0004000
+#define S_ISGID 0002000
+#define S_ISVTX 0001000
+
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+
+#define S_IRWXU 00700
+#define S_IRUSR 00400
+#define S_IWUSR 00200
+#define S_IXUSR 00100
+
+#define S_IRWXG 00070
+#define S_IRGRP 00040
+#define S_IWGRP 00020
+#define S_IXGRP 00010
+
+#define S_IRWXO 00007
+#define S_IROTH 00004
+#define S_IWOTH 00002
+#define S_IXOTH 00001
+
+#endif
+
+/*
+ * Timestamp structure for the timestamps in struct statx.
+ *
+ * tv_sec holds the number of seconds before (negative) or after (positive)
+ * 00:00:00 1st January 1970 UTC.
+ *
+ * tv_nsec holds a number of nanoseconds (0..999,999,999) after the tv_sec time.
+ *
+ * __reserved is held in case we need a yet finer resolution.
+ */
+struct statx_timestamp {
+ __s64 tv_sec;
+ __u32 tv_nsec;
+ __s32 __reserved;
+};
+
+/*
+ * Structures for the extended file attribute retrieval system call
+ * (statx()).
+ *
+ * The caller passes a mask of what they're specifically interested in as a
+ * parameter to statx(). What statx() actually got will be indicated in
+ * st_mask upon return.
+ *
+ * For each bit in the mask argument:
+ *
+ * - if the datum is not supported:
+ *
+ * - the bit will be cleared, and
+ *
+ * - the datum will be set to an appropriate fabricated value if one is
+ * available (eg. CIFS can take a default uid and gid), otherwise
+ *
+ * - the field will be cleared;
+ *
+ * - otherwise, if explicitly requested:
+ *
+ * - the datum will be synchronised to the server if AT_STATX_FORCE_SYNC is
+ * set or if the datum is considered out of date, and
+ *
+ * - the field will be filled in and the bit will be set;
+ *
+ * - otherwise, if not requested, but available in approximate form without any
+ * effort, it will be filled in anyway, and the bit will be set upon return
+ * (it might not be up to date, however, and no attempt will be made to
+ * synchronise the internal state first);
+ *
+ * - otherwise the field and the bit will be cleared before returning.
+ *
+ * Items in STATX_BASIC_STATS may be marked unavailable on return, but they
+ * will have values installed for compatibility purposes so that stat() and
+ * co. can be emulated in userspace.
+ */
+struct statx {
+ /* 0x00 */
+ __u32 stx_mask; /* What results were written [uncond] */
+ __u32 stx_blksize; /* Preferred general I/O size [uncond] */
+ __u64 stx_attributes; /* Flags conveying information about the file [uncond] */
+ /* 0x10 */
+ __u32 stx_nlink; /* Number of hard links */
+ __u32 stx_uid; /* User ID of owner */
+ __u32 stx_gid; /* Group ID of owner */
+ __u16 stx_mode; /* File mode */
+ __u16 __spare0[1];
+ /* 0x20 */
+ __u64 stx_ino; /* Inode number */
+ __u64 stx_size; /* File size */
+ __u64 stx_blocks; /* Number of 512-byte blocks allocated */
+ __u64 stx_attributes_mask; /* Mask to show what's supported in stx_attributes */
+ /* 0x40 */
+ struct statx_timestamp stx_atime; /* Last access time */
+ struct statx_timestamp stx_btime; /* File creation time */
+ struct statx_timestamp stx_ctime; /* Last attribute change time */
+ struct statx_timestamp stx_mtime; /* Last data modification time */
+ /* 0x80 */
+ __u32 stx_rdev_major; /* Device ID of special file [if bdev/cdev] */
+ __u32 stx_rdev_minor;
+ __u32 stx_dev_major; /* ID of device containing file [uncond] */
+ __u32 stx_dev_minor;
+ /* 0x90 */
+ __u64 stx_mnt_id;
+ __u32 stx_dio_mem_align; /* Memory buffer alignment for direct I/O */
+ __u32 stx_dio_offset_align; /* File offset alignment for direct I/O */
+ /* 0xa0 */
+ __u64 __spare3[12]; /* Spare space for future expansion */
+ /* 0x100 */
+};
+
+/*
+ * Flags to be stx_mask
+ *
+ * Query request/result mask for statx() and struct statx::stx_mask.
+ *
+ * These bits should be set in the mask argument of statx() to request
+ * particular items when calling statx().
+ */
+#define STATX_TYPE 0x00000001U /* Want/got stx_mode & S_IFMT */
+#define STATX_MODE 0x00000002U /* Want/got stx_mode & ~S_IFMT */
+#define STATX_NLINK 0x00000004U /* Want/got stx_nlink */
+#define STATX_UID 0x00000008U /* Want/got stx_uid */
+#define STATX_GID 0x00000010U /* Want/got stx_gid */
+#define STATX_ATIME 0x00000020U /* Want/got stx_atime */
+#define STATX_MTIME 0x00000040U /* Want/got stx_mtime */
+#define STATX_CTIME 0x00000080U /* Want/got stx_ctime */
+#define STATX_INO 0x00000100U /* Want/got stx_ino */
+#define STATX_SIZE 0x00000200U /* Want/got stx_size */
+#define STATX_BLOCKS 0x00000400U /* Want/got stx_blocks */
+#define STATX_BASIC_STATS 0x000007ffU /* The stuff in the normal stat struct */
+#define STATX_BTIME 0x00000800U /* Want/got stx_btime */
+#define STATX_MNT_ID 0x00001000U /* Got stx_mnt_id */
+#define STATX_DIOALIGN 0x00002000U /* Want/got direct I/O alignment info */
+#define STATX_MNT_ID_UNIQUE 0x00004000U /* Want/got extended stx_mount_id */
+
+#define STATX__RESERVED 0x80000000U /* Reserved for future struct statx expansion */
+
+#ifndef __KERNEL__
+/*
+ * This is deprecated, and shall remain the same value in the future. To avoid
+ * confusion please use the equivalent (STATX_BASIC_STATS | STATX_BTIME)
+ * instead.
+ */
+#define STATX_ALL 0x00000fffU
+#endif
+
+/*
+ * Attributes to be found in stx_attributes and masked in stx_attributes_mask.
+ *
+ * These give information about the features or the state of a file that might
+ * be of use to ordinary userspace programs such as GUIs or ls rather than
+ * specialised tools.
+ *
+ * Note that the flags marked [I] correspond to the FS_IOC_SETFLAGS flags
+ * semantically. Where possible, the numerical value is picked to correspond
+ * also. Note that the DAX attribute indicates that the file is in the CPU
+ * direct access state. It does not correspond to the per-inode flag that
+ * some filesystems support.
+ *
+ */
+#define STATX_ATTR_COMPRESSED 0x00000004 /* [I] File is compressed by the fs */
+#define STATX_ATTR_IMMUTABLE 0x00000010 /* [I] File is marked immutable */
+#define STATX_ATTR_APPEND 0x00000020 /* [I] File is append-only */
+#define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */
+#define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */
+#define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */
+#define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */
+#define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */
+#define STATX_ATTR_DAX 0x00200000 /* File is currently in DAX state */
+
+
+#endif /* _UAPI_LINUX_STAT_H */
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index 95a3a404bc6fddde..9c84fd0490707452 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -16,6 +16,7 @@ FILES=(
"include/uapi/linux/in.h"
"include/uapi/linux/perf_event.h"
"include/uapi/linux/seccomp.h"
+ "include/uapi/linux/stat.h"
"include/linux/bits.h"
"include/vdso/bits.h"
"include/linux/const.h"
--
2.44.0


2024-04-18 23:17:35

by Stephen Rothwell

[permalink] [raw]
Subject: Re: [PATCH][RFT] Re: linux-next: build failure after merge of the perf tree

Hi Arnaldo,

On Thu, 18 Apr 2024 18:31:45 -0300 Arnaldo Carvalho de Melo <[email protected]> wrote:
>
>
> And reproduced the problem, find below a patch that reverts the patch
> that removes tools/include/uapi/linux/stat.h, with it applied in the
> sequence above right after the merge of perf-tools-next it seems to
> work, i.e. it builds without problems.
>
> Can you please test this so that I can get it into perf-tools-next?

That works for me. Thanks for this.

Tested-by: Stephen Rothwell <[email protected]> # PowerPC le incermental build

I will apply that patch to linux-next today (if you don't have time to
update your tree before I merge it).
--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2024-04-19 00:54:12

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH][RFT] Re: linux-next: build failure after merge of the perf tree

On Fri, Apr 19, 2024 at 09:17:17AM +1000, Stephen Rothwell wrote:
> Hi Arnaldo,
>
> On Thu, 18 Apr 2024 18:31:45 -0300 Arnaldo Carvalho de Melo <[email protected]> wrote:
> >
> >
> > And reproduced the problem, find below a patch that reverts the patch
> > that removes tools/include/uapi/linux/stat.h, with it applied in the
> > sequence above right after the merge of perf-tools-next it seems to
> > work, i.e. it builds without problems.
> >
> > Can you please test this so that I can get it into perf-tools-next?
>
> That works for me. Thanks for this.
>
> Tested-by: Stephen Rothwell <[email protected]> # PowerPC le incermental build
>
> I will apply that patch to linux-next today (if you don't have time to
> update your tree before I merge it).

I'm finishing some local tests here, will push perf-tools-next after
that, some 30 minutes.

- Arnaldo

2024-04-19 01:06:59

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH][RFT] Re: linux-next: build failure after merge of the perf tree

On Thu, Apr 18, 2024 at 09:54:03PM -0300, Arnaldo Carvalho de Melo wrote:
> On Fri, Apr 19, 2024 at 09:17:17AM +1000, Stephen Rothwell wrote:
> > On Thu, 18 Apr 2024 18:31:45 -0300 Arnaldo Carvalho de Melo <[email protected]> wrote:
> > > And reproduced the problem, find below a patch that reverts the patch
> > > that removes tools/include/uapi/linux/stat.h, with it applied in the
> > > sequence above right after the merge of perf-tools-next it seems to
> > > work, i.e. it builds without problems.

> > > Can you please test this so that I can get it into perf-tools-next?

> > That works for me. Thanks for this.

> > Tested-by: Stephen Rothwell <[email protected]> # PowerPC le incermental build

> > I will apply that patch to linux-next today (if you don't have time to
> > update your tree before I merge it).

> I'm finishing some local tests here, will push perf-tools-next after
> that, some 30 minutes.

Ah, and again thanks for the report and follow up collaboration on
having these things sorted out, I'm sorry for not having this fixed
sooner, I'm taking notes to automate this type of test and have it done
before pushing branches publicly.

I just found it strange that when trying to reproduce this the problem
didn't manifested itself reliably, but then, ENOTIME to root cause this
so far, this (partial) revert is the best thing we can do now, so lets
go with it.

- Arnaldo