perf build: Update kernel headers
Subsystems (4)
Namhyung Kim
maintainercover perf build: Update kernel headers
Hello,
This is to update copy of kernel headers for v7.1. I've updated ones in the tools/perf/trace/beauty/ and left others which seem not to affect perf syscall beautifiers. This is suggested by Linus to avoid unnecessary builds of objtool and the kernel.
There are AMD IBS changes that are directly related to perf, but I think Ravi is working on it with other Zen6 changes. So I didn't include it here.
Also I removed the header difference output in the default perf build and added a new make target to check it explicitly.
Thanks,
Namhyung
Namhyung Kim (5):
perf trace: Sync linux/socket.h with the kernel source perf trace: Sync uapi/linux/fs.h with the kernel source perf trace: Sync uapi/linux/mount.h with the kernel source perf trace: Sync uapi/linux/sched.h with the kernel source perf build: Add make check-headers target
tools/perf/Makefile | 3 +++ tools/perf/Makefile.perf | 1 - tools/perf/trace/beauty/include/linux/socket.h | 2 +- tools/perf/trace/beauty/include/uapi/linux/fs.h | 12 ++++++++++++ .../trace/beauty/include/uapi/linux/mount.h | 1 + .../trace/beauty/include/uapi/linux/sched.h | 17 +++++++++++++++-- 6 files changed, 32 insertions(+), 4 deletions(-)
Signature · 1 line
2.53.0
Namhyung Kim
maintainerPATCH 1/5 perf trace: Sync linux/socket.h with the kernel source
To pick up changes from:
c66e0f453d1afa82 ("net: use ktime_t in struct scm_timestamping_internal")
This would be used to beautify networking syscall arguments and not to affect builds of other tools (e.g. objtool).
Please see tools/include/uapi/README.
--- tools/perf/trace/beauty/include/linux/socket.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/trace/beauty/include/linux/socket.h +1 -1
@@ -415,7 +415,7 @@ struct __kernel_timespec;struct old_timespec32 ;struct scm_timestamping_internal { -struct timespec64 ts[3 ]; +ktime_t ts[3 ]; };extern void put_cmsg_scm_timestamping64 (struct msghdr *msg,struct scm_timestamping_internal *tss);
Signature · 1 line
2.53.0
Namhyung Kim
maintainerPATCH 2/5 perf trace: Sync uapi/linux/fs.h with the kernel source
In reply to Namhyung KimTo pick up changes from:
1f662195dbc07a66 ("fs: add generic FS_IOC_SHUTDOWN definitions")
This would be used to beautify filesystem syscall arguments and not to affect builds of other tools (e.g. objtool).
Please see tools/include/uapi/README.
--- tools/perf/trace/beauty/include/uapi/linux/fs.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tools/perf/trace/beauty/include/uapi/linux/fs.h +12 -0
@@ -657,4 +657,16 @@ struct procmap_query { __u64 build_id_addr; /* in */ }; +/* +* Shutdown the filesystem. +*/ +#define FS_IOC_SHUTDOWN _IOR('X', 125, __u32) + +/* +* Flags for FS_IOC_SHUTDOWN +*/ +#define FS_SHUTDOWN_FLAGS_DEFAULT 0x0 +#define FS_SHUTDOWN_FLAGS_LOGFLUSH 0x1/* flush log but not data*/ +#define FS_SHUTDOWN_FLAGS_NOLOGFLUSH 0x2/* don't flush log nor data */ +#endif /* _UAPI_LINUX_FS_H */
Signature · 1 line
2.53.0
Namhyung Kim
maintainerPATCH 3/5 perf trace: Sync uapi/linux/mount.h with the kernel source
In reply to Namhyung KimTo pick up changes from:
5e8969bd19271241 ("mount: add FSMOUNT_NAMESPACE")
This would be used to beautify mount syscall arguments and not to affect builds of other tools (e.g. objtool).
Please see tools/include/uapi/README.
--- tools/perf/trace/beauty/include/uapi/linux/mount.h | 1 + 1 file changed, 1 insertion(+)
tools/perf/trace/beauty/include/uapi/linux/mount.h +1 -0
@@ -110,6 +110,7 @@ enum fsconfig_command {* fsmount() flags. */ #define FSMOUNT_CLOEXEC 0x00000001 +#define FSMOUNT_NAMESPACE 0x00000002/* Create the mount in a new mount namespace */ /* * Mount attributes.
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 3/5] perf trace: Sync uapi/linux/mount.h with the kernel source
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The commit syncs `uapi/linux/mount.h` to pick up the `FSMOUNT_NAMESPACE` flag, with the commit…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The commit syncs uapi/linux/mount.h to pick up the FSMOUNT_NAMESPACE flag, with the commit message explicitly claiming "This would be used to beautify mount syscall arguments". However, unlike MOUNT_ATTR_* flags which are automatically parsed by tools/perf/trace/beauty/fsmount.sh, the FSMOUNT_* flags are strictly hardcoded in tools/perf/builtin-trace.c (static const char *fsmount_flags[] = { [1] = "CLOEXEC", };). Because [2] = "NAMESPACE" was not manually added to this array, the new flag will not be beautified. --
commit 41bba49a1df4092fb9de0814ee5b9c785fd42578
Author: Namhyung Kim <[email protected]>
perf trace: Sync uapi/linux/mount.h with the kernel source
This commit syncs the uapi/linux/mount.h header to pick up the new FSMOUNT_NAMESPACE flag.
tools/perf/trace/beauty/include/uapi/linux/mount.h enum fsconfig_command { · line 113
Quoted 9 lines
tools/perf/trace/beauty/include/uapi/linux/mount.h +1
-0@@ -110,6 +110,7 @@ enum fsconfig_command {* fsmount() flags. */ #define FSMOUNT_CLOEXEC 0x00000001 +#define FSMOUNT_NAMESPACE 0x00000002/* Create the mount in a new mount namespace */
The commit message states: "This would be used to beautify mount syscall arguments". Will this header sync be enough to beautify the new flag?
Looking at tools/perf/builtin-trace.c, the fsmount_flags array is manually hardcoded:
static const char *fsmount_flags[] = {
[1] = "CLOEXEC",
};Since [2] = "NAMESPACE" is not present in this array, ARRAY_SIZE(fsmount_flags) remains 2. The loop in strarray__scnprintf_flags() checks up to index 1.
Does the FSMOUNT_NAMESPACE flag also need to be manually added to the fsmount_flags array in builtin-trace.c for the beautification to work?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Namhyung Kim
maintainerPATCH 4/5 perf trace: Sync uapi/linux/sched.h with the kernel source
In reply to Namhyung KimTo pick up changes from:
9d4e752a24f740b3 ("namespace: allow creating empty mount namespaces") c8134b5f13ae959d ("pidfd: add CLONE_PIDFD_AUTOKILL") 24baca56fafc33d4 ("clone: add CLONE_NNP")
12ae2c81b21cfaa1 ("clone: add CLONE_AUTOREAP") 2e7af192697ef2a7 ("sched/deadline: Add reporting of runtime left & ...")
This would be used to beautify scheduler syscall arguments and not to affect builds of other tools (e.g. objtool).
Please see tools/include/uapi/README.
--- .../trace/beauty/include/uapi/linux/sched.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
tools/perf/trace/beauty/include/uapi/linux/sched.h +15 -2
@@ -34,8 +34,12 @@#define CLONE_IO 0x80000000/* Clone io context */ /* Flags for the clone3() syscall. */ -#define CLONE_CLEAR_SIGHAND 0x100000000ULL/* Clear any signal handler and reset to SIG_DFL. */ -#define CLONE_INTO_CGROUP 0x200000000ULL/* Clone into a specific cgroup given the right permissions. */ +#define CLONE_CLEAR_SIGHAND (1ULL << 32)/* Clear any signal handler and reset to SIG_DFL. */ +#define CLONE_INTO_CGROUP (1ULL << 33)/* Clone into a specific cgroup given the right permissions. */ +#define CLONE_AUTOREAP (1ULL << 34)/* Auto-reap child on exit. */ +#define CLONE_NNP (1ULL << 35)/* Set no_new_privs on child. */ +#define CLONE_PIDFD_AUTOKILL (1ULL << 36)/* Kill child when clone pidfd closes. */ +#define CLONE_EMPTY_MNTNS (1ULL << 37)/* Create an empty mount namespace. */ /* * cloning flags intersect with CSIGNAL so can be used with unshare and clone3
@@ -43,6 +47,12 @@*/ #define CLONE_NEWTIME 0x00000080/* New time namespace */ +/* +* unshare flags share the bit space with clone flags but only apply to the +* unshare syscall: +*/ +#define UNSHARE_EMPTY_MNTNS 0x00100000/* Unshare an empty mount namespace. */ +#ifndef __ASSEMBLY__/** * struct clone_args - arguments for the clone3 syscall
@@ -146,4 +156,7 @@ struct clone_args { SCHED_FLAG_KEEP_ALL | \ SCHED_FLAG_UTIL_CLAMP) +/* Only for sched_getattr() own flag param, if task is SCHED_DEADLINE */ +#define SCHED_GETATTR_FLAG_DL_DYNAMIC 0x01 +#endif /* _UAPI_LINUX_SCHED_H */
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 4/5] perf trace: Sync uapi/linux/sched.h with the kernel source
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `clone.sh` beautification script fails to parse the new `(1ULL << X)` format for `CLONE_`…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The clone.sh beautification script fails to parse the new (1ULL << X) format for CLONE_ macros, resulting in missing syscall argument translations in perf trace. --
commit 21b4f549d315112f3b383339c5af0152f585767e
Author: Namhyung Kim <[email protected]>
perf trace: Sync uapi/linux/sched.h with the kernel source
This commit synchronizes the tools/perf uapi sched.h with the kernel source to pick up new clone flags for beautifying scheduler syscall arguments.
Quoted 6 lines
tools/perf/trace/beauty/include/uapi/linux/sched.h +0
-0@@ -34,8 +34,12 @@#define CLONE_IO 0x80000000/* Clone io context */
tools/perf/trace/beauty/include/uapi/linux/sched.h line 42
Quoted 10 lines
tools/perf/trace/beauty/include/uapi/linux/sched.h +6
-2/* Flags for the clone3() syscall. */ -#define CLONE_CLEAR_SIGHAND 0x100000000ULL/* Clear any signal handler and reset to SIG_DFL. */ -#define CLONE_INTO_CGROUP 0x200000000ULL/* Clone into a specific cgroup given the right permissions. */ +#define CLONE_CLEAR_SIGHAND (1ULL << 32)/* Clear any signal handler and reset to SIG_DFL. */ +#define CLONE_INTO_CGROUP (1ULL << 33)/* Clone into a specific cgroup given the right permissions. */ +#define CLONE_AUTOREAP (1ULL << 34)/* Auto-reap child on exit. */ +#define CLONE_NNP (1ULL << 35)/* Set no_new_privs on child. */ +#define CLONE_PIDFD_AUTOKILL (1ULL << 36)/* Kill child when clone pidfd closes. */ +#define CLONE_EMPTY_MNTNS (1ULL << 37)/* Create an empty mount namespace. */
Will this format change cause a regression in the clone flags beautifier?
Looking at tools/perf/trace/beauty/clone.sh, it uses a regular expression expecting hexadecimal values to extract the flags: (0x[[:xdigit:]]+).
Because these updated macros now use a bitwise shift format instead of hex values, they might be silently ignored by the script during parsing. This would result in perf trace failing to translate these flags, printing raw numeric values instead.
Does the regex in clone.sh also need to be updated to handle the new format?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Namhyung Kim
maintainerPATCH 5/5 perf build: Add make check-headers target
In reply to Namhyung KimDon't print header differences during the perf build as it's noisy. Mostly people won't care and find it annoying.
As it's to improve perf trace beautifier to catch up new changes mostly in UAPIs, we can make it a separate build target and call it occasionally.
--- tools/perf/Makefile | 3 +++ tools/perf/Makefile.perf | 1 - 2 files changed, 3 insertions(+), 1 deletion(-)
tools/perf/Makefile +3 -0
@@ -111,6 +111,9 @@ endif # MAKECMDGOALS build-test-tarball: @$(MAKE) -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory out +check-headers: + @./check-headers.sh + # # All other targets get passed through: #
tools/perf/Makefile.perf +0 -1
@@ -285,7 +285,6 @@ goals := $(filter-out all sub-make, $(MAKECMDGOALS)) $(goals) all: sub-make sub-make: fixdep - @./check-headers.sh $(Q)$(MAKE) FIXDEP_BUILT=1 -f Makefile.perf $(goals) else # force_fixdep
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 5/5] perf build: Add make check-headers target
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The `tools/include/uapi/README` documentation was not updated to reflect the removal of the…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The tools/include/uapi/README documentation was not updated to reflect the removal of the automated header synchronization check.
- [Low] The new check-headers target in tools/perf/Makefile is missing a .PHONY declaration.
--
commit dd1cd2c298920f9790f61d618060d62047bed876
Author: Namhyung Kim <[email protected]>
perf build: Add make check-headers target
This commit removes the automated check-headers.sh script execution from the default perf build and adds a dedicated check-headers Make target to be called manually instead.
Quoted 3 lines
As it's to improve perf trace beautifier to catch up new changes mostly in UAPIs, we can make it a separate build target and call it occasionally.
Does this change require an update to tools/include/uapi/README?
The README currently documents a "software-enforced copy-on-write mechanism" that is "driven by non-fatal warnings on the tooling side build."
Since this is no longer automated during routine builds, developers might miss UAPI changes if they rely on the currently documented behavior.
Quoted 3 lines
tools/perf/Makefile +0
-0
[ ... ]
tools/perf/Makefile build-test: · line 116
Quoted 7 lines
tools/perf/Makefile +3
-0@@ -111,6 +111,9 @@ build-test: build-test-tarball: @$(MAKE) -f tests/make REUSE_FEATURES_DUMP=1 MK=Makefile SET_PARALLEL=1 --no-print-directory out +check-headers: + @./check-headers.sh +
Should check-headers be added to the .PHONY declarations?
Since check-headers is a command target and does not produce an artifact by that name, if a file or directory named check-headers is ever created in tools/perf/, Make will consider the target up to date and silently skip executing the script.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5