linux/samples/trace_events
Masami Hiramatsu (Google) 7d8d6ad659 tracing/probes: Add a new testcase for BTF typecasts
With the introduction of container_of-style BTF typecasting and
per-CPU variable access support in trace probes, we need a way to
verify their functionality and prevent regressions.

Add a new ftrace kselftest and update the trace event sample module
to test and validate these features.

Specifically, update the trace-events-sample module to set up a
periodic timer whose callback accesses a per-CPU counter. Introduce
a new sample trace event, foo_timer_fn, to trace this callback
and log the current counter value.

Then, add a new test case, btf_probe_event.tc, which defines a
dynamic probe on the timer callback. The probe uses BTF typecasting
to recover the parent structure from the timer argument and
this_cpu_read() to fetch the per-CPU counter. The test verifies
the integrity of the implementation by ensuring the values
recorded by the dynamic probe match those from the static tracepoint.

Link: https://lore.kernel.org/all/178271368625.1176915.13502654445483530822.stgit@devnote2/

Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
2026-07-14 22:43:16 +09:00
..
Makefile tracing: Add TRACE_CUSTOM_EVENT() macro 2022-03-11 11:49:24 -05:00
trace_custom_sched.c treewide: remove unnecessary <linux/version.h> inclusion 2024-08-12 18:36:44 +09:00
trace_custom_sched.h sched/tracing: Append prev_state to tp args instead 2022-05-12 00:37:11 +02:00
trace-events-sample.c tracing/probes: Add a new testcase for BTF typecasts 2026-07-14 22:43:16 +09:00
trace-events-sample.h tracing/probes: Add a new testcase for BTF typecasts 2026-07-14 22:43:16 +09:00