2. Confientia Driving Innovations™2
Driving Innovations™
About meAbout me
●
Alan (Quey-Liang) Kao
●
2007~2017 NTHU
●
BS, MS, P
●
2017.10~ Andes Technology
●
software engineer
●
RISC-V Linux
●
Interests in Linux
●
virtualization, container, tracing, perf
21. Confientia Driving Innovations™21
Driving Innovations™
IntroiuctionIntroiuction
●
Function Tracer
●
now serves as a framework, under the tracing subsystem
●
Originally a tracer in the PREEMPT_RT patchset
●
to measure latency
●
“Ftrace aiis little overheai to the system when
tracing.” -- Survey and Analysis of Kernel and
Userspace Tracers on Linux: Design, Implementation,
and Overhead, ACM Computing Survey 2018 June
22. Confientia Driving Innovations™22
Driving Innovations™
Basic UsageBasic Usage
●
Example 0: go to the right place
# cd /sys/kernel/debug/tracing
●
Example 1: start function tracer
# cat available_tracers
function function_graph ...
# echo function_graph > current_tracer &&
echo 1 > tracing_on
●
Example 2: set white/black list to trace
# cat available_filter_functions
... // some compiler-modified names here
# echo foo bar > set_ftrace_filter // white list
# echo foo bar > set_ftrace_notrace // black list (superior)
●
Example 3: check the trace
●
# cat trace // the blocking alternative: trace_pipe
40. Confientia Driving Innovations™40
Driving Innovations™
My frst PATCH!My frst PATCH!
commit 10626c32e3827bca560217966f5bd586c4e91584
Author: Alan Kao <alankao@andestech.com>
Date: Mon Dec 18 17:52:48 2017 +0800
riscv/ftrace: Aii basic support
This patch contains basic ftrace support for RV64I platform. Specifically, function
tracer, function graph tracer (HAVE_FUNCTION_GRAPH_TRACER), and ... are
implemented following the instructions in Documentation/trace/ftrace-design.txt.
Note that the functions in both ftrace.c and setup.c should not be hooked with the
compiler's -pg option: to prevent infinite self-referencing for the former, and to ignore
early setup stuf for the latter.
Signed-of-by: Alan Kao <alankao@andestech.com>
Signed-of-by: Palmer Dabbelt <palmer@sifive.com>
41. Confientia Driving Innovations™41
Driving Innovations™
[PATCHv4 3/6][PATCHv4 3/6]
commit bc1a4c3a842556852bb02039887d73899d513532
Author: Alan Kao <alankao@andestech.com>
Date: Tue Feb 13 13:13:18 2018 +0800
riscv/ftrace: Aii iynamic function graph tracer support
Once the function_graph tracer is enabled, a filtered function has the
following call sequence:
* ftracer_caller ==> on/of by ftrace_make_call/ftrace_make_nop
* ftrace_graph_caller
* ftrace_graph_call ==> on/of by ftrace_en/disable_ftrace_graph_caller
* prepare_ftrace_return
Considering the following DYNAMIC_FTRACE_WITH_REGS feature, it would be
more extendable to have a ftrace_graph_caller function, instead of
calling prepare_ftrace_return directly in ftrace_caller.
Cc: Greentime Hu <greentime@andestech.com>
Signed-of-by: Alan Kao <alankao@andestech.com>
Signed-of-by: Palmer Dabbelt <palmer@sifive.com>
44. Confientia Driving Innovations™44
Driving Innovations™
Basic UsageBasic Usage
●
Example 0: list events
# perf list
●
Example 1: collect counters
# perf stat -e faults,cycles ls ~
●
Example 2: profiling the system
# perf record -e faults ls ~
# perf report
# Overhead Command Shared Object Symbol
# ........ ....... ................. ...................
14.29% ls [kernel.kallsyms] [k] __asm_copy_to_user
14.29% ls busybox [.] 0x00000000000c1d0e
14.29% ls busybox [.] 0x00000000000eeed2
14.29% ls busybox [.] 0x0000000000118634
11.43% ls busybox [.] 0x00000000000c56ae
8.57% ls busybox [.] 0x00000000001039da
5.71% ls busybox [.] 0x00000000000eec90
2.86% ls [kernel.kallsyms] [k] __clear_user
47. Confientia Driving Innovations™47
Driving Innovations™
[PATCH 1/2] Coies[PATCH 1/2] Coies
commit d9695108ebad944f32c72c90bc94142c4f44454f
Author: Alan Kao <alankao@andestech.com>
Date: Fri Apr 20 07:27:49 2018 +0800
perf: riscv: preliminary RISC-V support
This patch provide a basic PMU, riscv_base_pmu, which supports two
general hariware event, instructions and cycles. Furthermore, this
PMU serves as a reference implementation to ease the portings in
the future.
riscv_base_pmu shouli be able to run on any RISC-V machine that
conforms to the Priv-Spec. Note that the latest qemu model hasn't
fully support a proper behavior of Priv-Spec 1.10 yet, but work
around should be easy with very small fixes. Please check
https://github.com/riscv/riscv-qemu/pull/115 for future updates.
48. Confientia Driving Innovations™48
Driving Innovations™
[PATCH 2/2] Doc[PATCH 2/2] Doc
commit 6f2490406927492c392e1b51f5706a2a0b8e4a1b
Author: Alan Kao <alankao@andestech.com>
Date: Fri Apr 20 07:27:50 2018 +0800
perf: riscv: Aii Document for Future Porting Guiie
Reviewed-by: Alex Solomatnikov <sols@sifive.com>
Cc: Nick Hu <nickhu@andestech.com>
Cc: Greentime Hu <greentime@andestech.com>
Signed-of-by: Alan Kao <alankao@andestech.com>
Signed-of-by: Palmer Dabbelt <palmer@sifive.com>