Activating kernel function trace does not working.
Kernel config - Ftrace setting
CONFIG_SLUB_CPU_PARTIAL=y
CONFIG_SYSTEM_DATA_VERIFICATION=y
CONFIG_PROFILING=y
+CONFIG_TRACEPOINTS=y # end of General setup
....
# CONFIG_KPROBES is not set CONFIG_JUMP_LABEL=y # CONFIG_STATIC_KEYS_SELFTEST is not set +CONFIG_UPROBES=y CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y CONFIG_HAVE_KPROBES=y CONFIG_HAVE_KRETPROBES=y
....
# CONFIG_STACKTRACE is not set +CONFIG_TRACE_IRQFLAGS=y +CONFIG_STACKTRACE=y # CONFIG_WARN_ALL_UNSEEDED_RANDOM is not set # CONFIG_DEBUG_KOBJECT is not set CONFIG_HAVE_DEBUG_BUGVERBOSE=y # CONFIG_NOTIFIER_ERROR_INJECTION is not set # CONFIG_FAULT_INJECTION is not set # CONFIG_LATENCYTOP is not set +CONFIG_NOP_TRACER=y CONFIG_HAVE_FUNCTION_TRACER=y CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y CONFIG_HAVE_DYNAMIC_FTRACE=y CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y CONFIG_HAVE_SYSCALL_TRACEPOINTS=y CONFIG_HAVE_C_RECORDMCOUNT=y +CONFIG_TRACER_MAX_TRACE=y +CONFIG_TRACE_CLOCK=y +CONFIG_RING_BUFFER=y +CONFIG_EVENT_TRACING=y +CONFIG_CONTEXT_SWITCH_TRACER=y +CONFIG_RING_BUFFER_ALLOW_SWAP=y +CONFIG_PREEMPTIRQ_TRACEPOINTS=y +CONFIG_TRACING=y +CONFIG_GENERIC_TRACER=y CONFIG_TRACING_SUPPORT=y # CONFIG_FTRACE is not set +CONFIG_FTRACE=y +CONFIG_FUNCTION_TRACER=y +CONFIG_FUNCTION_GRAPH_TRACER=y # CONFIG_PREEMPTIRQ_EVENTS is not set +CONFIG_IRQSOFF_TRACER=y # CONFIG_PREEMPT_TRACER is not set +CONFIG_SCHED_TRACER=y # CONFIG_HWLAT_TRACER is not set # CONFIG_FTRACE_SYSCALLS is not set +CONFIG_TRACER_SNAPSHOT=y +CONFIG_TRACER_SNAPSHOT_PER_CPU_SWAP=y +CONFIG_BRANCH_PROFILE_NONE=y # CONFIG_PROFILE_ANNOTATED_BRANCHES is not set # CONFIG_PROFILE_ALL_BRANCHES is not set # CONFIG_STACK_TRACER is not set # CONFIG_BLK_DEV_IO_TRACE is not set +CONFIG_UPROBE_EVENTS=y +CONFIG_DYNAMIC_EVENTS=y +CONFIG_PROBE_EVENTS=y +CONFIG_DYNAMIC_FTRACE=y +CONFIG_FUNCTION_PROFILER=y +CONFIG_FTRACE_MCOUNT_RECORD=y # CONFIG_FTRACE_STARTUP_TEST is not set # CONFIG_HIST_TRIGGERS is not set # CONFIG_TRACEPOINT_BENCHMARK is not set # CONFIG_RING_BUFFER_BENCHMARK is not set # CONFIG_RING_BUFFER_STARTUP_TEST is not set # CONFIG_PREEMPTIRQ_DELAY_TEST is not set # CONFIG_TRACE_EVAL_MAP_FILE is not set CONFIG_RUNTIME_TESTING_MENU=y # CONFIG_LKDTM is not set # CONFIG_TEST_LIST_SORT is not set
root@imx8mqevk:/sys/kernel/debug/tracing# cat set_ftrace_filter
#### all functions enabled ####
root@imx8mqevk:/sys/kernel/debug/tracing# echo do_fault:traceoff > set_ftrace_filter
-sh: echo: write error: Invalid argument
To set function trace of secondary_start_kernel ,
root@imx8mqevk:/sys/kernel/debug/tracing# echo secondary_start_kernel:traceon > set_ftrace_filter
-sh: echo: write error: Invalid argument
Solved! Go to Solution.
According to this:
https://www.kernel.org/doc/html/v4.18/trace/events.html
If there is an error in the expression, you’ll get an ‘Invalid argument’ error when setting it.
According to this:
https://www.kernel.org/doc/html/v4.18/trace/events.html
If there is an error in the expression, you’ll get an ‘Invalid argument’ error when setting it.
Thanks. jimmychan.
I tried your idea. and finally find the way.
secondary_start_kernel was not in the available_filter_functions list.
so , i tried another one.
root@imx8mqevk:/sys/kernel/debug/tracing# cat available_filter_functions | grep -i secon
freeze_secondary_cpus
irq_forced_secondary_handler
ktime_get_seconds
ktime_get_real_seconds
__ktime_get_real_seconds
second_overflow
acpi_ns_get_secondary_object
_xfer_secondary_pool
xfer_secondary_pool
framegen_secondary_clear_channel_status
framegen_wait_for_secondary_syncup
framegen_secondary_is_syncup
framegen_secondary_requests_to_read_empty_fifo
set_secondary_fwnode
config_sub_second_increment
mci_seconds_show
cfg80211_secondary_chans_ok
root@imx8mqevk:/sys/kernel/debug/tracing# echo freeze_secondary_cpus > set_ftrace_filter
~~~~~
thanks , it is useful