Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools headers UAPI: Sync linux/prctl.h with the kernel sources

To pick the changes in:

1fd96a3e9d5d4feb ("riscv: Add prctl controls for userspace vector management")

That adds some RISC-V specific prctl options:

$ tools/perf/trace/beauty/prctl_option.sh > before
$ cp include/uapi/linux/prctl.h tools/include/uapi/linux/prctl.h
$ tools/perf/trace/beauty/prctl_option.sh > after
$ diff -u before after
--- before 2023-07-11 13:22:01.928705942 -0300
+++ after 2023-07-11 13:22:36.342645970 -0300
@@ -63,6 +63,8 @@
[66] = "GET_MDWE",
[67] = "SET_MEMORY_MERGE",
[68] = "GET_MEMORY_MERGE",
+ [69] = "RISCV_V_SET_CONTROL",
+ [70] = "RISCV_V_GET_CONTROL",
};
static const char *prctl_set_mm_options[] = {
[1] = "START_CODE",
$

That now will be used to decode the syscall option and also to compose
filters, for instance:

[root@five ~]# perf trace -e syscalls:sys_enter_prctl --filter option==SET_NAME
0.000 Isolated Servi/3474327 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23f13b7aee)
0.032 DOM Worker/3474327 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23deb25670)
7.920 :3474328/3474328 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24fbb10)
7.935 StreamT~s #374/3474328 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24fb970)
8.400 Isolated Servi/3474329 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24bab10)
8.418 StreamT~s #374/3474329 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24ba970)
^C[root@five ~]#

This addresses this perf build warning:

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andy Chiu <andy.chiu@sifive.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Palmer Dabbelt <palmer@rivosinc.com>
Link: https://lore.kernel.org/lkml/ZK2DhOB6JJKu2A7M@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+11
+11
tools/include/uapi/linux/prctl.h
··· 294 294 295 295 #define PR_SET_MEMORY_MERGE 67 296 296 #define PR_GET_MEMORY_MERGE 68 297 + 298 + #define PR_RISCV_V_SET_CONTROL 69 299 + #define PR_RISCV_V_GET_CONTROL 70 300 + # define PR_RISCV_V_VSTATE_CTRL_DEFAULT 0 301 + # define PR_RISCV_V_VSTATE_CTRL_OFF 1 302 + # define PR_RISCV_V_VSTATE_CTRL_ON 2 303 + # define PR_RISCV_V_VSTATE_CTRL_INHERIT (1 << 4) 304 + # define PR_RISCV_V_VSTATE_CTRL_CUR_MASK 0x3 305 + # define PR_RISCV_V_VSTATE_CTRL_NEXT_MASK 0xc 306 + # define PR_RISCV_V_VSTATE_CTRL_MASK 0x1f 307 + 297 308 #endif /* _LINUX_PRCTL_H */