While running some kernel selftests I discovered that the kernel ftrace func_stack_tracer.tc fails. How to reproduce: in the 5.13 kernel source tree: $ cd linux/tools/testing/selftests/ftrace $ sudo ./ftracetest test.d/ftrace/func_stack_tracer.tc [1] ftrace - Max stack tracer [FAIL] # of passed: 0 # of failed: 1 # of unresolved: 0 # of untested: 0 # of unsupported: 0 # of xfailed: 0 # of undefined(test bug): 0 ... I've looked at this test and the following occurs: 0. go to the tracking directory: cd /sys/kernel/debug/tracing 1. tracer is disabled: echo 0 > /proc/sys/kernel/stack_tracer_enabled 2. tracer is set to track all kernel functions with *lock* in the name: echo '*lock*' > stack_trace_filter (this takes a few minutes to configure, it's quite slow). one can see the functions filtered on by using cat stack_trace_filter 3. emabling the tracer: echo 0 > stack_max_size echo 1 > /proc/sys/kernel/stack_tracer_enabled 4. check if the tracer has found any functions that match: cat stack_trace | grep lock ..none appear in position 0 in the stack_trace file. This works on other arches such as arm64, amd64, s390x etc.. so I'm not sure why it's not working on RISC-V.
Tested in RISC-V SiFive Unmatched dev board and QEMU.