linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] tracing: Add a way to filter function addresses to function names
@ 2022-12-19 18:31 Steven Rostedt
  2022-12-19 18:31 ` [PATCH 1/2] " Steven Rostedt
  2022-12-19 18:31 ` [PATCH 2/2] tracing/selftests: Add test for event filtering on function name Steven Rostedt
  0 siblings, 2 replies; 9+ messages in thread
From: Steven Rostedt @ 2022-12-19 18:31 UTC (permalink / raw)
  To: linux-kernel, linux-trace-kernel
  Cc: Masami Hiramatsu, Andrew Morton, Ross Zwisler, Tom Zanussi,
	Zheng Yejian

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 "!=".

Changes since v1: https://lore.kernel.org/linux-trace-kernel/20221214125209.09d736dd@gandalf.local.home/

 - Fix commit log "initcall_finish.function" to "func.function" (Ross Zwisler)

 - Fixed processing of address (Ross Zwisler)

 - Added selftest (Masami Hiramatsu)

 - Just use "trigger" instead of "strsep(&trigger, "")" (Zheng Yejian)

Steven Rostedt (Google) (2):
      tracing: Add a way to filter function addresses to function names
      tracing/selftests: Add test for event filtering on function name

----
 Documentation/trace/events.rst                     | 12 +++
 kernel/trace/trace_events.c                        |  2 +-
 kernel/trace/trace_events_filter.c                 | 93 +++++++++++++++++++++-
 .../ftrace/test.d/filter/event-filter-function.tc  | 58 ++++++++++++++
 4 files changed, 163 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/ftrace/test.d/filter/event-filter-function.tc

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-12-20  1:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-19 18:31 [PATCH 0/2] tracing: Add a way to filter function addresses to function names Steven Rostedt
2022-12-19 18:31 ` [PATCH 1/2] " Steven Rostedt
2022-12-19 20:57   ` Ross Zwisler
2022-12-19 18:31 ` [PATCH 2/2] tracing/selftests: Add test for event filtering on function name Steven Rostedt
2022-12-19 20:57   ` Ross Zwisler
2022-12-19 22:11     ` Shuah Khan
2022-12-19 22:35       ` Steven Rostedt
2022-12-20  0:20         ` Shuah Khan
2022-12-20  1:21           ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).