* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs @ 2026-12-02 0:48 kernel test robot 0 siblings, 0 replies; 17+ messages in thread From: kernel test robot @ 2026-12-02 0:48 UTC (permalink / raw) To: oe-kbuild; +Cc: lkp :::::: :::::: Manual check reason: "too many reports for this commit" :::::: BCC: lkp@intel.com CC: oe-kbuild-all@lists.linux.dev In-Reply-To: <20261126130004.127155-6-gmonaco@redhat.com> References: <20261126130004.127155-6-gmonaco@redhat.com> TO: Gabriele Monaco <gmonaco@redhat.com> TO: linux-kernel@vger.kernel.org TO: linux-trace-kernel@vger.kernel.org TO: bpf@vger.kernel.org TO: Steven Rostedt <rostedt@goodmis.org> TO: Gabriele Monaco <gmonaco@redhat.com> TO: Masami Hiramatsu <mhiramat@kernel.org> CC: Alexei Starovoitov <alexei.starovoitov@gmail.com> CC: Nam Cao <namcao@linutronix.de> CC: Wen Yang <wen.yang@linux.dev> CC: Tobias Schaffner <tobias.schaffner@siemens.com> CC: Viktor Malik <vmalik@redhat.com> CC: Peter Zijlstra <peterz@infradead.org> CC: John Ogness <john.ogness@linutronix.de> Hi Gabriele, kernel test robot noticed the following build errors: [auto build test ERROR on b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f] url: https://github.com/intel-lab-lkp/linux/commits/Gabriele-Monaco/sched-Add-task-enqueue-dequeue-trace-points/20261126-135947 base: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f patch link: https://lore.kernel.org/r/20261126130004.127155-6-gmonaco%40redhat.com patch subject: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs :::::: branch date: 6 days ago :::::: commit date: 6 days ago config: openrisc-randconfig-r2310-20261201 (https://download.01.org/0day-ci/archive/20261202/20261202014624.XiO4eGWw-lkp@intel.com/config) compiler: or1k-linux-gcc (GCC) 16.2.0 sparse: v0.6.5-rc1-21-g84ec0658 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261202/20261202014624.XiO4eGWw-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/r/20261202014624.XiO4eGWw-lkp@intel.com/ All errors (new ones prefixed by >>): or1k-linux-ld: kernel/trace/rv/rv_bpf.o: in function `bpf_rv_event_monitor': rv_bpf.c:(.text+0x140): undefined reference to `__traceiter_event_monitor' >> rv_bpf.c:(.text+0x140): relocation truncated to fit: R_OR1K_INSN_REL_26 against undefined symbol `__traceiter_event_monitor' or1k-linux-ld: kernel/trace/rv/rv_bpf.o: in function `bpf_rv_error_monitor': rv_bpf.c:(.text+0x24c): undefined reference to `__traceiter_error_monitor' >> rv_bpf.c:(.text+0x24c): relocation truncated to fit: R_OR1K_INSN_REL_26 against undefined symbol `__traceiter_error_monitor' >> or1k-linux-ld: kernel/trace/rv/rv_bpf.o:(__jump_table+0x8): undefined reference to `__tracepoint_event_monitor' >> or1k-linux-ld: kernel/trace/rv/rv_bpf.o:(__jump_table+0x14): undefined reference to `__tracepoint_error_monitor' -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs @ 2026-12-01 12:01 kernel test robot 0 siblings, 0 replies; 17+ messages in thread From: kernel test robot @ 2026-12-01 12:01 UTC (permalink / raw) To: oe-kbuild; +Cc: lkp :::::: :::::: Manual check reason: "too many reports for this commit" :::::: BCC: lkp@intel.com CC: llvm@lists.linux.dev CC: oe-kbuild-all@lists.linux.dev In-Reply-To: <20261126130004.127155-6-gmonaco@redhat.com> References: <20261126130004.127155-6-gmonaco@redhat.com> TO: Gabriele Monaco <gmonaco@redhat.com> TO: linux-kernel@vger.kernel.org TO: linux-trace-kernel@vger.kernel.org TO: bpf@vger.kernel.org TO: Steven Rostedt <rostedt@goodmis.org> TO: Gabriele Monaco <gmonaco@redhat.com> TO: Masami Hiramatsu <mhiramat@kernel.org> CC: Alexei Starovoitov <alexei.starovoitov@gmail.com> CC: Nam Cao <namcao@linutronix.de> CC: Wen Yang <wen.yang@linux.dev> CC: Tobias Schaffner <tobias.schaffner@siemens.com> CC: Viktor Malik <vmalik@redhat.com> CC: Peter Zijlstra <peterz@infradead.org> CC: John Ogness <john.ogness@linutronix.de> Hi Gabriele, kernel test robot noticed the following build errors: [auto build test ERROR on b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f] url: https://github.com/intel-lab-lkp/linux/commits/Gabriele-Monaco/sched-Add-task-enqueue-dequeue-trace-points/20261126-135947 base: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f patch link: https://lore.kernel.org/r/20261126130004.127155-6-gmonaco%40redhat.com patch subject: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs :::::: branch date: 5 days ago :::::: commit date: 5 days ago config: arm64-randconfig-2000-20261201 (https://download.01.org/0day-ci/archive/20261201/20261201125603.XQS8t33E-lkp@intel.com/config) compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 31d2179357f4fa69013af12b6480307c9ce750d4) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261201/20261201125603.XQS8t33E-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/r/20261201125603.XQS8t33E-lkp@intel.com/ All errors (new ones prefixed by >>): >> ld.lld: error: undefined symbol: __traceiter_event_monitor >>> referenced by rv_trace.h:324 (kernel/trace/rv/rv_trace.h:324) >>> kernel/trace/rv/rv_bpf.o:(bpf_rv_event_monitor) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: __traceiter_error_monitor >>> referenced by rv_trace.h:328 (kernel/trace/rv/rv_trace.h:328) >>> kernel/trace/rv/rv_bpf.o:(bpf_rv_error_monitor) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: __tracepoint_event_monitor >>> referenced by rv_bpf.c >>> kernel/trace/rv/rv_bpf.o:(__jump_table+0x8) in archive vmlinux.a -- >> ld.lld: error: undefined symbol: __tracepoint_error_monitor >>> referenced by rv_bpf.c >>> kernel/trace/rv/rv_bpf.o:(__jump_table+0x18) in archive vmlinux.a -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs @ 2026-12-01 11:30 kernel test robot 0 siblings, 0 replies; 17+ messages in thread From: kernel test robot @ 2026-12-01 11:30 UTC (permalink / raw) To: oe-kbuild; +Cc: lkp :::::: :::::: Manual check reason: "too many reports for this commit" :::::: BCC: lkp@intel.com CC: oe-kbuild-all@lists.linux.dev In-Reply-To: <20261126130004.127155-6-gmonaco@redhat.com> References: <20261126130004.127155-6-gmonaco@redhat.com> TO: Gabriele Monaco <gmonaco@redhat.com> TO: linux-kernel@vger.kernel.org TO: linux-trace-kernel@vger.kernel.org TO: bpf@vger.kernel.org TO: Steven Rostedt <rostedt@goodmis.org> TO: Gabriele Monaco <gmonaco@redhat.com> TO: Masami Hiramatsu <mhiramat@kernel.org> CC: Alexei Starovoitov <alexei.starovoitov@gmail.com> CC: Nam Cao <namcao@linutronix.de> CC: Wen Yang <wen.yang@linux.dev> CC: Tobias Schaffner <tobias.schaffner@siemens.com> CC: Viktor Malik <vmalik@redhat.com> CC: Peter Zijlstra <peterz@infradead.org> CC: John Ogness <john.ogness@linutronix.de> Hi Gabriele, kernel test robot noticed the following build errors: [auto build test ERROR on b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f] url: https://github.com/intel-lab-lkp/linux/commits/Gabriele-Monaco/sched-Add-task-enqueue-dequeue-trace-points/20261126-135947 base: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f patch link: https://lore.kernel.org/r/20261126130004.127155-6-gmonaco%40redhat.com patch subject: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs :::::: branch date: 5 days ago :::::: commit date: 5 days ago config: x86_64-randconfig-2302-20261201 (https://download.01.org/0day-ci/archive/20261201/20261201122207.l1s5KQ1A-lkp@intel.com/config) compiler: gcc-13 (Debian 13.3.0-16) 13.3.0 sparse: v0.6.5-rc1-21-g84ec0658 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261201/20261201122207.l1s5KQ1A-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/r/20261201122207.l1s5KQ1A-lkp@intel.com/ All errors (new ones prefixed by >>): ld: kernel/trace/rv/rv_bpf.o: in function `arch_atomic_read': >> arch/x86/include/asm/atomic.h:23:(.text+0x157): undefined reference to `__tracepoint_event_monitor' >> ld: arch/x86/include/asm/atomic.h:23:(.text+0x176): undefined reference to `__tracepoint_event_monitor' ld: arch/x86/include/asm/atomic.h:23:(.text+0x181): undefined reference to `__tracepoint_event_monitor' ld: kernel/trace/rv/rv_bpf.o: in function `__do_trace_event_monitor': kernel/trace/rv/rv_trace.h:324:(.text+0x198): undefined reference to `__tracepoint_event_monitor' ld: kernel/trace/rv/rv_trace.h:324:(.text+0x1ad): undefined reference to `__tracepoint_event_monitor' ld: kernel/trace/rv/rv_bpf.o:kernel/trace/rv/rv_trace.h:324: more undefined references to `__tracepoint_event_monitor' follow ld: kernel/trace/rv/rv_bpf.o: in function `__do_trace_event_monitor': >> kernel/trace/rv/rv_trace.h:324:(.text+0x1ef): undefined reference to `__SCT__tp_func_event_monitor' ld: kernel/trace/rv/rv_bpf.o: in function `arch_atomic_read': >> arch/x86/include/asm/atomic.h:23:(.text+0x27a): undefined reference to `__tracepoint_error_monitor' >> ld: arch/x86/include/asm/atomic.h:23:(.text+0x299): undefined reference to `__tracepoint_error_monitor' ld: arch/x86/include/asm/atomic.h:23:(.text+0x2a4): undefined reference to `__tracepoint_error_monitor' ld: kernel/trace/rv/rv_bpf.o: in function `__do_trace_error_monitor': kernel/trace/rv/rv_trace.h:328:(.text+0x2bb): undefined reference to `__tracepoint_error_monitor' ld: kernel/trace/rv/rv_trace.h:328:(.text+0x2d0): undefined reference to `__tracepoint_error_monitor' ld: kernel/trace/rv/rv_bpf.o:kernel/trace/rv/rv_trace.h:328: more undefined references to `__tracepoint_error_monitor' follow ld: kernel/trace/rv/rv_bpf.o: in function `__do_trace_error_monitor': >> kernel/trace/rv/rv_trace.h:328:(.text+0x312): undefined reference to `__SCT__tp_func_error_monitor' ld: kernel/trace/rv/rv_bpf.o:(.static_call_sites+0x4): undefined reference to `__SCK__tp_func_event_monitor' ld: kernel/trace/rv/rv_bpf.o:(.static_call_sites+0xc): undefined reference to `__SCK__tp_func_error_monitor' vim +23 arch/x86/include/asm/atomic.h 5abbbbf0b0cd4a Brian Gerst 2010-01-07 11 5abbbbf0b0cd4a Brian Gerst 2010-01-07 12 /* 5abbbbf0b0cd4a Brian Gerst 2010-01-07 13 * Atomic operations that C can't guarantee us. Useful for 5abbbbf0b0cd4a Brian Gerst 2010-01-07 14 * resource counting etc.. 5abbbbf0b0cd4a Brian Gerst 2010-01-07 15 */ 5abbbbf0b0cd4a Brian Gerst 2010-01-07 16 8bf705d130396e Dmitry Vyukov 2018-01-29 17 static __always_inline int arch_atomic_read(const atomic_t *v) 5abbbbf0b0cd4a Brian Gerst 2010-01-07 18 { ac605bee0bfab4 Dmitry Vyukov 2018-01-29 19 /* ac605bee0bfab4 Dmitry Vyukov 2018-01-29 20 * Note for KASAN: we deliberately don't use READ_ONCE_NOCHECK() here, ac605bee0bfab4 Dmitry Vyukov 2018-01-29 21 * it's non-inlined function that increases binary size and stack usage. ac605bee0bfab4 Dmitry Vyukov 2018-01-29 22 */ 37f8173dd84936 Peter Zijlstra 2020-01-24 @23 return __READ_ONCE((v)->counter); 5abbbbf0b0cd4a Brian Gerst 2010-01-07 24 } 5abbbbf0b0cd4a Brian Gerst 2010-01-07 25 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs @ 2026-12-01 9:48 kernel test robot 0 siblings, 0 replies; 17+ messages in thread From: kernel test robot @ 2026-12-01 9:48 UTC (permalink / raw) To: oe-kbuild; +Cc: lkp :::::: :::::: Manual check reason: "too many reports for this commit" :::::: BCC: lkp@intel.com CC: oe-kbuild-all@lists.linux.dev In-Reply-To: <20261126130004.127155-6-gmonaco@redhat.com> References: <20261126130004.127155-6-gmonaco@redhat.com> TO: Gabriele Monaco <gmonaco@redhat.com> TO: linux-kernel@vger.kernel.org TO: linux-trace-kernel@vger.kernel.org TO: bpf@vger.kernel.org TO: Steven Rostedt <rostedt@goodmis.org> TO: Gabriele Monaco <gmonaco@redhat.com> TO: Masami Hiramatsu <mhiramat@kernel.org> CC: Alexei Starovoitov <alexei.starovoitov@gmail.com> CC: Nam Cao <namcao@linutronix.de> CC: Wen Yang <wen.yang@linux.dev> CC: Tobias Schaffner <tobias.schaffner@siemens.com> CC: Viktor Malik <vmalik@redhat.com> CC: Peter Zijlstra <peterz@infradead.org> CC: John Ogness <john.ogness@linutronix.de> Hi Gabriele, kernel test robot noticed the following build errors: [auto build test ERROR on b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f] url: https://github.com/intel-lab-lkp/linux/commits/Gabriele-Monaco/sched-Add-task-enqueue-dequeue-trace-points/20261126-135947 base: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f patch link: https://lore.kernel.org/r/20261126130004.127155-6-gmonaco%40redhat.com patch subject: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs :::::: branch date: 5 days ago :::::: commit date: 5 days ago config: sparc-randconfig-r2109-20261201 (https://download.01.org/0day-ci/archive/20261201/20261201104616.6fEEutPZ-lkp@intel.com/config) compiler: sparc64-linux-gcc (GCC) 16.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261201/20261201104616.6fEEutPZ-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/r/20261201104616.6fEEutPZ-lkp@intel.com/ All errors (new ones prefixed by >>): sparc64-linux-ld: kernel/trace/rv/rv_bpf.o: in function `bpf_rv_event_monitor': >> rv_bpf.c:(.text+0x80): undefined reference to `__traceiter_event_monitor' sparc64-linux-ld: kernel/trace/rv/rv_bpf.o: in function `bpf_rv_error_monitor': >> rv_bpf.c:(.text+0x180): undefined reference to `__traceiter_error_monitor' sparc64-linux-ld: kernel/trace/rv/rv_bpf.o:(__jump_table+0x8): undefined reference to `__tracepoint_event_monitor' sparc64-linux-ld: kernel/trace/rv/rv_bpf.o:(__jump_table+0x14): undefined reference to `__tracepoint_error_monitor' -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs @ 2026-12-01 8:46 kernel test robot 0 siblings, 0 replies; 17+ messages in thread From: kernel test robot @ 2026-12-01 8:46 UTC (permalink / raw) To: oe-kbuild; +Cc: lkp :::::: :::::: Manual check reason: "too many reports for this commit" :::::: BCC: lkp@intel.com CC: oe-kbuild-all@lists.linux.dev In-Reply-To: <20261126130004.127155-6-gmonaco@redhat.com> References: <20261126130004.127155-6-gmonaco@redhat.com> TO: Gabriele Monaco <gmonaco@redhat.com> TO: linux-kernel@vger.kernel.org TO: linux-trace-kernel@vger.kernel.org TO: bpf@vger.kernel.org TO: Steven Rostedt <rostedt@goodmis.org> TO: Gabriele Monaco <gmonaco@redhat.com> TO: Masami Hiramatsu <mhiramat@kernel.org> CC: Alexei Starovoitov <alexei.starovoitov@gmail.com> CC: Nam Cao <namcao@linutronix.de> CC: Wen Yang <wen.yang@linux.dev> CC: Tobias Schaffner <tobias.schaffner@siemens.com> CC: Viktor Malik <vmalik@redhat.com> CC: Peter Zijlstra <peterz@infradead.org> CC: John Ogness <john.ogness@linutronix.de> Hi Gabriele, kernel test robot noticed the following build errors: [auto build test ERROR on b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f] url: https://github.com/intel-lab-lkp/linux/commits/Gabriele-Monaco/sched-Add-task-enqueue-dequeue-trace-points/20261126-135947 base: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f patch link: https://lore.kernel.org/r/20261126130004.127155-6-gmonaco%40redhat.com patch subject: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs :::::: branch date: 5 days ago :::::: commit date: 5 days ago config: sparc64-randconfig-2000-20261201 (https://download.01.org/0day-ci/archive/20261201/20261201093802.iHcEQnfX-lkp@intel.com/config) compiler: sparc64-linux-gcc (GCC) 11.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261201/20261201093802.iHcEQnfX-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/r/20261201093802.iHcEQnfX-lkp@intel.com/ All errors (new ones prefixed by >>): sparc64-linux-ld: kernel/trace/rv/rv_bpf.o: in function `__do_trace_event_monitor': >> kernel/trace/rv/rv_trace.h:324:(.text+0xec): undefined reference to `__traceiter_event_monitor' sparc64-linux-ld: kernel/trace/rv/rv_bpf.o: in function `__do_trace_error_monitor': >> kernel/trace/rv/rv_trace.h:328:(.text+0x1c4): undefined reference to `__traceiter_error_monitor' >> sparc64-linux-ld: kernel/trace/rv/rv_bpf.o:(__jump_table+0x8): undefined reference to `__tracepoint_event_monitor' >> sparc64-linux-ld: kernel/trace/rv/rv_bpf.o:(__jump_table+0x14): undefined reference to `__tracepoint_error_monitor' vim +324 kernel/trace/rv/rv_trace.h 2cccfcaae412db5 Gabriele Monaco 2026-11-26 323 2cccfcaae412db5 Gabriele Monaco 2026-11-26 @324 DEFINE_EVENT(event_template_monitor, event_monitor, 2cccfcaae412db5 Gabriele Monaco 2026-11-26 325 TP_PROTO(const char *mon, const int *id, const char *msg), 2cccfcaae412db5 Gabriele Monaco 2026-11-26 326 TP_ARGS(mon, id, msg)); 2cccfcaae412db5 Gabriele Monaco 2026-11-26 327 2cccfcaae412db5 Gabriele Monaco 2026-11-26 @328 DEFINE_EVENT(event_template_monitor, error_monitor, 2cccfcaae412db5 Gabriele Monaco 2026-11-26 329 TP_PROTO(const char *mon, const int *id, const char *msg), 2cccfcaae412db5 Gabriele Monaco 2026-11-26 330 TP_ARGS(mon, id, msg)); 2cccfcaae412db5 Gabriele Monaco 2026-11-26 331 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v3 00/18] rv: Add support for BPF monitors @ 2026-11-26 12:59 Gabriele Monaco 2026-11-26 12:59 ` [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs Gabriele Monaco 0 siblings, 1 reply; 17+ messages in thread From: Gabriele Monaco @ 2026-11-26 12:59 UTC (permalink / raw) To: linux-kernel, linux-trace-kernel, bpf Cc: Gabriele Monaco, Steven Rostedt, Alexei Starovoitov, Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra, John Ogness Extend the rv userspace tool to load BPF monitors, those can be found in specific locations (e.g. /usr/share/rv/bpf_monitors/) and are plain object files including BTF data. This type of BPF monitors can be generated from rvgen using the -b flag just like in-kernel monitors and, after manual adaptation, can be built and run transparently by the rv userspace tool. Only DA monitors are supported (as they are the only class the rv tool currenly supports) and the tool aims to work in the same way for both in-kernel and BPF monitors. The da_monitor header is adapted to be included directly in BPF programs and share as much logic as possible. BPF monitors are implemented purely in BPF and as such require the rv userspace tool for any operation: * listing: find properly formatted objects in specific locations * running: load trace handlers for events * tracing: read event/errors from the ring buffer Selftests (make -C tools/verification/rv check) are present to validate and demonstrate the usage, which is mostly equivalent to the standard rv tool usage. Patch 1 adds tracepoints required in a later monitor example. Patch 2 improves the rv tool selftest reporting. Patches 3-5 prepare the kernel headers for BPF support. Patch 6 adds a feature check for tools/build. Patch 7-11 prepare and add support for BPF monitors in the rv tool. Patch 12-15 prepare and include BPF monitors examples. Patch 16 adds support for generating BPF monitors in rvgen. Patch 17-18 adds BPF selftests (make check) for the rv and rvgen tools. Changes since V2 [1]: * Use BPF_MAP_TYPE_TASK_STORAGE for per-task monitors. * Drop useless relocation removal in Makefile. * Avoid cast and propagate const to all tracepoints. * Validate monitor names before running. * Drop reactors for BPF monitors. * Use new generic tracepoints for BPF monitors and drop ringbuf. * Add -E/--errors-only option in the userspace tool. * Use an OFD lock to determine if monitors are enabled. Changes since RFC [2]: * Drop struct_ops integration to favour a BPF-only implementation. * Implement BPF reactors with a dynamic linker. * Don't pin programs and maps. * Improve handler performance when not tracing. [1] - https://lore.kernel.org/lkml/20261001152042.124445-1-gmonaco@redhat.com [2] - https://lore.kernel.org/lkml/20260831090524.106845-1-gmonaco@redhat.com To: linux-trace-kernel@vger.kernel.org To: bpf@vger.kernel.org Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com> Cc: Nam Cao <namcao@linutronix.de> Cc: Wen Yang <wen.yang@linux.dev> Cc: Tobias Schaffner <tobias.schaffner@siemens.com> Cc: Viktor Malik <vmalik@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: John Ogness <john.ogness@linutronix.de> Gabriele Monaco (17): tools/rv: Skip empty pid error in selftest if command failed rv: Add wrapper macros for monitor tracepoint definitions rv: Propagate const to model strings and tracepoints rv: Add generic monitor event tracepoints and BPF kfuncs tools/build: Add a feature test for bpftool-btf tools/rv: Move argument parsing from in_kernel to utils tools/rv: Move monitor trace handling to trace.c tools/rv: Implement BPF monitor discovery and listing tools/rv: Implement BPF monitor loading and tracing tools/rv: Rework tracing to support generic events tools/rv: Copy stripped bpf_atomic.h from libarena tools/rv: Add BPF monitors tools/rv: Define CONFIG_X86_64 statically for BPF monitors tools/rv: Add -E/--errors-only option verification/rvgen: Add support for BPF monitors tools/rv: Add selftest for rv bpf monitors verification/rvgen: Add selftest for rvgen -b Nam Cao (1): sched: Add task enqueue/dequeue trace points Documentation/tools/rv/common_ikm.rst | 6 + include/rv/automata.h | 4 +- include/rv/da_monitor.h | 33 +- include/rv/ha_monitor.h | 10 +- include/trace/events/sched.h | 8 + kernel/sched/core.c | 12 +- kernel/sched/sched.h | 2 + kernel/trace/rv/Makefile | 1 + kernel/trace/rv/monitors/nomiss/nomiss.h | 6 +- .../trace/rv/monitors/nomiss/nomiss_trace.h | 14 +- kernel/trace/rv/monitors/nrp/nrp.h | 4 +- kernel/trace/rv/monitors/nrp/nrp_trace.h | 9 +- kernel/trace/rv/monitors/opid/opid.h | 6 +- kernel/trace/rv/monitors/opid/opid_trace.h | 14 +- .../rv/monitors/pagefault/pagefault_trace.h | 8 +- kernel/trace/rv/monitors/sco/sco.h | 4 +- kernel/trace/rv/monitors/sco/sco_trace.h | 9 +- kernel/trace/rv/monitors/scpd/scpd.h | 4 +- kernel/trace/rv/monitors/scpd/scpd_trace.h | 9 +- kernel/trace/rv/monitors/sleep/sleep_trace.h | 8 +- kernel/trace/rv/monitors/snep/snep.h | 4 +- kernel/trace/rv/monitors/snep/snep_trace.h | 9 +- kernel/trace/rv/monitors/snroc/snroc.h | 4 +- kernel/trace/rv/monitors/snroc/snroc_trace.h | 9 +- kernel/trace/rv/monitors/sssw/sssw.h | 4 +- kernel/trace/rv/monitors/sssw/sssw_trace.h | 9 +- kernel/trace/rv/monitors/stall/stall.h | 6 +- kernel/trace/rv/monitors/stall/stall_trace.h | 14 +- kernel/trace/rv/monitors/sts/sts.h | 4 +- kernel/trace/rv/monitors/sts/sts_trace.h | 9 +- .../trace/rv/monitors/wakeup/wakeup_trace.h | 8 +- kernel/trace/rv/monitors/wip/wip.h | 4 +- kernel/trace/rv/monitors/wip/wip_trace.h | 9 +- kernel/trace/rv/monitors/wwnr/wwnr.h | 4 +- kernel/trace/rv/monitors/wwnr/wwnr_trace.h | 9 +- kernel/trace/rv/rv_bpf.c | 76 ++ kernel/trace/rv/rv_reactors.c | 2 +- kernel/trace/rv/rv_trace.h | 100 ++- tools/build/Makefile.feature | 1 + tools/build/feature/Makefile | 7 +- tools/verification/models/nohz.dot | 16 + tools/verification/models/tqueue.dot | 15 + tools/verification/rv/Makefile | 45 +- tools/verification/rv/Makefile.config | 49 ++ tools/verification/rv/Makefile.rv | 5 + tools/verification/rv/bpf_monitors/.gitignore | 2 + .../verification/rv/bpf_monitors/bpf_atomic.h | 125 +++ .../rv/bpf_monitors/da_monitor_bpf.h | 423 ++++++++++ tools/verification/rv/bpf_monitors/nohz.c | 42 + tools/verification/rv/bpf_monitors/nohz.h | 49 ++ tools/verification/rv/bpf_monitors/tqueue.c | 28 + tools/verification/rv/bpf_monitors/tqueue.h | 47 ++ tools/verification/rv/include/bpf_monitor.h | 20 + tools/verification/rv/include/trace.h | 4 +- tools/verification/rv/include/utils.h | 19 +- tools/verification/rv/src/Build | 5 + tools/verification/rv/src/bpf_monitor.c | 738 ++++++++++++++++++ tools/verification/rv/src/in_kernel.c | 439 +---------- tools/verification/rv/src/rv.c | 5 + tools/verification/rv/src/trace.c | 237 +++++- tools/verification/rv/src/utils.c | 103 ++- tools/verification/rv/tests/rv_list.t | 6 +- tools/verification/rv/tests/rv_mon.t | 80 +- tools/verification/rvgen/__main__.py | 15 +- tools/verification/rvgen/rvgen/dot2c.py | 15 +- tools/verification/rvgen/rvgen/dot2k.py | 50 +- tools/verification/rvgen/rvgen/generator.py | 40 +- .../rvgen/rvgen/templates/dot2k/main_bpf.c | 21 + .../rvgen/rvgen/templates/dot2k/trace.h | 7 +- .../rvgen/templates/dot2k/trace_hybrid.h | 11 +- .../rvgen/rvgen/templates/ltl2k/trace.h | 8 +- .../tests/golden/da_bpf_cpu/da_bpf_cpu.c | 35 + .../tests/golden/da_bpf_cpu/da_bpf_cpu.h | 47 ++ .../tests/golden/da_bpf_obj/da_bpf_obj.c | 49 ++ .../tests/golden/da_bpf_obj/da_bpf_obj.h | 47 ++ .../rvgen/tests/golden/da_global/da_global.h | 4 +- .../tests/golden/da_global/da_global_trace.h | 9 +- .../da_perobj_parent/da_perobj_parent.h | 4 +- .../da_perobj_parent/da_perobj_parent_trace.h | 9 +- .../golden/da_pertask_desc/da_pertask_desc.h | 4 +- .../da_pertask_desc/da_pertask_desc_trace.h | 9 +- .../rvgen/tests/golden/ha_percpu/ha_percpu.h | 6 +- .../tests/golden/ha_percpu/ha_percpu_trace.h | 14 +- .../golden/ltl_pertask/ltl_pertask_trace.h | 8 +- .../test_bak_kunit/test_bak_kunit_trace.h | 8 +- .../rvgen/tests/golden/test_da/test_da.h | 4 +- .../tests/golden/test_da/test_da_trace.h | 9 +- .../golden/test_da_kunit/test_da_kunit.h | 4 +- .../test_da_kunit/test_da_kunit_trace.h | 9 +- .../rvgen/tests/golden/test_ha/test_ha.h | 6 +- .../tests/golden/test_ha/test_ha_trace.h | 14 +- .../golden/test_ha_kunit/test_ha_kunit.h | 6 +- .../test_ha_kunit/test_ha_kunit_trace.h | 14 +- .../tests/golden/test_ltl/test_ltl_trace.h | 8 +- .../test_ltl_kunit/test_ltl_kunit_trace.h | 8 +- .../verification/rvgen/tests/rvgen_monitor.t | 11 + tools/verification/tests/engine.sh | 5 +- 97 files changed, 2674 insertions(+), 809 deletions(-) create mode 100644 kernel/trace/rv/rv_bpf.c create mode 100644 tools/verification/models/nohz.dot create mode 100644 tools/verification/models/tqueue.dot create mode 100644 tools/verification/rv/bpf_monitors/.gitignore create mode 100644 tools/verification/rv/bpf_monitors/bpf_atomic.h create mode 100644 tools/verification/rv/bpf_monitors/da_monitor_bpf.h create mode 100644 tools/verification/rv/bpf_monitors/nohz.c create mode 100644 tools/verification/rv/bpf_monitors/nohz.h create mode 100644 tools/verification/rv/bpf_monitors/tqueue.c create mode 100644 tools/verification/rv/bpf_monitors/tqueue.h create mode 100644 tools/verification/rv/include/bpf_monitor.h create mode 100644 tools/verification/rv/src/bpf_monitor.c create mode 100644 tools/verification/rvgen/rvgen/templates/dot2k/main_bpf.c create mode 100644 tools/verification/rvgen/tests/golden/da_bpf_cpu/da_bpf_cpu.c create mode 100644 tools/verification/rvgen/tests/golden/da_bpf_cpu/da_bpf_cpu.h create mode 100644 tools/verification/rvgen/tests/golden/da_bpf_obj/da_bpf_obj.c create mode 100644 tools/verification/rvgen/tests/golden/da_bpf_obj/da_bpf_obj.h base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f -- 2.56.1 ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-11-26 12:59 [PATCH v3 00/18] rv: Add support for BPF monitors Gabriele Monaco @ 2026-11-26 12:59 ` Gabriele Monaco 2026-11-26 13:24 ` sashiko-bot ` (4 more replies) 0 siblings, 5 replies; 17+ messages in thread From: Gabriele Monaco @ 2026-11-26 12:59 UTC (permalink / raw) To: linux-kernel, linux-trace-kernel, bpf, Steven Rostedt, Gabriele Monaco, Masami Hiramatsu Cc: Alexei Starovoitov, Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra, John Ogness Add event_monitor and error_monitor tracepoints, carrying a monitor name and a single formatted message. These tracepoints aim to replace the per-monitor tracepoints for a set of monitors (now BPF only) and are generic enough to allow reporting from different monitor classes. Add also bpf_rv_event_monitor() / bpf_rv_error_monitor() kfuncs wrapping them, so BPF monitors can emit similar events to in-kernel monitors. Userspace callers need now to use ftrace filters to get the right events but events and errors are separate channels to ease the most common filtering and account for dramatically different volume (errors are rare). Signed-off-by: Gabriele Monaco <gmonaco@redhat.com> --- kernel/trace/rv/Makefile | 1 + kernel/trace/rv/rv_bpf.c | 76 ++++++++++++++++++++++++++++++++++++++ kernel/trace/rv/rv_trace.h | 37 +++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 kernel/trace/rv/rv_bpf.c diff --git a/kernel/trace/rv/Makefile b/kernel/trace/rv/Makefile index c895d81dfdad..588250ce3fa9 100644 --- a/kernel/trace/rv/Makefile +++ b/kernel/trace/rv/Makefile @@ -3,6 +3,7 @@ ccflags-y += -I $(src) # needed for trace events obj-$(CONFIG_RV) += rv.o +obj-$(CONFIG_RV) += rv_bpf.o obj-$(CONFIG_RV_MON_WIP) += monitors/wip/wip.o obj-$(CONFIG_RV_MON_WWNR) += monitors/wwnr/wwnr.o obj-$(CONFIG_RV_MON_SCHED) += monitors/sched/sched.o diff --git a/kernel/trace/rv/rv_bpf.c b/kernel/trace/rv/rv_bpf.c new file mode 100644 index 000000000000..f39f33335c71 --- /dev/null +++ b/kernel/trace/rv/rv_bpf.c @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * BPF kfuncs for Runtime Verification (RV) + */ + +#include <linux/init.h> +#include <linux/bpf.h> +#include <linux/btf.h> +#include <linux/btf_ids.h> +#include <rv_trace.h> + +__bpf_kfunc_start_defs(); + +/** + * bpf_rv_event_monitor - emit an RV monitor event tracepoint + * + * @msg must be NULL-terminated, drop the event if it isn't. This happens by + * construction if using snprintf-like functions and passing the right @msg__sz + * to both. + * + * @mon__str: name of the monitor + * @msg: message string + * @msg__sz: message string size + * + * Return -EINVAL if @msg is not NULL-terminated, 0 otherwise. + */ +__bpf_kfunc int bpf_rv_event_monitor(const char *mon__str, const int *id__nullable, + const char *msg, u32 msg__sz) +{ + if (strnlen(msg, msg__sz) == msg__sz) + return -EINVAL; + + trace_event_monitor(mon__str, id__nullable, msg); + return 0; +} + +/** + * bpf_rv_error_monitor - emit an RV monitor error tracepoint + * + * @msg must be NULL-terminated, drop the event if it isn't. This happens by + * construction if using snprintf-like functions and passing the right @msg__sz + * to both. + * + * @mon__str: name of the monitor + * @msg: message string + * @msg__sz: message string size + * + * Return -EINVAL if @msg is not NULL-terminated, 0 otherwise. + */ +__bpf_kfunc int bpf_rv_error_monitor(const char *mon__str, const int *id__nullable, + const char *msg, u32 msg__sz) +{ + if (strnlen(msg, msg__sz) == msg__sz) + return -EINVAL; + + trace_error_monitor(mon__str, id__nullable, msg); + return 0; +} + +__bpf_kfunc_end_defs(); + +BTF_KFUNCS_START(bpf_rv_kfunc_ids) +BTF_ID_FLAGS(func, bpf_rv_event_monitor) +BTF_ID_FLAGS(func, bpf_rv_error_monitor) +BTF_KFUNCS_END(bpf_rv_kfunc_ids) + +static const struct btf_kfunc_id_set bpf_rv_kfunc_set = { + .owner = THIS_MODULE, + .set = &bpf_rv_kfunc_ids, +}; + +static int __init bpf_rv_kfunc_init(void) +{ + return register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &bpf_rv_kfunc_set); +} +late_initcall(bpf_rv_kfunc_init); diff --git a/kernel/trace/rv/rv_trace.h b/kernel/trace/rv/rv_trace.h index 24d4b94a54a5..9fa9e1230e84 100644 --- a/kernel/trace/rv/rv_trace.h +++ b/kernel/trace/rv/rv_trace.h @@ -292,6 +292,43 @@ DECLARE_EVENT_CLASS(error_ltl_monitor_id, // Add new monitors based on CONFIG_LTL_MON_EVENTS_ID here #endif /* CONFIG_LTL_MON_EVENTS_ID */ +DECLARE_EVENT_CLASS(event_template_monitor, + + TP_PROTO(const char *mon, const int *id, const char *msg), + + TP_ARGS(mon, id, msg), + + TP_STRUCT__entry( + __string( mon, mon ) + __field( u8, has_id ) + __field( int, id ) + __string( msg, msg ) + ), + + TP_fast_assign( + __assign_str(mon); + __entry->has_id = !!id; + __entry->id = id ? *id : 0; + __assign_str(msg); + ), + + /* + * The id is used only for filters, if it is of interest in the format, + * callers should pass it to the msg too. + */ + TP_printk("%s: %s", + __get_str(mon), + __get_str(msg)) +); + +DEFINE_EVENT(event_template_monitor, event_monitor, + TP_PROTO(const char *mon, const int *id, const char *msg), + TP_ARGS(mon, id, msg)); + +DEFINE_EVENT(event_template_monitor, error_monitor, + TP_PROTO(const char *mon, const int *id, const char *msg), + TP_ARGS(mon, id, msg)); + #ifdef CONFIG_RV_MON_MAINTENANCE_EVENTS /* Tracepoint useful for monitors development, currenly only used in DA */ TRACE_EVENT(rv_retries_error, -- 2.56.1 ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-11-26 12:59 ` [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs Gabriele Monaco @ 2026-11-26 13:24 ` sashiko-bot 2026-11-26 22:09 ` kernel test robot ` (3 subsequent siblings) 4 siblings, 0 replies; 17+ messages in thread From: sashiko-bot @ 2026-11-26 13:24 UTC (permalink / raw) To: Gabriele Monaco, linux-trace-kernel, bpf Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] rv: undefined tracepoint symbols when CONFIG_RV_MON_EVENTS is unset - [Medium] rv: TOCTOU unbounded strlen() after strnlen() in bpf_rv_*_monitor() - [Low] rv: missing @id__nullable kernel-doc description in rv_bpf.c -- commit 12ad0d7960250beaac1afe9380fabf830419122f Author: Gabriele Monaco <gmonaco@redhat.com> rv: Add generic monitor event tracepoints and BPF kfuncs This commit adds generic event_monitor and error_monitor tracepoints along with bpf_rv_event_monitor() and bpf_rv_error_monitor() BPF kfuncs so BPF monitors can emit RV events and errors. > diff --git a/kernel/trace/rv/Makefile b/kernel/trace/rv/Makefile > index c895d81dfdad9..588250ce3fa93 100644 > --- a/kernel/trace/rv/Makefile > +++ b/kernel/trace/rv/Makefile > @@ -3,6 +3,7 @@ > ccflags-y += -I $(src) # needed for trace events > > obj-$(CONFIG_RV) += rv.o > +obj-$(CONFIG_RV) += rv_bpf.o > obj-$(CONFIG_RV_MON_WIP) += monitors/wip/wip.o > obj-$(CONFIG_RV_MON_WWNR) += monitors/wwnr/wwnr.o > obj-$(CONFIG_RV_MON_SCHED) += monitors/sched/sched.o [Severity: Medium] Does this fail to link when CONFIG_RV=y is enabled without any in-kernel C monitor? rv_bpf.o is built whenever CONFIG_RV is set and calls trace_event_monitor() and trace_error_monitor(), but CREATE_TRACE_POINTS in kernel/trace/rv/rv.c is only defined under CONFIG_RV_MON_EVENTS: kernel/trace/rv/rv.c: #ifdef CONFIG_RV_MON_EVENTS #define CREATE_TRACE_POINTS #include <rv_trace.h> #endif CONFIG_RV_MON_EVENTS is only selected by the in-kernel C monitor options (all of which default to n), so a BPF-only RV build leaves __tracepoint_event_monitor, __tracepoint_error_monitor, and their static call symbols undefined at link time. > diff --git a/kernel/trace/rv/rv_bpf.c b/kernel/trace/rv/rv_bpf.c > new file mode 100644 > index 0000000000000..f39f33335c71b > --- /dev/null > +++ b/kernel/trace/rv/rv_bpf.c > @@ -0,0 +1,76 @@ [ ... ] > +/** > + * bpf_rv_event_monitor - emit an RV monitor event tracepoint > + * > + * @msg must be NULL-terminated, drop the event if it isn't. This happens by > + * construction if using snprintf-like functions and passing the right @msg__sz > + * to both. > + * > + * @mon__str: name of the monitor > + * @msg: message string > + * @msg__sz: message string size > + * > + * Return -EINVAL if @msg is not NULL-terminated, 0 otherwise. > + */ > +__bpf_kfunc int bpf_rv_event_monitor(const char *mon__str, const int *id__nullable, > + const char *msg, u32 msg__sz) [Severity: Low] Both bpf_rv_event_monitor() and bpf_rv_error_monitor() use kernel-doc comments but omit @id__nullable, which triggers kernel-doc warnings under W=1 builds. > +{ > + if (strnlen(msg, msg__sz) == msg__sz) > + return -EINVAL; > + > + trace_event_monitor(mon__str, id__nullable, msg); > + return 0; > +} > + > +/** > + * bpf_rv_error_monitor - emit an RV monitor error tracepoint > + * > + * @msg must be NULL-terminated, drop the event if it isn't. This happens by > + * construction if using snprintf-like functions and passing the right @msg__sz > + * to both. > + * > + * @mon__str: name of the monitor > + * @msg: message string > + * @msg__sz: message string size > + * > + * Return -EINVAL if @msg is not NULL-terminated, 0 otherwise. > + */ > +__bpf_kfunc int bpf_rv_error_monitor(const char *mon__str, const int *id__nullable, > + const char *msg, u32 msg__sz) > +{ > + if (strnlen(msg, msg__sz) == msg__sz) > + return -EINVAL; > + > + trace_error_monitor(mon__str, id__nullable, msg); > + return 0; > +} [Severity: Medium] Can a concurrent update to msg after strnlen() cause trace_event_monitor() or trace_error_monitor() to read past msg + msg__sz? For the (const char *msg, u32 msg__sz) kfunc argument pair, the BPF verifier accepts any writable BPF memory region of size msg__sz, including shared BPF map values. event_template_monitor uses __string(msg, msg), which runs an unbounded strlen(msg) and memcpy() after strnlen() has already returned: CPU0 CPU1 bpf_rv_event_monitor(mon, id, msg, msg__sz) strnlen(msg, msg__sz) < msg__sz /* overwrites NUL byte in shared * BPF map value backing msg */ trace_event_monitor(mon, id, msg) strlen(msg) memcpy(..., msg, ...) <-- out-of-bounds read past msg__sz Reading past the end of a BPF map allocation can fault on an unmapped vmalloc guard page or copy adjacent kernel memory into the trace ring buffer. Passing the length returned by strnlen() into the tracepoint and using __string_len() in event_template_monitor would bound the copy without re-scanning msg. -- Sashiko AI review · https://sashiko.dev/#/patchset/20261126130004.127155-1-gmonaco@redhat.com?part=5 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-11-26 12:59 ` [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs Gabriele Monaco 2026-11-26 13:24 ` sashiko-bot @ 2026-11-26 22:09 ` kernel test robot 2026-11-27 23:33 ` Alexei Starovoitov ` (2 subsequent siblings) 4 siblings, 0 replies; 17+ messages in thread From: kernel test robot @ 2026-11-26 22:09 UTC (permalink / raw) To: Gabriele Monaco, linux-kernel, linux-trace-kernel, bpf, Steven Rostedt, Masami Hiramatsu Cc: oe-kbuild-all, Alexei Starovoitov, Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra, John Ogness Hi Gabriele, kernel test robot noticed the following build warnings: [auto build test WARNING on b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f] url: https://github.com/intel-lab-lkp/linux/commits/Gabriele-Monaco/sched-Add-task-enqueue-dequeue-trace-points/20261126-135947 base: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f patch link: https://lore.kernel.org/r/20261126130004.127155-6-gmonaco%40redhat.com patch subject: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs config: loongarch-randconfig-1000-20261127 (https://download.01.org/0day-ci/archive/20261127/20261127053433.PIs3CD9x-lkp@intel.com/config) compiler: loongarch64-linux-gcc (GCC) 16.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261127/20261127053433.PIs3CD9x-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/20261127053433.PIs3CD9x-lkp@intel.com/ All warnings (new ones prefixed by >>): >> Warning: kernel/trace/rv/rv_bpf.c:28 function parameter 'id__nullable' not described in 'bpf_rv_event_monitor' >> Warning: kernel/trace/rv/rv_bpf.c:51 function parameter 'id__nullable' not described in 'bpf_rv_error_monitor' >> Warning: kernel/trace/rv/rv_bpf.c:28 function parameter 'id__nullable' not described in 'bpf_rv_event_monitor' >> Warning: kernel/trace/rv/rv_bpf.c:51 function parameter 'id__nullable' not described in 'bpf_rv_error_monitor' -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-11-26 12:59 ` [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs Gabriele Monaco 2026-11-26 13:24 ` sashiko-bot 2026-11-26 22:09 ` kernel test robot @ 2026-11-27 23:33 ` Alexei Starovoitov 2026-11-30 10:56 ` Gabriele Monaco 2026-11-29 15:15 ` kernel test robot 2026-11-30 7:03 ` kernel test robot 4 siblings, 1 reply; 17+ messages in thread From: Alexei Starovoitov @ 2026-11-27 23:33 UTC (permalink / raw) To: Gabriele Monaco, linux-kernel, linux-trace-kernel, bpf, Steven Rostedt, Masami Hiramatsu Cc: Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra, John Ogness On Thu, Nov 26, 2026 at 04:59 AM Gabriele Monaco <gmonaco@redhat.com> wrote: > Add also bpf_rv_event_monitor() / bpf_rv_error_monitor() kfuncs wrapping > them, so BPF monitors can emit similar events to in-kernel monitors. > > Userspace callers need now to use ftrace filters to get the right events > but events and errors are separate channels to ease the most common > filtering and account for dramatically different volume (errors are > rare). I thought we agreed that plain bpf_printk() works with glob filtering on top. Why do you need these new kfuncs? See below diff that illustrates the point. > + if (strnlen(msg, msg__sz) == msg__sz) > + return -EINVAL; > + > + trace_event_monitor(mon__str, id__nullable, msg); This will read out of bounds. msg can point to a map value. Take a BPF_F_MMAPABLE array with one page size value. NUL is the last byte: prog user space strnlen(msg, msg__sz) finds the NUL writes 'x' over the NUL __string(msg, msg) -> strlen(msg) runs into the vmalloc guard page There is no limit on msg__sz either. When perf is on the event, a msg above 8192 bytes hits WARN_ONCE() in perf_trace_buf_alloc(). diff --git a/tools/verification/rv/bpf_monitors/da_monitor_bpf.h b/tools/verification/rv/bpf_monitors/da_monitor_bpf.h index e9e673c..6996c01 100644 --- a/tools/verification/rv/bpf_monitors/da_monitor_bpf.h +++ b/tools/verification/rv/bpf_monitors/da_monitor_bpf.h @@ -24,8 +24,6 @@ #define da_implicit_guard() #define IS_ENABLED(conf) 0 -#define DA_TRACE_MSG_MAX 128 - /* * Also used to filter out events higher values imply lower ones. * Userspace will parse this enum but expects EVENT to imply ERROR(s) and ERROR @@ -328,10 +326,9 @@ static inline void da_reset_bpf(da_id_type id, monitor_target_bpf target) #endif /* RV_MON_TYPE */ -extern int bpf_rv_event_monitor(const char *mon, const int *id__nullable, - const char *msg, u32 msg__sz) __ksym; -extern int bpf_rv_error_monitor(const char *mon, const int *id__nullable, - const char *msg, u32 msg__sz) __ksym; +/* "rv: <type>: <monitor>: <text>" in bpf_trace:bpf_trace_printk */ +#define rv_printk(type, fmt, ...) \ + bpf_printk("rv: " type ": " __stringify(MONITOR_NAME) ": " fmt, __VA_ARGS__) #if RV_MON_TYPE == RV_MON_GLOBAL || RV_MON_TYPE == RV_MON_PER_CPU /* @@ -345,28 +342,22 @@ static inline void da_trace_event(struct da_monitor *da_mon, const char *next_state, bool is_final, da_id_type id) { - char msg[DA_TRACE_MSG_MAX]; - if (trace_level < RV_TRACE_EVENT) return; - BPF_SNPRINTF(msg, sizeof(msg), "%s x %s -> %s%s", - curr_state, event, next_state, is_final ? " (final)" : ""); - bpf_rv_event_monitor(__stringify(MONITOR_NAME), NULL, msg, sizeof(msg)); + rv_printk("event", "%s x %s -> %s%s", + curr_state, event, next_state, is_final ? " (final)" : ""); } static inline void da_trace_error(struct da_monitor *da_mon, const char *curr_state, const char *event, da_id_type id) { - char msg[DA_TRACE_MSG_MAX]; - if (trace_level < RV_TRACE_ERROR) return; - BPF_SNPRINTF(msg, sizeof(msg), "event %s not expected in the state %s", - event, curr_state); - bpf_rv_error_monitor(__stringify(MONITOR_NAME), NULL, msg, sizeof(msg)); + rv_printk("error", "event %s not expected in the state %s", + event, curr_state); } #elif RV_MON_TYPE == RV_MON_PER_TASK || RV_MON_TYPE == RV_MON_PER_OBJ @@ -379,28 +370,22 @@ static inline void da_trace_event(struct da_monitor *da_mon, const char *next_state, bool is_final, da_id_type id) { - char msg[DA_TRACE_MSG_MAX]; - if (trace_level < RV_TRACE_EVENT) return; - BPF_SNPRINTF(msg, sizeof(msg), "%d: %s x %s -> %s%s", id, - curr_state, event, next_state, is_final ? " (final)" : ""); - bpf_rv_event_monitor(__stringify(MONITOR_NAME), &id, msg, sizeof(msg)); + rv_printk("event", "%d: %s x %s -> %s%s", id, + curr_state, event, next_state, is_final ? " (final)" : ""); } static inline void da_trace_error(struct da_monitor *da_mon, const char *curr_state, const char *event, da_id_type id) { - char msg[DA_TRACE_MSG_MAX]; - if (trace_level < RV_TRACE_ERROR) return; - BPF_SNPRINTF(msg, sizeof(msg), "%d: event %s not expected in the state %s", - id, event, curr_state); - bpf_rv_error_monitor(__stringify(MONITOR_NAME), &id, msg, sizeof(msg)); + rv_printk("error", "%d: event %s not expected in the state %s", + id, event, curr_state); } #endif /* RV_MON_TYPE */ diff --git a/tools/verification/rv/src/trace.c b/tools/verification/rv/src/trace.c index 629b4f6..91f86bf 100644 --- a/tools/verification/rv/src/trace.c +++ b/tools/verification/rv/src/trace.c @@ -15,7 +15,7 @@ #include <trace.h> #include <utils.h> -#define FILTER_MAX 128 +#define FILTER_MAX 256 /** * collect_registered_events - print an event collected from the trace buffer @@ -176,20 +176,25 @@ static int enable_specific_event(struct trace_instance *inst, const char *event_ } /* - * enable_generic_event - enable a generic event with filters + * enable_bpf_events - collect the messages of a BPF monitor + * + * BPF monitors report via bpf_printk("rv: <event|error>: <monitor>: ..."). + * + * Returns 0 on success, -1 otherwise. */ -static int enable_generic_event(struct trace_instance *inst, const char *event_name, char *name) +static int enable_bpf_events(struct trace_instance *inst, char *name) { - struct tep_event *tevent = tep_find_event_by_name(inst->tep, "rv", event_name); + struct tep_event *tevent; char filter[FILTER_MAX] = ""; size_t len; + tevent = tep_find_event_by_name(inst->tep, "bpf_trace", "bpf_trace_printk"); if (!tevent) { - err_msg("trace: fail finding the rv:%s event\n", event_name); + err_msg("trace: fail finding the bpf_trace_printk event\n"); return -1; } - len = snprintf(filter, sizeof(filter), "mon == \"%s\"", name); + len = snprintf(filter, sizeof(filter), "bpf_string ~ \"rv: *: %s: *\"", name); if (len >= sizeof(filter)) { err_msg("trace: monitor name %s too long\n", name); return -1; @@ -197,31 +202,12 @@ static int enable_generic_event(struct trace_instance *inst, const char *event_n if (config.my_pid > 0) snprintf(filter + len, sizeof(filter) - len, - " && common_pid != %d && !(has_id == 1 && id == %d)", - config.my_pid, config.my_pid); + " && common_pid != %d && !(bpf_string ~ \"rv: *: %s: %d: *\")", + config.my_pid, name, config.my_pid); return apply_filter_enable(inst, tevent, filter); } -/* - * enable_bpf_events - enable rv:event_monitor and rv:error_monitor for a monitor - * - * BPF monitors report via generic rv:event_monitor and rv:error_monitor events. - * Enable the events and filter them to only collect the messages of the given monitor. - * - * Returns 0 on success, -1 otherwise. - */ -static int enable_bpf_events(struct trace_instance *inst, char *name) -{ - if (!config.trace_errors_only && enable_generic_event(inst, "event_monitor", name)) - return -1; - - if (enable_generic_event(inst, "error_monitor", name)) - return -1; - - return 0; -} - /** * trace_enable_monitor_events - enable a monitor's events in a trace instance * diff --git a/tools/verification/rv/tests/rv_mon.t b/tools/verification/rv/tests/rv_mon.t index 30d1dda..f51f194 100644 --- a/tools/verification/rv/tests/rv_mon.t +++ b/tools/verification/rv/tests/rv_mon.t @@ -104,16 +104,16 @@ cpu="\[[0-9]\{3\}\][[:space:]]\+" state="[a-z_]\+ " id="[0-9]\+" selfid="\$pid" -# BPF monitors report via the common rv:event_monitor/rv:error_monitor -# events, which add a "<mon>: " prefix to the message. +# BPF monitors report via bpf_printk() +type_bpf="bpf_trace_printk: rv: \(event\|error\)" trace_task="${genpid}${cpu}${type}: ${id}: ${state}" trace_task_self="${genpid}${cpu}${type}: ${selfid}: ${state}" trace_cpu="${genpid}${cpu}${type}: ${state}" trace_cpu_self="${selfpid}${cpu}${type}: ${state}" -trace_task_bpf="${genpid}${cpu}${type}: ${mon}: ${id}: ${state}" -trace_task_bpf_self="${genpid}${cpu}${type}: ${mon}: ${selfid}: ${state}" -trace_cpu_bpf="${genpid}${cpu}${type}: ${mon}: ${state}" -trace_cpu_bpf_self="${selfpid}${cpu}${type}: ${mon}: ${state}" +trace_task_bpf="${genpid}${cpu}${type_bpf}: ${mon}: ${id}: ${state}" +trace_task_bpf_self="${genpid}${cpu}${type_bpf}: ${mon}: ${selfid}: ${state}" +trace_cpu_bpf="${genpid}${cpu}${type_bpf}: ${mon}: ${state}" +trace_cpu_bpf_self="${selfpid}${cpu}${type_bpf}: ${mon}: ${state}" check_if_exists "run per-task monitor with tracing" \ "$RV mon sssw -t" "$RVDIR/monitors/sched/sssw" \ @@ -154,10 +154,10 @@ check_if_exists "run per-task monitor tracing only errors" \ check_if_exists "run per-task BPF monitor tracing only errors" \ "$RV mon tqueue -t -E" "$RVTOOL/bpf_monitors/tqueue.o" \ - "$header" "event_monitor" + "$header" "rv: event" check_if_exists "run per-cpu BPF monitor tracing only errors" \ "$RV mon nohz -t -E" "$RVTOOL/bpf_monitors/nohz.o" \ - "error_monitor" "event_monitor" + "rv: error" "rv: event" test_end ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-11-27 23:33 ` Alexei Starovoitov @ 2026-11-30 10:56 ` Gabriele Monaco 2026-12-01 5:06 ` Alexei Starovoitov 0 siblings, 1 reply; 17+ messages in thread From: Gabriele Monaco @ 2026-11-30 10:56 UTC (permalink / raw) To: Alexei Starovoitov, linux-kernel, linux-trace-kernel, bpf, Steven Rostedt, Masami Hiramatsu Cc: Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra, John Ogness On Fri, 2026-11-27 at 23:33 +0000, Alexei Starovoitov wrote: > On Thu, Nov 26, 2026 at 04:59 AM Gabriele Monaco <gmonaco@redhat.com> wrote: > > Add also bpf_rv_event_monitor() / bpf_rv_error_monitor() kfuncs wrapping > > them, so BPF monitors can emit similar events to in-kernel monitors. > > > > Userspace callers need now to use ftrace filters to get the right events > > but events and errors are separate channels to ease the most common > > filtering and account for dramatically different volume (errors are > > rare). > > I thought we agreed that plain bpf_printk() works with glob filtering on top. > Why do you need these new kfuncs? > See below diff that illustrates the point. Thanks for the diff. I tried this alternative as it offers separate channels for events, errors and standard bpf_printk users. 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. Other ergonomics advantages are actually minor, though. I would have liked structured fields but it gets unnecessarily complicated. If the amount of messages isn't an issue on the standard bpf_printk, we can just use that, users are going to need to parse strings either ways. Thanks, Gabriele > > > + if (strnlen(msg, msg__sz) == msg__sz) > > + return -EINVAL; > > + > > + trace_event_monitor(mon__str, id__nullable, msg); > > This will read out of bounds. msg can point to a map value. > Take a BPF_F_MMAPABLE array with one page size value. NUL is the last byte: > > prog user space > strnlen(msg, msg__sz) finds the NUL > writes 'x' over the NUL > __string(msg, msg) -> strlen(msg) > runs into the vmalloc guard page > > There is no limit on msg__sz either. > When perf is on the event, a msg above 8192 bytes hits WARN_ONCE() in > perf_trace_buf_alloc(). > > > diff --git a/tools/verification/rv/bpf_monitors/da_monitor_bpf.h > b/tools/verification/rv/bpf_monitors/da_monitor_bpf.h > index e9e673c..6996c01 100644 > --- a/tools/verification/rv/bpf_monitors/da_monitor_bpf.h > +++ b/tools/verification/rv/bpf_monitors/da_monitor_bpf.h > @@ -24,8 +24,6 @@ > #define da_implicit_guard() > #define IS_ENABLED(conf) 0 > > -#define DA_TRACE_MSG_MAX 128 > - > /* > * Also used to filter out events higher values imply lower ones. > * Userspace will parse this enum but expects EVENT to imply ERROR(s) and > ERROR > @@ -328,10 +326,9 @@ static inline void da_reset_bpf(da_id_type id, > monitor_target_bpf target) > > #endif /* RV_MON_TYPE */ > > -extern int bpf_rv_event_monitor(const char *mon, const int *id__nullable, > - const char *msg, u32 msg__sz) __ksym; > -extern int bpf_rv_error_monitor(const char *mon, const int *id__nullable, > - const char *msg, u32 msg__sz) __ksym; > +/* "rv: <type>: <monitor>: <text>" in bpf_trace:bpf_trace_printk */ > +#define rv_printk(type, fmt, ...) \ > + bpf_printk("rv: " type ": " __stringify(MONITOR_NAME) ": " fmt, > __VA_ARGS__) > > #if RV_MON_TYPE == RV_MON_GLOBAL || RV_MON_TYPE == RV_MON_PER_CPU > /* > @@ -345,28 +342,22 @@ static inline void da_trace_event(struct da_monitor > *da_mon, > const char *next_state, bool is_final, > da_id_type id) > { > - char msg[DA_TRACE_MSG_MAX]; > - > if (trace_level < RV_TRACE_EVENT) > return; > > - BPF_SNPRINTF(msg, sizeof(msg), "%s x %s -> %s%s", > - curr_state, event, next_state, is_final ? " (final)" : ""); > - bpf_rv_event_monitor(__stringify(MONITOR_NAME), NULL, msg, > sizeof(msg)); > + rv_printk("event", "%s x %s -> %s%s", > + curr_state, event, next_state, is_final ? " (final)" : ""); > } > > static inline void da_trace_error(struct da_monitor *da_mon, > const char *curr_state, const char *event, > da_id_type id) > { > - char msg[DA_TRACE_MSG_MAX]; > - > if (trace_level < RV_TRACE_ERROR) > return; > > - BPF_SNPRINTF(msg, sizeof(msg), "event %s not expected in the state > %s", > - event, curr_state); > - bpf_rv_error_monitor(__stringify(MONITOR_NAME), NULL, msg, > sizeof(msg)); > + rv_printk("error", "event %s not expected in the state %s", > + event, curr_state); > } > > #elif RV_MON_TYPE == RV_MON_PER_TASK || RV_MON_TYPE == RV_MON_PER_OBJ > @@ -379,28 +370,22 @@ static inline void da_trace_event(struct da_monitor > *da_mon, > const char *next_state, bool is_final, > da_id_type id) > { > - char msg[DA_TRACE_MSG_MAX]; > - > if (trace_level < RV_TRACE_EVENT) > return; > > - BPF_SNPRINTF(msg, sizeof(msg), "%d: %s x %s -> %s%s", id, > - curr_state, event, next_state, is_final ? " (final)" : ""); > - bpf_rv_event_monitor(__stringify(MONITOR_NAME), &id, msg, > sizeof(msg)); > + rv_printk("event", "%d: %s x %s -> %s%s", id, > + curr_state, event, next_state, is_final ? " (final)" : ""); > } > > static inline void da_trace_error(struct da_monitor *da_mon, > const char *curr_state, const char *event, > da_id_type id) > { > - char msg[DA_TRACE_MSG_MAX]; > - > if (trace_level < RV_TRACE_ERROR) > return; > > - BPF_SNPRINTF(msg, sizeof(msg), "%d: event %s not expected in the > state %s", > - id, event, curr_state); > - bpf_rv_error_monitor(__stringify(MONITOR_NAME), &id, msg, > sizeof(msg)); > + rv_printk("error", "%d: event %s not expected in the state %s", > + id, event, curr_state); > } > #endif /* RV_MON_TYPE */ > > diff --git a/tools/verification/rv/src/trace.c > b/tools/verification/rv/src/trace.c > index 629b4f6..91f86bf 100644 > --- a/tools/verification/rv/src/trace.c > +++ b/tools/verification/rv/src/trace.c > @@ -15,7 +15,7 @@ > #include <trace.h> > #include <utils.h> > > -#define FILTER_MAX 128 > +#define FILTER_MAX 256 > > /** > * collect_registered_events - print an event collected from the trace buffer > @@ -176,20 +176,25 @@ static int enable_specific_event(struct trace_instance > *inst, const char *event_ > } > > /* > - * enable_generic_event - enable a generic event with filters > + * enable_bpf_events - collect the messages of a BPF monitor > + * > + * BPF monitors report via bpf_printk("rv: <event|error>: <monitor>: ..."). > + * > + * Returns 0 on success, -1 otherwise. > */ > -static int enable_generic_event(struct trace_instance *inst, const char > *event_name, char *name) > +static int enable_bpf_events(struct trace_instance *inst, char *name) > { > - struct tep_event *tevent = tep_find_event_by_name(inst->tep, "rv", > event_name); > + struct tep_event *tevent; > char filter[FILTER_MAX] = ""; > size_t len; > > + tevent = tep_find_event_by_name(inst->tep, "bpf_trace", > "bpf_trace_printk"); > if (!tevent) { > - err_msg("trace: fail finding the rv:%s event\n", event_name); > + err_msg("trace: fail finding the bpf_trace_printk event\n"); > return -1; > } > > - len = snprintf(filter, sizeof(filter), "mon == \"%s\"", name); > + len = snprintf(filter, sizeof(filter), "bpf_string ~ \"rv: *: %s: > *\"", name); > if (len >= sizeof(filter)) { > err_msg("trace: monitor name %s too long\n", name); > return -1; > @@ -197,31 +202,12 @@ static int enable_generic_event(struct trace_instance > *inst, const char *event_n > > if (config.my_pid > 0) > snprintf(filter + len, sizeof(filter) - len, > - " && common_pid != %d && !(has_id == 1 && id == > %d)", > - config.my_pid, config.my_pid); > + " && common_pid != %d && !(bpf_string ~ \"rv: *: %s: > %d: *\")", > + config.my_pid, name, config.my_pid); > > return apply_filter_enable(inst, tevent, filter); > } > > -/* > - * enable_bpf_events - enable rv:event_monitor and rv:error_monitor for a > monitor > - * > - * BPF monitors report via generic rv:event_monitor and rv:error_monitor > events. > - * Enable the events and filter them to only collect the messages of the > given monitor. > - * > - * Returns 0 on success, -1 otherwise. > - */ > -static int enable_bpf_events(struct trace_instance *inst, char *name) > -{ > - if (!config.trace_errors_only && enable_generic_event(inst, > "event_monitor", name)) > - return -1; > - > - if (enable_generic_event(inst, "error_monitor", name)) > - return -1; > - > - return 0; > -} > - > /** > * trace_enable_monitor_events - enable a monitor's events in a trace > instance > * > diff --git a/tools/verification/rv/tests/rv_mon.t > b/tools/verification/rv/tests/rv_mon.t > index 30d1dda..f51f194 100644 > --- a/tools/verification/rv/tests/rv_mon.t > +++ b/tools/verification/rv/tests/rv_mon.t > @@ -104,16 +104,16 @@ cpu="\[[0-9]\{3\}\][[:space:]]\+" > state="[a-z_]\+ " > id="[0-9]\+" > selfid="\$pid" > -# BPF monitors report via the common rv:event_monitor/rv:error_monitor > -# events, which add a "<mon>: " prefix to the message. > +# BPF monitors report via bpf_printk() > +type_bpf="bpf_trace_printk: rv: \(event\|error\)" > trace_task="${genpid}${cpu}${type}: ${id}: ${state}" > trace_task_self="${genpid}${cpu}${type}: ${selfid}: ${state}" > trace_cpu="${genpid}${cpu}${type}: ${state}" > trace_cpu_self="${selfpid}${cpu}${type}: ${state}" > -trace_task_bpf="${genpid}${cpu}${type}: ${mon}: ${id}: ${state}" > -trace_task_bpf_self="${genpid}${cpu}${type}: ${mon}: ${selfid}: ${state}" > -trace_cpu_bpf="${genpid}${cpu}${type}: ${mon}: ${state}" > -trace_cpu_bpf_self="${selfpid}${cpu}${type}: ${mon}: ${state}" > +trace_task_bpf="${genpid}${cpu}${type_bpf}: ${mon}: ${id}: ${state}" > +trace_task_bpf_self="${genpid}${cpu}${type_bpf}: ${mon}: ${selfid}: ${state}" > +trace_cpu_bpf="${genpid}${cpu}${type_bpf}: ${mon}: ${state}" > +trace_cpu_bpf_self="${selfpid}${cpu}${type_bpf}: ${mon}: ${state}" > > check_if_exists "run per-task monitor with tracing" \ > "$RV mon sssw -t" "$RVDIR/monitors/sched/sssw" \ > @@ -154,10 +154,10 @@ check_if_exists "run per-task monitor tracing only > errors" \ > > check_if_exists "run per-task BPF monitor tracing only errors" \ > "$RV mon tqueue -t -E" "$RVTOOL/bpf_monitors/tqueue.o" \ > - "$header" "event_monitor" > + "$header" "rv: event" > > check_if_exists "run per-cpu BPF monitor tracing only errors" \ > "$RV mon nohz -t -E" "$RVTOOL/bpf_monitors/nohz.o" \ > - "error_monitor" "event_monitor" > + "rv: error" "rv: event" > > test_end > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-11-30 10:56 ` Gabriele Monaco @ 2026-12-01 5:06 ` Alexei Starovoitov 2026-12-01 10:26 ` John Ogness ` (2 more replies) 0 siblings, 3 replies; 17+ messages in thread From: Alexei Starovoitov @ 2026-12-01 5:06 UTC (permalink / raw) To: Gabriele Monaco, linux-kernel, linux-trace-kernel, bpf, Steven Rostedt, Masami Hiramatsu Cc: Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra, John Ogness On Mon, Nov 30, 2026 at 02:56 AM Gabriele Monaco <gmonaco@redhat.com> 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. > If the amount of messages isn't an issue on the standard bpf_printk, we can just > use that, users are going to need to parse strings either ways. 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. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-12-01 5:06 ` Alexei Starovoitov @ 2026-12-01 10:26 ` John Ogness 2026-12-01 11:07 ` Tomas Glozar 2026-12-01 15:42 ` Gabriele Monaco 2 siblings, 0 replies; 17+ messages in thread From: John Ogness @ 2026-12-01 10:26 UTC (permalink / raw) To: Alexei Starovoitov, Gabriele Monaco, linux-kernel, linux-trace-kernel, bpf, Steven Rostedt, Masami Hiramatsu Cc: Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra On 2026-12-01, "Alexei Starovoitov" <alexei.starovoitov@gmail.com> 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. When there is no legacy console registered, I would be very interested if you can point out any location in the kernel where a printk() will not work. John Ogness ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-12-01 5:06 ` Alexei Starovoitov 2026-12-01 10:26 ` John Ogness @ 2026-12-01 11:07 ` Tomas Glozar 2026-12-01 15:42 ` Gabriele Monaco 2 siblings, 0 replies; 17+ messages in thread From: Tomas Glozar @ 2026-12-01 11:07 UTC (permalink / raw) To: Alexei Starovoitov Cc: Gabriele Monaco, linux-kernel, linux-trace-kernel, bpf, Steven Rostedt, Masami Hiramatsu, Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra, John Ogness On Tue, Dec 1, 2026 at 6:06 AM Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote: > > On Mon, Nov 30, 2026 at 02:56 AM Gabriele Monaco <gmonaco@redhat.com> 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 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-12-01 5:06 ` Alexei Starovoitov 2026-12-01 10:26 ` John Ogness 2026-12-01 11:07 ` Tomas Glozar @ 2026-12-01 15:42 ` Gabriele Monaco 2026-12-01 21:25 ` Alexei Starovoitov 2 siblings, 1 reply; 17+ messages in thread From: Gabriele Monaco @ 2026-12-01 15:42 UTC (permalink / raw) To: Alexei Starovoitov, linux-kernel, linux-trace-kernel, bpf, Steven Rostedt, Masami Hiramatsu Cc: Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra, John Ogness 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 ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-12-01 15:42 ` Gabriele Monaco @ 2026-12-01 21:25 ` Alexei Starovoitov 0 siblings, 0 replies; 17+ messages in thread From: Alexei Starovoitov @ 2026-12-01 21:25 UTC (permalink / raw) To: Gabriele Monaco, linux-kernel, linux-trace-kernel, bpf, Steven Rostedt, Masami Hiramatsu Cc: Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra, John Ogness On Tue, Dec 01, 2026 at 07:42 AM Gabriele Monaco <gmonaco@redhat.com> 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. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-11-26 12:59 ` [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs Gabriele Monaco ` (2 preceding siblings ...) 2026-11-27 23:33 ` Alexei Starovoitov @ 2026-11-29 15:15 ` kernel test robot 2026-11-30 7:03 ` kernel test robot 4 siblings, 0 replies; 17+ messages in thread From: kernel test robot @ 2026-11-29 15:15 UTC (permalink / raw) To: Gabriele Monaco, linux-kernel, linux-trace-kernel, bpf, Steven Rostedt, Masami Hiramatsu Cc: oe-kbuild-all, Alexei Starovoitov, Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra, John Ogness Hi Gabriele, kernel test robot noticed the following build errors: [auto build test ERROR on b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f] url: https://github.com/intel-lab-lkp/linux/commits/Gabriele-Monaco/sched-Add-task-enqueue-dequeue-trace-points/20261126-135947 base: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f patch link: https://lore.kernel.org/r/20261126130004.127155-6-gmonaco%40redhat.com patch subject: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs config: i386-randconfig-r123-20250410 (https://download.01.org/0day-ci/archive/20261129/20261129230741.qz8O6JBC-lkp@intel.com/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261129/20261129230741.qz8O6JBC-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/20261129230741.qz8O6JBC-lkp@intel.com/ All errors (new ones prefixed by >>): ld: kernel/trace/rv/rv_bpf.o: in function `__do_trace_event_monitor': >> kernel/trace/rv/rv_trace.h:324:(.text+0x2d): undefined reference to `__tracepoint_event_monitor' >> ld: kernel/trace/rv/rv_trace.h:324:(.text+0x41): undefined reference to `__SCT__tp_func_event_monitor' ld: kernel/trace/rv/rv_bpf.o: in function `__do_trace_error_monitor': >> kernel/trace/rv/rv_trace.h:328:(.text+0x135): undefined reference to `__tracepoint_error_monitor' >> ld: kernel/trace/rv/rv_trace.h:328:(.text+0x149): undefined reference to `__SCT__tp_func_error_monitor' >> ld: kernel/trace/rv/rv_bpf.o:(__jump_table+0x8): undefined reference to `__tracepoint_event_monitor' >> ld: kernel/trace/rv/rv_bpf.o:(__jump_table+0x14): undefined reference to `__tracepoint_error_monitor' vim +324 kernel/trace/rv/rv_trace.h 323 > 324 DEFINE_EVENT(event_template_monitor, event_monitor, 325 TP_PROTO(const char *mon, const int *id, const char *msg), 326 TP_ARGS(mon, id, msg)); 327 > 328 DEFINE_EVENT(event_template_monitor, error_monitor, 329 TP_PROTO(const char *mon, const int *id, const char *msg), 330 TP_ARGS(mon, id, msg)); 331 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs 2026-11-26 12:59 ` [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs Gabriele Monaco ` (3 preceding siblings ...) 2026-11-29 15:15 ` kernel test robot @ 2026-11-30 7:03 ` kernel test robot 4 siblings, 0 replies; 17+ messages in thread From: kernel test robot @ 2026-11-30 7:03 UTC (permalink / raw) To: Gabriele Monaco, linux-kernel, linux-trace-kernel, bpf, Steven Rostedt, Masami Hiramatsu Cc: oe-kbuild-all, Alexei Starovoitov, Nam Cao, Wen Yang, Tobias Schaffner, Viktor Malik, Peter Zijlstra, John Ogness Hi Gabriele, kernel test robot noticed the following build errors: [auto build test ERROR on b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f] url: https://github.com/intel-lab-lkp/linux/commits/Gabriele-Monaco/sched-Add-task-enqueue-dequeue-trace-points/20261126-135947 base: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f patch link: https://lore.kernel.org/r/20261126130004.127155-6-gmonaco%40redhat.com patch subject: [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs config: x86_64-randconfig-008-20250618 (https://download.01.org/0day-ci/archive/20261130/20261130145356.NslWEbDE-lkp@intel.com/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261130/20261130145356.NslWEbDE-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/20261130145356.NslWEbDE-lkp@intel.com/ All errors (new ones prefixed by >>): ld: kernel/trace/rv/rv_bpf.o: in function `__do_trace_event_monitor': kernel/trace/rv/rv_trace.h:324:(.text+0xc6): undefined reference to `__tracepoint_event_monitor' ld: kernel/trace/rv/rv_trace.h:324:(.text+0xde): undefined reference to `__SCT__tp_func_event_monitor' ld: kernel/trace/rv/rv_bpf.o: in function `__do_trace_error_monitor': kernel/trace/rv/rv_trace.h:328:(.text+0x266): undefined reference to `__tracepoint_error_monitor' ld: kernel/trace/rv/rv_trace.h:328:(.text+0x27e): undefined reference to `__SCT__tp_func_error_monitor' ld: kernel/trace/rv/rv_bpf.o:(__jump_table+0x8): undefined reference to `__tracepoint_event_monitor' ld: kernel/trace/rv/rv_bpf.o:(__jump_table+0x18): undefined reference to `__tracepoint_error_monitor' >> ld: kernel/trace/rv/rv_bpf.o:(.static_call_sites+0x4): undefined reference to `__SCK__tp_func_event_monitor' >> ld: kernel/trace/rv/rv_bpf.o:(.static_call_sites+0x14): undefined reference to `__SCK__tp_func_error_monitor' -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2026-12-02 0:49 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-02 0:48 [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs kernel test robot -- strict thread matches above, loose matches on Subject: below -- 2026-12-01 12:01 kernel test robot 2026-12-01 11:30 kernel test robot 2026-12-01 9:48 kernel test robot 2026-12-01 8:46 kernel test robot 2026-11-26 12:59 [PATCH v3 00/18] rv: Add support for BPF monitors Gabriele Monaco 2026-11-26 12:59 ` [PATCH v3 05/18] rv: Add generic monitor event tracepoints and BPF kfuncs Gabriele Monaco 2026-11-26 13:24 ` sashiko-bot 2026-11-26 22:09 ` kernel test robot 2026-11-27 23:33 ` Alexei Starovoitov 2026-11-30 10:56 ` Gabriele Monaco 2026-12-01 5:06 ` Alexei Starovoitov 2026-12-01 10:26 ` John Ogness 2026-12-01 11:07 ` Tomas Glozar 2026-12-01 15:42 ` Gabriele Monaco 2026-12-01 21:25 ` Alexei Starovoitov 2026-11-29 15:15 ` kernel test robot 2026-11-30 7:03 ` kernel test robot
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.