* [PATCH v2 1/7] perf trace: Sync linux/socket.h with the kernel source
2026-05-07 7:26 [PATCH v2 0/7] perf build: Update kernel headers Namhyung Kim
@ 2026-05-07 7:26 ` Namhyung Kim
2026-05-07 7:26 ` [PATCH v2 2/7] perf trace: Sync uapi/linux/fs.h " Namhyung Kim
` (5 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Namhyung Kim @ 2026-05-07 7:26 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users, Ravi Bangoria, netdev
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.
Cc: netdev@vger.kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/trace/beauty/include/linux/socket.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/trace/beauty/include/linux/socket.h b/tools/perf/trace/beauty/include/linux/socket.h
index ec715ad4bf25f5f7..ec4a0a0257939a53 100644
--- a/tools/perf/trace/beauty/include/linux/socket.h
+++ b/tools/perf/trace/beauty/include/linux/socket.h
@@ -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);
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v2 2/7] perf trace: Sync uapi/linux/fs.h with the kernel source
2026-05-07 7:26 [PATCH v2 0/7] perf build: Update kernel headers Namhyung Kim
2026-05-07 7:26 ` [PATCH v2 1/7] perf trace: Sync linux/socket.h with the kernel source Namhyung Kim
@ 2026-05-07 7:26 ` Namhyung Kim
2026-05-07 7:26 ` [PATCH v2 3/7] perf trace: Sync uapi/linux/mount.h " Namhyung Kim
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Namhyung Kim @ 2026-05-07 7:26 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users, Ravi Bangoria, linux-fsdevel
To 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.
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/trace/beauty/include/uapi/linux/fs.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tools/perf/trace/beauty/include/uapi/linux/fs.h b/tools/perf/trace/beauty/include/uapi/linux/fs.h
index 70b2b661f42cb6e5..13f71202845e8f9e 100644
--- a/tools/perf/trace/beauty/include/uapi/linux/fs.h
+++ b/tools/perf/trace/beauty/include/uapi/linux/fs.h
@@ -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 */
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v2 3/7] perf trace: Sync uapi/linux/mount.h with the kernel source
2026-05-07 7:26 [PATCH v2 0/7] perf build: Update kernel headers Namhyung Kim
2026-05-07 7:26 ` [PATCH v2 1/7] perf trace: Sync linux/socket.h with the kernel source Namhyung Kim
2026-05-07 7:26 ` [PATCH v2 2/7] perf trace: Sync uapi/linux/fs.h " Namhyung Kim
@ 2026-05-07 7:26 ` Namhyung Kim
2026-05-07 7:26 ` [PATCH v2 4/7] perf trace: Sync uapi/linux/sched.h " Namhyung Kim
` (3 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Namhyung Kim @ 2026-05-07 7:26 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users, Ravi Bangoria, linux-fsdevel
To 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.
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/trace/beauty/include/uapi/linux/mount.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/trace/beauty/include/uapi/linux/mount.h b/tools/perf/trace/beauty/include/uapi/linux/mount.h
index d9d86598d100cb32..2204708dbf7a583a 100644
--- a/tools/perf/trace/beauty/include/uapi/linux/mount.h
+++ b/tools/perf/trace/beauty/include/uapi/linux/mount.h
@@ -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.
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v2 4/7] perf trace: Sync uapi/linux/sched.h with the kernel source
2026-05-07 7:26 [PATCH v2 0/7] perf build: Update kernel headers Namhyung Kim
` (2 preceding siblings ...)
2026-05-07 7:26 ` [PATCH v2 3/7] perf trace: Sync uapi/linux/mount.h " Namhyung Kim
@ 2026-05-07 7:26 ` Namhyung Kim
2026-05-08 12:30 ` sashiko-bot
2026-05-07 7:26 ` [PATCH v2 5/7] perf build: Add make check-headers target Namhyung Kim
` (2 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Namhyung Kim @ 2026-05-07 7:26 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users, Ravi Bangoria
To 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.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
.../trace/beauty/include/uapi/linux/sched.h | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/tools/perf/trace/beauty/include/uapi/linux/sched.h b/tools/perf/trace/beauty/include/uapi/linux/sched.h
index 359a14cc76a4038a..33a4624285cd4179 100644
--- a/tools/perf/trace/beauty/include/uapi/linux/sched.h
+++ b/tools/perf/trace/beauty/include/uapi/linux/sched.h
@@ -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 */
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v2 4/7] perf trace: Sync uapi/linux/sched.h with the kernel source
2026-05-07 7:26 ` [PATCH v2 4/7] perf trace: Sync uapi/linux/sched.h " Namhyung Kim
@ 2026-05-08 12:30 ` sashiko-bot
0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-05-08 12:30 UTC (permalink / raw)
To: Namhyung Kim; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Build Script Regex Regression
--
commit 95b9a74eb48111bfe1440ab1eb342b9d9108af43
Author: Namhyung Kim <namhyung@kernel.org>
perf trace: Sync uapi/linux/sched.h with the kernel source
Syncs the tools copy of uapi/linux/sched.h with the kernel source to pick up
changes related to clone3 and unshare flags.
> diff --git a/tools/perf/trace/beauty/include/uapi/linux/sched.h b/tools/perf/trace/beauty/include/uapi/linux/sched.h
> index 359a14cc76a40..33a4624285cd4 100644
> --- a/tools/perf/trace/beauty/include/uapi/linux/sched.h
> +++ b/tools/perf/trace/beauty/include/uapi/linux/sched.h
> @@ -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. */
Does changing these flag definitions from hexadecimal literals to bit-shifts
break the beautifier script?
Looking at tools/perf/trace/beauty/clone.sh, the script relies on matching
hexadecimal literals like (0x[[:xdigit:]]+) to extract these flags. Without
updating the regex in this patch, the script will silently fail to extract
these modified and new flags, causing them to be excluded from
clone_flags_array.c.
While a subsequent patch in the series attempts to fix this by replacing the
regex with one that exclusively matches 1ULL << X, this drops all standard
32-bit clone flags (like CLONE_VM and CLONE_FS) which remain defined as
hexadecimal literals in the header.
Could the script be updated to support both formats?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260507072632.37152-1-namhyung@kernel.org?part=4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 5/7] perf build: Add make check-headers target
2026-05-07 7:26 [PATCH v2 0/7] perf build: Update kernel headers Namhyung Kim
` (3 preceding siblings ...)
2026-05-07 7:26 ` [PATCH v2 4/7] perf trace: Sync uapi/linux/sched.h " Namhyung Kim
@ 2026-05-07 7:26 ` Namhyung Kim
2026-05-07 7:26 ` [PATCH v2 6/7] perf trace: Add beautifier script for fsmount flags Namhyung Kim
2026-05-07 7:26 ` [PATCH v2 7/7] perf trace: Update beautifier script for clone flags Namhyung Kim
6 siblings, 0 replies; 11+ messages in thread
From: Namhyung Kim @ 2026-05-07 7:26 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users, Ravi Bangoria
Don'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. Make it and build-test related targets phony.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/Makefile | 5 ++++-
tools/perf/Makefile.perf | 1 -
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 816d5d84816b3d53..5b713837eede7d52 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -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:
#
@@ -118,4 +121,4 @@ endif # MAKECMDGOALS
$(print_msg)
$(make)
-.PHONY: tags TAGS FORCE Makefile
+.PHONY: tags TAGS FORCE Makefile build-test build-test-tarball check-headers
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index cee19c923c0607d2..585637fc934fe6ec 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -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
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH v2 6/7] perf trace: Add beautifier script for fsmount flags
2026-05-07 7:26 [PATCH v2 0/7] perf build: Update kernel headers Namhyung Kim
` (4 preceding siblings ...)
2026-05-07 7:26 ` [PATCH v2 5/7] perf build: Add make check-headers target Namhyung Kim
@ 2026-05-07 7:26 ` Namhyung Kim
2026-05-08 12:30 ` sashiko-bot
2026-05-07 7:26 ` [PATCH v2 7/7] perf trace: Update beautifier script for clone flags Namhyung Kim
6 siblings, 1 reply; 11+ messages in thread
From: Namhyung Kim @ 2026-05-07 7:26 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users, Ravi Bangoria
And rename the existing one to fsmount_attr.{sh,c} to be more precise.
Now the fsmount_flags[] is generated from the mount.h like below. The
ilog2() + 1 is an existing pattern to handle bit flags.
$ cat tools/perf/trace/beauty/generated/fsmount_arrays.c
static const char *fsmount_flags[] = {
[ilog2(0x00000001) + 1] = "CLOEXEC",
[ilog2(0x00000002) + 1] = "NAMESPACE",
};
It was found by Sashiko during the review.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/Makefile.perf | 7 +++++++
tools/perf/builtin-trace.c | 7 +------
tools/perf/trace/beauty/beauty.h | 3 +++
tools/perf/trace/beauty/fsmount.c | 18 +++++++++++++++++-
tools/perf/trace/beauty/fsmount.sh | 11 +++--------
tools/perf/trace/beauty/fsmount_attr.sh | 22 ++++++++++++++++++++++
6 files changed, 53 insertions(+), 15 deletions(-)
create mode 100644 tools/perf/trace/beauty/fsmount_attr.sh
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 585637fc934fe6ec..f733103b5003bf79 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -564,6 +564,12 @@ fsmount_tbls := $(srctree)/tools/perf/trace/beauty/fsmount.sh
$(fsmount_arrays): $(beauty_uapi_linux_dir)/mount.h $(fsmount_tbls)
$(Q)$(SHELL) '$(fsmount_tbls)' $(beauty_uapi_linux_dir) > $@
+fsmount_attr_arrays := $(beauty_outdir)/fsmount_attr_arrays.c
+fsmount_attr_tbls := $(srctree)/tools/perf/trace/beauty/fsmount_attr.sh
+
+$(fsmount_attr_arrays): $(beauty_uapi_linux_dir)/mount.h $(fsmount_attr_tbls)
+ $(Q)$(SHELL) '$(fsmount_attr_tbls)' $(beauty_uapi_linux_dir) > $@
+
fspick_arrays := $(beauty_outdir)/fspick_arrays.c
fspick_tbls := $(srctree)/tools/perf/trace/beauty/fspick.sh
@@ -854,6 +860,7 @@ prepare: $(OUTPUT)PERF-VERSION-FILE archheaders \
$(fadvise_advice_array) \
$(fsconfig_arrays) \
$(fsmount_arrays) \
+ $(fsmount_attr_arrays) \
$(fspick_arrays) \
$(pkey_alloc_access_rights_array) \
$(sndrv_pcm_ioctl_array) \
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index e58c49d047a294db..4096b855e7946d96 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -771,11 +771,6 @@ static const char *bpf_cmd[] = {
};
static DEFINE_STRARRAY(bpf_cmd, "BPF_");
-static const char *fsmount_flags[] = {
- [1] = "CLOEXEC",
-};
-static DEFINE_STRARRAY(fsmount_flags, "FSMOUNT_");
-
#include "trace/beauty/generated/fsconfig_arrays.c"
static DEFINE_STRARRAY(fsconfig_cmds, "FSCONFIG_");
@@ -1202,7 +1197,7 @@ static const struct syscall_fmt syscall_fmts[] = {
{ .name = "fsconfig",
.arg = { [1] = STRARRAY(cmd, fsconfig_cmds), }, },
{ .name = "fsmount",
- .arg = { [1] = STRARRAY_FLAGS(flags, fsmount_flags),
+ .arg = { [1] = { .scnprintf = SCA_FSMOUNT_FLAGS, /* fsmount_flags */ },
[2] = { .scnprintf = SCA_FSMOUNT_ATTR_FLAGS, /* attr_flags */ }, }, },
{ .name = "fspick",
.arg = { [0] = { .scnprintf = SCA_FDAT, /* dfd */ },
diff --git a/tools/perf/trace/beauty/beauty.h b/tools/perf/trace/beauty/beauty.h
index 0a07ad158f87c73c..a90c35fa5c123f2b 100644
--- a/tools/perf/trace/beauty/beauty.h
+++ b/tools/perf/trace/beauty/beauty.h
@@ -179,6 +179,9 @@ size_t syscall_arg__scnprintf_fcntl_arg(char *bf, size_t size, struct syscall_ar
size_t syscall_arg__scnprintf_flock(char *bf, size_t size, struct syscall_arg *arg);
#define SCA_FLOCK syscall_arg__scnprintf_flock
+size_t syscall_arg__scnprintf_fsmount_flags(char *bf, size_t size, struct syscall_arg *arg);
+#define SCA_FSMOUNT_FLAGS syscall_arg__scnprintf_fsmount_flags
+
size_t syscall_arg__scnprintf_fsmount_attr_flags(char *bf, size_t size, struct syscall_arg *arg);
#define SCA_FSMOUNT_ATTR_FLAGS syscall_arg__scnprintf_fsmount_attr_flags
diff --git a/tools/perf/trace/beauty/fsmount.c b/tools/perf/trace/beauty/fsmount.c
index 28c2c16fc1a80dfd..0f13ef6599b9d0ee 100644
--- a/tools/perf/trace/beauty/fsmount.c
+++ b/tools/perf/trace/beauty/fsmount.c
@@ -18,7 +18,7 @@
static size_t fsmount__scnprintf_attr_flags(unsigned long flags, char *bf, size_t size, bool show_prefix)
{
-#include "trace/beauty/generated/fsmount_arrays.c"
+#include "trace/beauty/generated/fsmount_attr_arrays.c"
static DEFINE_STRARRAY(fsmount_attr_flags, "MOUNT_ATTR_");
size_t printed = 0;
@@ -39,3 +39,19 @@ size_t syscall_arg__scnprintf_fsmount_attr_flags(char *bf, size_t size, struct s
return fsmount__scnprintf_attr_flags(flags, bf, size, arg->show_string_prefix);
}
+
+
+static size_t fsmount__scnprintf_flags(unsigned long flags, char *bf, size_t size, bool show_prefix)
+{
+#include "trace/beauty/generated/fsmount_arrays.c"
+ static DEFINE_STRARRAY(fsmount_flags, "FSMOUNT_");
+
+ return strarray__scnprintf_flags(&strarray__fsmount_flags, bf, size, show_prefix, flags);
+}
+
+size_t syscall_arg__scnprintf_fsmount_flags(char *bf, size_t size, struct syscall_arg *arg)
+{
+ unsigned long flags = arg->val;
+
+ return fsmount__scnprintf_flags(flags, bf, size, arg->show_string_prefix);
+}
diff --git a/tools/perf/trace/beauty/fsmount.sh b/tools/perf/trace/beauty/fsmount.sh
index 6b67a54cdeee64b3..6d1e80bc15e4416b 100755
--- a/tools/perf/trace/beauty/fsmount.sh
+++ b/tools/perf/trace/beauty/fsmount.sh
@@ -9,14 +9,9 @@ fi
linux_mount=${beauty_uapi_linux_dir}/mount.h
-# Remove MOUNT_ATTR_RELATIME as it is zeros, handle it a special way in the beautifier
-# Only handle MOUNT_ATTR_ followed by a capital letter/num as __ is special case
-# for things like MOUNT_ATTR__ATIME that is a mask for the possible ATIME handling
-# bits. Special case it as well in the beautifier
-
-printf "static const char *fsmount_attr_flags[] = {\n"
-regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MOUNT_ATTR_([[:alnum:]][[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
-grep -E $regex ${linux_mount} | grep -v MOUNT_ATTR_RELATIME | \
+printf "static const char *fsmount_flags[] = {\n"
+regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+FSMOUNT_([[:alnum:]][[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
+grep -E $regex ${linux_mount} | \
sed -r "s/$regex/\2 \1/g" | \
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"
printf "};\n"
diff --git a/tools/perf/trace/beauty/fsmount_attr.sh b/tools/perf/trace/beauty/fsmount_attr.sh
new file mode 100644
index 0000000000000000..6b67a54cdeee64b3
--- /dev/null
+++ b/tools/perf/trace/beauty/fsmount_attr.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# SPDX-License-Identifier: LGPL-2.1
+
+if [ $# -ne 1 ] ; then
+ beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
+else
+ beauty_uapi_linux_dir=$1
+fi
+
+linux_mount=${beauty_uapi_linux_dir}/mount.h
+
+# Remove MOUNT_ATTR_RELATIME as it is zeros, handle it a special way in the beautifier
+# Only handle MOUNT_ATTR_ followed by a capital letter/num as __ is special case
+# for things like MOUNT_ATTR__ATIME that is a mask for the possible ATIME handling
+# bits. Special case it as well in the beautifier
+
+printf "static const char *fsmount_attr_flags[] = {\n"
+regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MOUNT_ATTR_([[:alnum:]][[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
+grep -E $regex ${linux_mount} | grep -v MOUNT_ATTR_RELATIME | \
+ sed -r "s/$regex/\2 \1/g" | \
+ xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"
+printf "};\n"
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v2 6/7] perf trace: Add beautifier script for fsmount flags
2026-05-07 7:26 ` [PATCH v2 6/7] perf trace: Add beautifier script for fsmount flags Namhyung Kim
@ 2026-05-08 12:30 ` sashiko-bot
0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-05-08 12:30 UTC (permalink / raw)
To: Namhyung Kim; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] The replacement of STRARRAY_FLAGS with a custom formatter initialization silently drops the `.strtoul` handler and `.show_zero` property for the `fsmount` flags argument.
- [Low] The newly generated `fsmount_attr_arrays.c` file is not removed during `make clean`.
- [Low] The commit message falsely claims that the source file `fsmount.c` was renamed.
--
commit 3df6eed17e58d1e1ddb3e75a7cd7fc70c8f3735f
Author: Namhyung Kim <namhyung@kernel.org>
perf trace: Add beautifier script for fsmount flags
This commit updates the fsmount beautifier to generate fsmount_flags[]
directly from mount.h. It also splits out the attribute flags generation into
a separate fsmount_attr.sh script.
> And rename the existing one to fsmount_attr.{sh,c} to be more precise.
This isn't a bug, but the commit message says fsmount.c was renamed to
fsmount_attr.c, while the patch only modifies fsmount.c without renaming it.
Should the commit message be updated to reflect this?
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -564,6 +564,12 @@ fsmount_tbls := $(srctree)/tools/perf/trace/beauty/fsmount.sh
> $(fsmount_arrays): $(beauty_uapi_linux_dir)/mount.h $(fsmount_tbls)
> $(Q)$(SHELL) '$(fsmount_tbls)' $(beauty_uapi_linux_dir) > $@
>
> +fsmount_attr_arrays := $(beauty_outdir)/fsmount_attr_arrays.c
> +fsmount_attr_tbls := $(srctree)/tools/perf/trace/beauty/fsmount_attr.sh
> +
> +$(fsmount_attr_arrays): $(beauty_uapi_linux_dir)/mount.h $(fsmount_attr_tbls)
> + $(Q)$(SHELL) '$(fsmount_attr_tbls)' $(beauty_uapi_linux_dir) > $@
Does the clean target in Makefile.perf need to be updated to remove the new
fsmount_attr_arrays.c file? Without it, the generated file might be left
behind during a make clean operation.
> diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
> --- a/tools/perf/builtin-trace.c
> +++ b/tools/perf/builtin-trace.c
[ ... ]
> @@ -1202,7 +1197,7 @@ static const struct syscall_fmt syscall_fmts[] = {
> { .name = "fsconfig",
> .arg = { [1] = STRARRAY(cmd, fsconfig_cmds), }, },
> { .name = "fsmount",
> - .arg = { [1] = STRARRAY_FLAGS(flags, fsmount_flags),
> + .arg = { [1] = { .scnprintf = SCA_FSMOUNT_FLAGS, /* fsmount_flags */ },
> [2] = { .scnprintf = SCA_FSMOUNT_ATTR_FLAGS, /* attr_flags */ }, }, },
Does replacing STRARRAY_FLAGS drop the .strtoul parser and .show_zero
properties?
The original STRARRAY_FLAGS macro assigned .strtoul = STUL_STRARRAY_FLAGS and
.show_zero = true. By dropping these, does perf trace lose the ability to
parse symbolic names for the fsmount flags argument, such as during filter
expressions like -e 'fsmount(flags==CLOEXEC)'?
Additionally, without .show_zero = true, will a flags value of 0 be skipped in
the output, causing positional ambiguity with the remaining trailing
arguments?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260507072632.37152-1-namhyung@kernel.org?part=6
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 7/7] perf trace: Update beautifier script for clone flags
2026-05-07 7:26 [PATCH v2 0/7] perf build: Update kernel headers Namhyung Kim
` (5 preceding siblings ...)
2026-05-07 7:26 ` [PATCH v2 6/7] perf trace: Add beautifier script for fsmount flags Namhyung Kim
@ 2026-05-07 7:26 ` Namhyung Kim
2026-05-08 12:30 ` sashiko-bot
6 siblings, 1 reply; 11+ messages in thread
From: Namhyung Kim @ 2026-05-07 7:26 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark
Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
linux-perf-users, Ravi Bangoria
According to the change in the sched.h, update the script to generate
the flags array like below. Note that '+1' is needed to detect bitmask
pattern at index 0.
$ cat tools/perf/trace/beauty/generated/clone_flags_array.c
static const char *clone_flags[] = {
[32 + 1] = "CLEAR_SIGHAND",
[33 + 1] = "INTO_CGROUP",
[34 + 1] = "AUTOREAP",
[35 + 1] = "NNP",
[36 + 1] = "PIDFD_AUTOKILL",
[37 + 1] = "EMPTY_MNTNS",
};
This was found by Sashiko during review.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/trace/beauty/clone.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/trace/beauty/clone.sh b/tools/perf/trace/beauty/clone.sh
index 18b6c0d75693721d..f807372519fe2c88 100755
--- a/tools/perf/trace/beauty/clone.sh
+++ b/tools/perf/trace/beauty/clone.sh
@@ -10,8 +10,8 @@ fi
linux_sched=${beauty_uapi_linux_dir}/sched.h
printf "static const char *clone_flags[] = {\n"
-regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+CLONE_([^_]+[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
+regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+CLONE_([^_]+[[:alnum:]_]+)[[:space:]]+\(1ULL[[:space:]]*<<[[:space:]]*([[:digit:]]+)\)[[:space:]]*.*'
grep -E $regex ${linux_sched} | \
sed -r "s/$regex/\2 \1/g" | \
- xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"
+ xargs printf "\t[%s + 1] = \"%s\",\n"
printf "};\n"
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v2 7/7] perf trace: Update beautifier script for clone flags
2026-05-07 7:26 ` [PATCH v2 7/7] perf trace: Update beautifier script for clone flags Namhyung Kim
@ 2026-05-08 12:30 ` sashiko-bot
0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-05-08 12:30 UTC (permalink / raw)
To: Namhyung Kim; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The beautifier script regex update drops all legacy clone flags (0-31), breaking flag decoding for standard `clone()` syscalls.
- [High] Processing clone flags with indices >= 32 in `strarray__scnprintf_flags()` causes Undefined Behavior on 32-bit platforms, leading to incorrect flag decoding.
--
commit 47293f130dab2e91781452bd39a472811835f8a9
Author: Namhyung Kim <namhyung@kernel.org>
perf trace: Update beautifier script for clone flags
This commit updates the clone_flags beautifier script to parse the new bit
shift definitions in sched.h. It changes the regex to match the 1ULL bit
shift pattern instead of the previous hexadecimal values.
> $ cat tools/perf/trace/beauty/generated/clone_flags_array.c
> static const char *clone_flags[] = {
> [32 + 1] = "CLEAR_SIGHAND",
> [33 + 1] = "INTO_CGROUP",
> [34 + 1] = "AUTOREAP",
> [35 + 1] = "NNP",
> [36 + 1] = "PIDFD_AUTOKILL",
> [37 + 1] = "EMPTY_MNTNS",
> };
When the array has entries up to index 38, does this cause an issue on 32-bit
builds of perf?
Looking at strarray__scnprintf_flags(), it computes the flag bit using:
unsigned long bit = 1UL << (i - 1);
On 32-bit platforms, unsigned long is 32 bits. Shifting by 32 or more invokes
undefined behavior. On architectures like x86, the shift amount is masked
(e.g., modulo 32), so 1UL << 32 evaluates as 1UL << 0.
Could this cause perf trace to erroneously report clone3 flags like
CLEAR_SIGHAND whenever unrelated lower bits are set?
> diff --git a/tools/perf/trace/beauty/clone.sh b/tools/perf/trace/beauty/clone.sh
> index 18b6c0d756937..f807372519fe2 100755
> --- a/tools/perf/trace/beauty/clone.sh
> +++ b/tools/perf/trace/beauty/clone.sh
[ ... ]
> printf "static const char *clone_flags[] = {\n"
> -regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+CLONE_([^_]+[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
> +regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+CLONE_([^_]+[[:alnum:]_]+)[[:space:]]+\(1ULL[[:space:]]*<<[[:space:]]*([[:digit:]]+)\)[[:space:]]*.*'
Does this new regex miss the legacy clone flags?
In include/uapi/linux/sched.h, legacy flags like CLONE_VM, CLONE_FS, and
CLONE_THREAD are still defined using hexadecimal notation.
Since the updated regex strictly requires the (1ULL << digit) format,
it appears all lower 32 flags are excluded from the generated
clone_flags_array.c.
Could this prevent perf trace from translating standard clone flags into
human-readable strings?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260507072632.37152-1-namhyung@kernel.org?part=7
^ permalink raw reply [flat|nested] 11+ messages in thread