Re: [PATCH 01/11] media: Move visl traces to v4l2-core

Steven Rostedt
2026-05-01T19:08:03Z

Sorry, I didn't look at these patches at the time they were posted, but
when I saw you reply recently with:

"On the userspace side, each trace events can be enabled separately and
even filtered (although I'm not sure filtering is good for performance,
has it has to match each event with a regex)."

I had to see what you meant by regex, because no tracer should be using
regex for filtering.

On Thu, 12 Feb 2026 11:23:18 -0500
Detlev Casanova <detlev.casanova@collabora.com> wrote:

> +
> +DECLARE_EVENT_CLASS(v4l2_ctrl_mpeg2_seq_tmpl,
> + TP_PROTO(const struct v4l2_ctrl_mpeg2_sequence *s),
> + TP_ARGS(s),
> + TP_STRUCT__entry(__field_struct(struct v4l2_ctrl_mpeg2_sequence, s)),
> + TP_fast_assign(__entry->s = *s;),

What the heck! You are copying an entire structure onto the ring buffer to
print just a portion of it? This is really a waste of ring buffer, and also
prevents you from doing any real filtering.

You do realize that you can filter on fields (if they are defined as normal
fields).

For example,

# cd /sys/kernel/tracing
# echo 'height > 20 && width > 30' > events/visl_fwht_controls/v4l2_ctrl_fwht_params/filter
# echo 1 > events/visl_fwht_controls/v4l2_ctrl_fwht_params/enable

And that will only trace that event where the height field is greater than
20 and the width field is greater than 30. It's converted into a fast array
to do the filtering. No regex involved.

Also, there's a library to read the raw events from the ring buffers where
you can do filtering on the read side too:

https://trace-cmd.org/Documentation/libtracefs/
https://trace-cmd.org/Documentation/libtraceevent/

-- Steve

> + TP_printk("\nhorizontal_size %u\nvertical_size %u\nvbv_buffer_size %u\n"
> + "profile_and_level_indication %u\nchroma_format %u\nflags %s\n",
> + __entry->s.horizontal_size,
> + __entry->s.vertical_size,
> + __entry->s.vbv_buffer_size,
> + __entry->s.profile_and_level_indication,
> + __entry->s.chroma_format,
> + __print_flags(__entry->s.flags, "|",
> + {V4L2_MPEG2_SEQ_FLAG_PROGRESSIVE, "PROGRESSIVE"})
> + )
> +);
> +