Re: [PATCH] perf trace beauty fcntl: Fix build with older kernel headers
From: Ian Rogers
Date: Thu May 14 2026 - 13:14:06 EST
On Thu, May 14, 2026 at 9:57 AM Florian Fainelli
<florian.fainelli@xxxxxxxxxxxx> wrote:
>
> On 5/14/2026 9:37 AM, Ian Rogers wrote:
> > On Thu, May 14, 2026 at 8:56 AM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >>
> >> Hello,
> >>
> >> On Wed, May 13, 2026 at 12:23:46PM -0700, Florian Fainelli wrote:
> >>> Toolchains with older kernel headers that do not include upstream commit
> >>> c75b1d9421f80f4143e389d2d50ddfc8a28c8c35 ("fs: add fcntl() interface for
> >>> setting/getting write life time hints") will now fail to build perf due
> >>> to missing definitions for
> >>> F_GET_RW_HINT/F_SET_RW_HINT/F_GET_FILE_RW_HINT/F_SET_FILE_RW_HINT.
> >>
> >> Can you share the error messages?
>
> The compile errors look like this:
>
> trace/beauty/fcntl.c: In function 'syscall_arg__scnprintf_fcntl_arg':
> trace/beauty/fcntl.c:96:13: error: 'F_GET_RW_HINT' undeclared (first use
> in this function); did you mean 'F_GETOWN'?
> cmd == F_GET_RW_HINT || cmd == F_SET_RW_HINT ||
> ^~~~~~~~~~~~~
> F_GETOWN
> trace/beauty/fcntl.c:96:13: note: each undeclared identifier is reported
> only once for each function it appears in
> trace/beauty/fcntl.c:96:37: error: 'F_SET_RW_HINT' undeclared (first use
> in this function); did you mean 'F_SETOWN'?
> cmd == F_GET_RW_HINT || cmd == F_SET_RW_HINT ||
> ^~~~~~~~~~~~~
> F_SETOWN
> trace/beauty/fcntl.c:97:13: error: 'F_GET_FILE_RW_HINT' undeclared
> (first use in this function); did you mean 'F_GETOWNER_UIDS'?
> cmd == F_GET_FILE_RW_HINT || cmd == F_SET_FILE_RW_HINT)
> ^~~~~~~~~~~~~~~~~~
> F_GETOWNER_UIDS
> trace/beauty/fcntl.c:97:42: error: 'F_SET_FILE_RW_HINT' undeclared
> (first use in this function)
> cmd == F_GET_FILE_RW_HINT || cmd == F_SET_FILE_RW_HINT)
> ^~~~~~~~~~~~~~~~~~
>
> >>
> >> I think this code should use a copy of the header in
> >> trace/beauty/include/uapi/linux/fcntl.h which has the definitions.
> >
> > I don't think the beauty headers are in the include path.
>
> I suppose if it were however that would provide the missing definition,
> maybe that's a better path forward to front load the inclusion of
> trace/beauty/include/uapi/linux/fcntl.h?
That's a reasonable thought, in that case we should move the header to
the more regular tools/include/uapi/linux for that purpose.
I'd very much like to get rid of tools/include entirely and have its
headers provided by explicit build targets similar to how we have say
libbpf headers:
https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/Makefile.perf?h=perf-tools-next#n957
Currently our include paths are a mess and we prioritize
tools/include/linux over tools/include/uapi/linux, which seems the
opposite of the expectation in user space. If we could install
separate headers, we could be clearer about licensing.
An issue with all of this is that the tools/include headers should
really be hermetic. This isn't true today and may be an issue for
moving linux/fcntl.h. The usual failure with non-hermetic headers is
pulling in linux/types.h or similar, from the system, linux or
uapi/linux and then get some mismatch in expectations with say u64 vs
__u64. For how silly the code base is today see bitsperlong.h that has
23 header files for essentially "sizeof(long) * 8".
Anyway, Arnaldo has been moving to reduce the number of files in
tools/include to avoid touching files there that then trigger a full
kernel rebuild, which frustrates Linus.
Thanks,
Ian
> --
> Florian
>