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

From: Tomas Glozar

Date: Tue Dec 01 2026 - 06:08:17 EST


On Tue, Dec 1, 2026 at 6:06 AM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> On Mon, Nov 30, 2026 at 02:56 AM Gabriele Monaco <gmonaco@xxxxxxxxxx> wrote:
> > Especially the events channel has the potential to flood other bpf_printk
> > readers, I'm not sure whether that's acceptable.
> >
> > We can apply filters for rv, but then any other user interested in bpf_printk
> > would need to filter rv out.
>
> Well, yes, but one filter drops them for all trace_pipe readers:
>
> cd /sys/kernel/tracing/events/bpf_trace/bpf_trace_printk
> echo '!(bpf_string ~ "rv: *")' > filter
>
> trivial thing, so I really don't get the idea of introducing extra kfuncs
> to behave like printk-s.
>

ftrace filters are instance-local, non-global instances are unaffected by that:

[root@cs9 tracing]# echo 'pid > 1000' > events/sched/sched_wakeup/filter
[root@cs9 tracing]# echo 1 > events/sched/sched_wakeup/enable;
sleep 5; echo 0 > events/sched/sched_wakeup/enable; head -n20 trace
htop-54386 [000] d.L.4.. 358269.229286:
sched_wakeup: comm=kworker/u16:2 pid=54396 prio=120 target_cpu=000
kworker/u16:2-54396 [000] d...311 358269.229291: sched_wakeup:
comm=sshd-session pid=5653 prio=120 target_cpu=000
htop-54386 [000] d.L.4.. 358269.229304:
sched_wakeup: comm=sshd-session pid=5653 prio=120 target_cpu=000
htop-54386 [000] d.L.4.. 358269.229340:
sched_wakeup: comm=kworker/u16:2 pid=54396 prio=120 target_cpu=000
kworker/u16:2-54396 [000] d...311 358269.229341: sched_wakeup:
comm=sshd-session pid=5653 prio=120 target_cpu=000
htop-54386 [000] d.L.4.. 358269.229344:
sched_wakeup: comm=sshd-session pid=5653 prio=120 target_cpu=000
[root@cs9 tracing]# mkdir instances/new
[root@cs9 tracing]# echo 1 >
instances/new/events/sched/sched_wakeup/enable; sleep 5; echo 0 >
instances/new/events/sched/sched_wakeup/enable; head -n20
instances/new/trace
...
bash-54314 [000] dn.h6.. 358299.447640:
sched_wakeup: comm=irq_work/0 pid=24 prio=98 target_cpu=000
irq_work/0-24 [000] d...311 358299.447646: sched_wakeup:
comm=tuned pid=1447 prio=120 target_cpu=000
sudo-54311 [000] d.L.4.. 358299.447699:
sched_wakeup: comm=kworker/u16:0 pid=54147 prio=120 target_cpu=000
kworker/u16:0-54147 [000] d...311 358299.447700: sched_wakeup:
comm=sshd-session pid=5726 prio=120 target_cpu=000
sleep-54433 [000] dn.h3.. 358299.447932: sched_wakeup:
comm=irq/54-virtio1- pid=474 prio=49 target_cpu=000
sleep-54433 [000] dn.h6.. 358299.448000: sched_wakeup:
comm=irq_work/0 pid=24 prio=98 target_cpu=000

So this works only for trace_pipe readers on the same instance; if we
want to filter bpf_trace_printk globally, rv has to set the filter in
all instances, including watching newly created ones during the
monitoring, as instances do not inherit filters from the global
instance. I don't think that would be practically feasible: it would
be racy, and the user of the instance might want its own
bpf_trace_printk filter, conflicting with the one needed to filter out
rv.

> [cut]


Tomas