Skip to content

tracing/filters: Support specifying filter hook to a TRACE_EVENT field

Li Zefan lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 6 repliesIn review
  2. v13 patches 10 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3tracing/filters: Add filter_type to struct ftrace_event_fieldkernel/trace/trace.h kernel/trace/trace_events.c kernel/trace/trace_events_filter.c+18 -91 reply
2/3tracing/filters: Add __field_ext() to TRACE_EVENTinclude/linux/ftrace_event.h include/trace/ftrace.h kernel/trace/trace_events.c +2 more+45 -204 replies
3/3tracing/filters: Support filtering for char * stringsinclude/linux/ftrace_event.h kernel/trace/trace_events_filter.c+24 -31 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] tracing/filters: Support specifying filter hook to a TRACE_EVENT field

v2: no big changes, but addressed Steven's comments

Currently only static strings and dynamic strings have their own filter functions, other types of field are treated as integers.

This patchset allows assigning a specific filter type to a field, so a field which is defined as:

__field_ext(const char *, str, FILTER_PTR_STR)

will be treated as a string but not a plain pointer, and then we can set the filter like this:

	# echo 'str == foo' > filter

And it's easy to add more filter functions for different types to turn these into valid operations:

	(dev is of type dev_t)
	# echo 'dev == 8:0' > filter

	(callsite is of type void * or unsigned long)
	# echo 'callsite == skb_free' > filter

[PATCH 1/3] tracing/filters: Add filter_type to struct ftrace_event_field [PATCH 2/3] tracing/filters: Add __field_ext() to TRACE_EVENT [PATCH 3/3] tracing/filters: Support filtering for char * strings

---
 include/linux/ftrace_event.h       |   12 +++++++-
 include/trace/ftrace.h             |   31 ++++++++++++++++++-----
 kernel/trace/trace.h               |    2 +
 kernel/trace/trace_events.c        |    9 ++++++-
 kernel/trace/trace_events_filter.c |   47 +++++++++++++++++++++++++----------
 kernel/trace/trace_export.c        |    8 ++++--
 6 files changed, 82 insertions(+), 27 deletions(-)