perf trace beauty fcntl: Fix build with older kernel headers
PATCH 1/1 perf trace beauty fcntl: Fix build with older kernel headers
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.
Provide a fallback definition for these when they are not already defined.
--- tools/perf/trace/beauty/fcntl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
tools/perf/trace/beauty/fcntl.c +16 -0
@@ -9,6 +9,22 @@#include <linux/kernel.h> #include <linux/fcntl.h> +#ifndef F_GET_RW_HINT +#define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11) +#endif + +#ifndef F_SET_RW_HINT +#define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12) +#endif + +#ifndef F_GET_FILE_RW_HINT +#define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13) +#endif + +#ifndef F_SET_FILE_RW_HINT +#define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14) +#endif +static size_t fcntl__scnprintf_getfd (unsigned long val,char *bf,size_t size,bool show_prefix) { return val ? scnprintf(bf, size, "%s", "0") :
Signature · 1 line
2.34.1
Ian Rogers
reviewerQuoted 9 lines · Florian Fainelli
Toolchains with older kernel headers that do not include upstream commit
c75b1d9421f80f4143e389d2d50ddfc8a28c8c35("fs: addfcntl()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.Provide a fallback definition for these when they are not already defined.
This seems fine but the commit you mention was added to Linux 4.13. Is there a reason you've run into this problem? The oldest active LTS kernel is 4.19.
Thanks,
Ian
Quoted 36 lines
Fixes 9c47f6674838 ("perf trace beauty fcntl: Basic 'arg' beautifier")Signed-off-by Florian Fainelli <[email protected]>--- tools/perf/trace/beauty/fcntl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)tools/perf/trace/beauty/fcntl.c +16
-1@@ -9,6 +9,22 @@#include <linux/kernel.h> #include <linux/fcntl.h> +#ifndef F_GET_RW_HINT +#define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11) +#endif + +#ifndef F_SET_RW_HINT +#define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12) +#endif + +#ifndef F_GET_FILE_RW_HINT +#define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13) +#endif + +#ifndef F_SET_FILE_RW_HINT +#define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14) +#endif +static size_t fcntl__scnprintf_getfd (unsigned long val,char *bf,size_t size,bool show_prefix) { return val ? scnprintf(bf, size, "%s", "0") : --2.34.1
Quoted 9 lines · Ian Rogers
Quoted 7 lines · Florian Fainelli
Toolchains with older kernel headers that do not include upstream commit
c75b1d9421f80f4143e389d2d50ddfc8a28c8c35("fs: addfcntl()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.
Quoted 6 lines
Quoted 2 lines
Provide a fallback definition for these when they are not already defined.
This seems fine but the commit you mention was added to Linux 4.13. Is there a reason you've run into this problem? The oldest active LTS kernel is 4.19.
The toolchain I am using is still on kernel headers 4.9.x, I am cognizant this is a very old set of kernel headers, this is specific and unique to building for MIPS, our ARM/ARM64 targets are using more modern components.
Signature · 1 line
Florian
Quoted 14 lines · Florian Fainelli
Quoted 12 lines · Ian Rogers
Quoted 9 lines · Florian Fainelli
Toolchains with older kernel headers that do not include upstream commit
c75b1d9421f80f4143e389d2d50ddfc8a28c8c35("fs: addfcntl()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.Provide a fallback definition for these when they are not already defined.
Quoted 8 lines
Quoted 3 lines
This seems fine but the commit you mention was added to Linux 4.13. Is there a reason you've run into this problem? The oldest active LTS kernel is 4.19.
The toolchain I am using is still on kernel headers 4.9.x, I am cognizant this is a very old set of kernel headers, this is specific and unique to building for MIPS, our ARM/ARM64 targets are using more modern components.
Sgtm. I have some libunwind clean up for MIPS that I'll add you to, in case it is of interest since I can't test it myself :-)
For this patch:
Thanks,
Ian
Quoted 2 lines
--
Florian
Quoted 22 lines · Ian Rogers
Quoted 11 lines · Florian Fainelli
Quoted 9 lines · Ian Rogers
Quoted 8 lines · Florian Fainelli
Toolchains with older kernel headers that do not include upstream commit
c75b1d9421f80f4143e389d2d50ddfc8a28c8c35("fs: addfcntl()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.Provide a fallback definition for these when they are not already defined.
Quoted 8 lines
Quoted 3 lines
This seems fine but the commit you mention was added to Linux 4.13. Is there a reason you've run into this problem? The oldest active LTS kernel is 4.19.
The toolchain I am using is still on kernel headers 4.9.x, I am cognizant this is a very old set of kernel headers, this is specific and unique to building for MIPS, our ARM/ARM64 targets are using more modern components.
Quoted 5 lines
Sgtm. I have some libunwind clean up for MIPS that I'll add you to, in case it is of interest since I can't test it myself :-)
For this patch:
Reviewed-by Ian Rogers <[email protected]>
Thanks, applied to perf-tools-next, for v7.2.
- ARnaldo
Namhyung Kim
maintainerHello,
Quoted 5 lines · Florian Fainelli
Toolchains with older kernel headers that do not include upstream commit
c75b1d9421f80f4143e389d2d50ddfc8a28c8c35("fs: addfcntl()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?
I think this code should use a copy of the header in trace/beauty/include/uapi/linux/fcntl.h which has the definitions.
Thanks,
Namhyung
Quoted 40 lines
Provide a fallback definition for these when they are not already defined.
Fixes 9c47f6674838 ("perf trace beauty fcntl: Basic 'arg' beautifier")Signed-off-by Florian Fainelli <[email protected]>--- tools/perf/trace/beauty/fcntl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)tools/perf/trace/beauty/fcntl.c +16
-0@@ -9,6 +9,22 @@#include <linux/kernel.h> #include <linux/fcntl.h> +#ifndef F_GET_RW_HINT +#define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11) +#endif + +#ifndef F_SET_RW_HINT +#define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12) +#endif + +#ifndef F_GET_FILE_RW_HINT +#define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13) +#endif + +#ifndef F_SET_FILE_RW_HINT +#define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14) +#endif +static size_t fcntl__scnprintf_getfd (unsigned long val,char *bf,size_t size,bool show_prefix) { return val ? scnprintf(bf, size, "%s", "0") :Signature · 1 line
2.34.1
Ian Rogers
reviewerQuoted 10 lines · Namhyung Kim
Hello,
Quoted 5 lines · Florian Fainelli
Toolchains with older kernel headers that do not include upstream commit
c75b1d9421f80f4143e389d2d50ddfc8a28c8c35("fs: addfcntl()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.
Quoted 4 lines
Can you share the error messages?
I think this code should use a copy of the header in
trace/beauty/include/uapi/linux/fcntl.hwhich has the definitions.
I don't think the beauty headers are in the include path.
Thanks,
Ian
Quoted 43 lines
Thanks,
NamhyungQuoted 40 lines
Provide a fallback definition for these when they are not already defined.
Fixes 9c47f6674838 ("perf trace beauty fcntl: Basic 'arg' beautifier")Signed-off-by Florian Fainelli <[email protected]>--- tools/perf/trace/beauty/fcntl.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)tools/perf/trace/beauty/fcntl.c +16
-1@@ -9,6 +9,22 @@#include <linux/kernel.h> #include <linux/fcntl.h> +#ifndef F_GET_RW_HINT +#define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11) +#endif + +#ifndef F_SET_RW_HINT +#define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12) +#endif + +#ifndef F_GET_FILE_RW_HINT +#define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13) +#endif + +#ifndef F_SET_FILE_RW_HINT +#define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14) +#endif +static size_t fcntl__scnprintf_getfd (unsigned long val,char *bf,size_t size,bool show_prefix) { return val ? scnprintf(bf, size, "%s", "0") : --2.34.1
Quoted 4 lines · Ian Rogers
Quoted 3 lines · Namhyung Kim
Hello,
Quoted 8 lines
Quoted 8 lines · Florian Fainelli
Quoted 5 lines
Toolchains with older kernel headers that do not include upstream commit
c75b1d9421f80f4143e389d2d50ddfc8a28c8c35("fs: addfcntl()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)
^~~~~~~~~~~~~~~~~~Quoted 5 lines
Quoted 3 lines
I think this code should use a copy of the header in
trace/beauty/include/uapi/linux/fcntl.hwhich 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?
Signature · 1 line
Florian
Ian Rogers
reviewerQuoted 41 lines · Florian Fainelli
Quoted 4 lines · Ian Rogers
Quoted 3 lines · Namhyung Kim
Hello,
Quoted 8 lines
Quoted 8 lines · Florian Fainelli
Quoted 5 lines
Toolchains with older kernel headers that do not include upstream commit
c75b1d9421f80f4143e389d2d50ddfc8a28c8c35("fs: addfcntl()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 intrace/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) ^~~~~~~~~~~~~~~~~~Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I think this code should use a copy of the header in
trace/beauty/include/uapi/linux/fcntl.hwhich 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
Quoted 3 lines
--
Florian