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

From: Alexei Starovoitov

Date: Tue Dec 01 2026 - 16:26:03 EST


On Tue, Dec 01, 2026 at 07:42 AM Gabriele Monaco <gmonaco@xxxxxxxxxx> wrote:
> 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"

That makes more sense.

> 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.

Porbably no need for copies.
If your names are in rodata than __str suffix on kfunc args will do. Like:

void bpf_rv_da_event(const char *mon__str, const int *id__nullable,
const char *state__str, const char *event__str,
const char *next_state__str);


> 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.

No objections. I still feel you're too attached to printk-like output.
You could have used existing ringbuf and passed binary data to user daemon.
With event_monitor(state, event, next) you kinda doing one step in that direction.