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

tools headers UAPI: Sync files changed by new cachestat syscall with the kernel sources

To pick the changes in these csets:

cf264e1329fb0307 ("cachestat: implement cachestat syscall")

That add support for this new syscall in tools such as 'perf trace'.

For instance, this is now possible:

# perf trace -e cachestat
^C[root@five ~]#
# perf trace -v -e cachestat
Using CPUID AuthenticAMD-25-21-0
event qualifier tracepoint filter: (common_pid != 3163687 && common_pid != 3147) && (id == 451)
mmap size 528384B
^C[root@five ~]

# perf trace -v -e *stat* --max-events=10
Using CPUID AuthenticAMD-25-21-0
event qualifier tracepoint filter: (common_pid != 3163713 && common_pid != 3147) && (id == 4 || id == 5 || id == 6 || id == 136 || id == 137 || id == 138 || id == 262 || id == 332 || id == 451)
mmap size 528384B
0.000 ( 0.009 ms): Cache2 I/O/4544 statfs(pathname: 0x45635288, buf: 0x7f8745725b60) = 0
0.012 ( 0.003 ms): Cache2 I/O/4544 newfstatat(dfd: CWD, filename: 0x45635288, statbuf: 0x7f874569d250) = 0
0.036 ( 0.002 ms): Cache2 I/O/4544 newfstatat(dfd: 138, filename: 0x541b7093, statbuf: 0x7f87457256f0, flag: 4096) = 0
0.372 ( 0.006 ms): Cache2 I/O/4544 statfs(pathname: 0x45635288, buf: 0x7f8745725b10) = 0
0.379 ( 0.003 ms): Cache2 I/O/4544 newfstatat(dfd: CWD, filename: 0x45635288, statbuf: 0x7f874569d250) = 0
0.390 ( 0.002 ms): Cache2 I/O/4544 newfstatat(dfd: 138, filename: 0x541b7093, statbuf: 0x7f87457256a0, flag: 4096) = 0
0.609 ( 0.005 ms): Cache2 I/O/4544 statfs(pathname: 0x45635288, buf: 0x7f8745725b60) = 0
0.615 ( 0.003 ms): Cache2 I/O/4544 newfstatat(dfd: CWD, filename: 0x45635288, statbuf: 0x7f874569d250) = 0
0.625 ( 0.002 ms): Cache2 I/O/4544 newfstatat(dfd: 138, filename: 0x541b7093, statbuf: 0x7f87457256f0, flag: 4096) = 0
0.826 ( 0.005 ms): Cache2 I/O/4544 statfs(pathname: 0x45635288, buf: 0x7f8745725b10) = 0
#

That is the filter expression attached to the raw_syscalls:sys_{enter,exit}
tracepoints.

$ find tools/perf/arch/ -name "syscall*tbl" | xargs grep -w sys_cachestat
tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl:451 n64 cachestat sys_cachestat
tools/perf/arch/powerpc/entry/syscalls/syscall.tbl:451 common cachestat sys_cachestat
tools/perf/arch/s390/entry/syscalls/syscall.tbl:451 common cachestat sys_cachestat sys_cachestat
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl:451 common cachestat sys_cachestat
$

$ grep -w cachestat /tmp/build/perf-tools/arch/x86/include/generated/asm/syscalls_64.c
[451] = "cachestat",
$

This addresses these perf build warnings:

Warning: Kernel ABI header differences:
diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
diff -u tools/include/uapi/linux/mman.h include/uapi/linux/mman.h
diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl
diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Link: https://lore.kernel.org/lkml/ZK1pVBJpbjujJNJW@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+22 -1
+4 -1
tools/include/uapi/asm-generic/unistd.h
··· 817 817 #define __NR_set_mempolicy_home_node 450 818 818 __SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node) 819 819 820 + #define __NR_cachestat 451 821 + __SYSCALL(__NR_cachestat, sys_cachestat) 822 + 820 823 #undef __NR_syscalls 821 - #define __NR_syscalls 451 824 + #define __NR_syscalls 452 822 825 823 826 /* 824 827 * 32 bit systems traditionally used different
+14
tools/include/uapi/linux/mman.h
··· 4 4 5 5 #include <asm/mman.h> 6 6 #include <asm-generic/hugetlb_encode.h> 7 + #include <linux/types.h> 7 8 8 9 #define MREMAP_MAYMOVE 1 9 10 #define MREMAP_FIXED 2 ··· 41 40 #define MAP_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB 42 41 #define MAP_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB 43 42 #define MAP_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB 43 + 44 + struct cachestat_range { 45 + __u64 off; 46 + __u64 len; 47 + }; 48 + 49 + struct cachestat { 50 + __u64 nr_cache; 51 + __u64 nr_dirty; 52 + __u64 nr_writeback; 53 + __u64 nr_evicted; 54 + __u64 nr_recently_evicted; 55 + }; 44 56 45 57 #endif /* _UAPI_LINUX_MMAN_H */
+1
tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl
··· 365 365 448 n64 process_mrelease sys_process_mrelease 366 366 449 n64 futex_waitv sys_futex_waitv 367 367 450 common set_mempolicy_home_node sys_set_mempolicy_home_node 368 + 451 n64 cachestat sys_cachestat
+1
tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
··· 537 537 448 common process_mrelease sys_process_mrelease 538 538 449 common futex_waitv sys_futex_waitv 539 539 450 nospu set_mempolicy_home_node sys_set_mempolicy_home_node 540 + 451 common cachestat sys_cachestat
+1
tools/perf/arch/s390/entry/syscalls/syscall.tbl
··· 453 453 448 common process_mrelease sys_process_mrelease sys_process_mrelease 454 454 449 common futex_waitv sys_futex_waitv sys_futex_waitv 455 455 450 common set_mempolicy_home_node sys_set_mempolicy_home_node sys_set_mempolicy_home_node 456 + 451 common cachestat sys_cachestat sys_cachestat
+1
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
··· 372 372 448 common process_mrelease sys_process_mrelease 373 373 449 common futex_waitv sys_futex_waitv 374 374 450 common set_mempolicy_home_node sys_set_mempolicy_home_node 375 + 451 common cachestat sys_cachestat 375 376 376 377 # 377 378 # Due to a historical design error, certain syscalls are numbered differently