tracing: Add a way to filter function addresses to function names
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Mon, 19 Dec 2022 18:31:07 +0000 (13:31 -0500)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 25 Jan 2023 15:31:11 +0000 (10:31 -0500)
commite6745a4da964f5f49b21cbcce5125456984ddc6b
tree06ffa744498e7ece4d553fbfc3762a042db8a200
parentae3edea88e6c1bbb8b41ef958f79a7a44ab45f7c
tracing: Add a way to filter function addresses to function names

There's been several times where an event records a function address in
its field and I needed to filter on that address for a specific function
name. It required looking up the function in kallsyms, finding its size,
and doing a compare of "field >= function_start && field < function_end".

But this would change from boot to boot and is unreliable in scripts.
Also, it is useful to have this at boot up, where the addresses will not
be known. For example, on the boot command line:

  trace_trigger="initcall_finish.traceoff if func.function == acpi_init"

To implement this, add a ".function" prefix, that will check that the
field is of size long, and the only operations allowed (so far) are "=="
and "!=".

Link: https://lkml.kernel.org/r/20221219183213.916833763@goodmis.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Tom Zanussi <zanussi@kernel.org>
Cc: Zheng Yejian <zhengyejian1@huawei.com>
Reviewed-by: Ross Zwisler <zwisler@google.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Documentation/trace/events.rst
kernel/trace/trace_events.c
kernel/trace/trace_events_filter.c