Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs

From: Gabriele Monaco

Date: Tue Dec 01 2026 - 10:42:28 EST


On Tue, 2026-12-01 at 05:06 +0000, Alexei Starovoitov wrote:
> bpf_printk is based on ftrace/tracing/ring_buffer and it's definitely flood-
> proof.
> Last time I checked it worked from NMI and from page fault handlers where
> normal printk isn't an option.

It may not break the kernel, which is good, but if rv floods the ring buffer
(unfiltered), it may as well drop more important events that relied on
bpf_printk.

Another point in favour of separate channels is that it can be interpreted as a
somewhat stable API, we can attach handlers to these tracepoints and implement
some generic reactions.
Having to parse bpf_printk works too but is more brittle.

But I agree, in its current shape, the tracepoint really looks like printk.

What I'd really like to have is a structured version of this, e.g.:

event_monitor(state, event, next) -> fmt "state x event -> next"

This however needs me to pass a series of strings to the kfunc and the only
meaningful way without exploding in number of arguments is defining a struct
uniquely for this purpose.

There's also the other issue with NULL termination you raised, so in the end I'd
probably need to do something like 2 rounds of memcpy to ensure data written to
the ring buffer.


If you don't have anything against using kfuncs themselves and passing a bunch
of (structured) strings, I can start drafting that and see how it behaves.

Thanks,
Gabriele