Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)     Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)     . Disable strace like syscall tracing (--no-syscalls), or try tracing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)       just some (-e *sleep).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)     . Attach a filter function to a kernel function, returning when it should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)       be considered, i.e. appear on the output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)     . Run it system wide, so that any sleep of >= 5 seconds and < than 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)       seconds gets caught.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)     . Ask for callgraphs using DWARF info, so that userspace can be unwound
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)     . While this is running, run something like "sleep 5s".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)     . If we decide to add tv_nsec as well, then it becomes:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)       int probe(hrtimer_nanosleep, rqtp->tv_sec rqtp->tv_nsec)(void *ctx, int err, long sec, long nsec)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)       I.e. add where it comes from (rqtp->tv_nsec) and where it will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)       accessible in the function body (nsec)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)     # perf trace --no-syscalls -e tools/perf/examples/bpf/5sec.c/call-graph=dwarf/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)          0.000 perf_bpf_probe:func:(ffffffff9811b5f0) tv_sec=5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)                                            hrtimer_nanosleep ([kernel.kallsyms])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)                                            __x64_sys_nanosleep ([kernel.kallsyms])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)                                            do_syscall_64 ([kernel.kallsyms])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)                                            entry_SYSCALL_64 ([kernel.kallsyms])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)                                            __GI___nanosleep (/usr/lib64/libc-2.26.so)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)                                            rpl_nanosleep (/usr/bin/sleep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)                                            xnanosleep (/usr/bin/sleep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)                                            main (/usr/bin/sleep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)                                            __libc_start_main (/usr/lib64/libc-2.26.so)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)                                            _start (/usr/bin/sleep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)     ^C#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)    Copyright (C) 2018 Red Hat, Inc., Arnaldo Carvalho de Melo <acme@redhat.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #include <bpf/bpf.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define NSEC_PER_SEC	1000000000L
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) int probe(hrtimer_nanosleep, rqtp)(void *ctx, int err, long long sec)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	return sec / NSEC_PER_SEC == 5ULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) license(GPL);