From: sashiko-bot@kernel.org
To: "Gabriele Monaco" <gmonaco@redhat.com>,
linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH v3 13/18] tools/rv: Add BPF monitors
Date: Thu, 26 Nov 2026 13:24:33 +0000 [thread overview]
Message-ID: <sashiko-outbox-235595@kernel.org> (raw)
In-Reply-To: <20261126130004.127155-14-gmonaco@redhat.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] tools/rv: BPF monitor build fails when BTF source lacks
CONFIG_RV types
- [Medium] tools/rv: BPF monitor build lacks -mcpu=v3, likely()
fallback, and O= support
- [Low] tools/rv: bpftool failure leaves empty bpf_monitors/vmlinux.h on
disk
- [Low] tools/rv: missing da_reset() macro mappings in da_monitor_bpf.h
--
commit e722072977f9f930cda140d2eaa94a39a1ea1809
Author: Gabriele Monaco <gmonaco@redhat.com>
tools/rv: Add BPF monitors
This commit adds two initial DA BPF monitors (tqueue and nohz), adapts
include/rv/da_monitor.h for BPF compilation via da_monitor_bpf.h, and
integrates BPF monitor building and installation into the tools/rv
Makefiles.
> diff --git a/tools/verification/rv/Makefile b/tools/verification/rv/Makefile
> index 0a8c7a656f7f3..4bac303246892 100644
> --- a/tools/verification/rv/Makefile
> +++ b/tools/verification/rv/Makefile
[ ... ]
> @@ -68,19 +72,50 @@ static: $(RV_IN)
> $(eval LDFLAGS += -static)
> $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV)-static $(RV_IN) $(EXTLIBS)
>
> +BPF_DIR := bpf_monitors
> +BPF_SOURCES := $(wildcard $(BPF_DIR)/*.c)
> +BPF_OBJECTS := $(BPF_SOURCES:.c=.o)
> +VMLINUX_H := $(BPF_DIR)/vmlinux.h
> +
> +BPF_INCLUDES := -I$(srctree)/include/uapi
> +BPF_INCLUDES += -I$(srctree)/include
> +BPF_INCLUDES += -I$(BPF_DIR)
> +
> +BPF_CFLAGS := -g -O2 -target bpf -MMD -MP $(BPF_INCLUDES)
> +BPF_CFLAGS += -Wall -Wno-unused-function -Wno-missing-declarations
[Severity: Medium]
As reported by bot+bpf-ci@kernel.org on v2 [1], does building the BPF
monitors fail on Clang older than 20, system libbpf headers older than
1.6, or out-of-tree O= builds?
Clang versions before 20 default to -mcpu=v1, which rejects the 32-bit
cmpxchg and fetch-and-add instructions in da_event() and smp_mb() unless
-mcpu=v3 is passed in BPF_CFLAGS. Without -I$(srctree)/tools/lib or a
fallback definition in da_monitor_bpf.h, <bpf/bpf_helpers.h> resolves to
the system libbpf header, which lacks likely() and unlikely() prior to
libbpf 1.6. Finally, BPF_DIR is not prefixed with $(OUTPUT), so O=
builds write artifacts into the source tree instead of $(OUTPUT), where
the rv binary looks for bpf_monitors.
> +
> +VMLINUX := ../../../vmlinux
> +VMLINUX_BTF ?= $(if $(wildcard $(VMLINUX)) , $(VMLINUX), /sys/kernel/btf/vmlinux)
> +
> +$(VMLINUX_H): $(VMLINUX_BTF)
> + $(QUIET_GEN)$(SYSTEM_BPFTOOL) btf dump file $< format c > $@
[Severity: Medium]
As reported by bot+bpf-ci@kernel.org on v2 [2], does the default build
fail with incomplete type errors when $(VMLINUX_BTF) comes from a kernel
built without CONFIG_RV=y?
BUILD_BPF_OBJS defaults to 1 whenever libbpf, clang, and bpftool are
installed, adding the bpf target to all. Because include/linux/rv.h
guards struct rv_monitor, struct da_monitor, and union rv_task_monitor
under #ifdef CONFIG_RV, compiling the BPF monitors relies on vmlinux.h
providing those types from kernel BTF. When the host or in-tree kernel
has CONFIG_RV disabled, those definitions are absent from vmlinux.h and
compiling da_monitor.h and da_monitor_bpf.h fails.
[Severity: Low]
As reported by bot+bpf-ci@kernel.org on v2 [3], if bpftool fails while
generating $(VMLINUX_H), does shell redirection leave an empty
bpf_monitors/vmlinux.h on disk? Without .DELETE_ON_ERROR or writing via
a temporary file, subsequent make runs see an up-to-date header and fail
with compiler errors until make clean.
> diff --git a/tools/verification/rv/Makefile.rv b/tools/verification/rv/Makefile.rv
> index 2497fb96c83d2..418748bc3aa12 100644
> --- a/tools/verification/rv/Makefile.rv
> +++ b/tools/verification/rv/Makefile.rv
> @@ -33,12 +33,17 @@ INSTALL := install
> MKDIR := mkdir
> STRIP := strip
> BINDIR := /usr/bin
> +BPF_MON_DIR := /usr/share/rv/bpf_monitors
>
> .PHONY: install
> install: doc_install
> $(Q)$(MKDIR) -p $(DESTDIR)$(BINDIR)
> $(call QUIET_INSTALL,rv)$(INSTALL) $(OUTPUT)rv -m 755 $(DESTDIR)$(BINDIR)
> $(Q)@$(STRIP) $(DESTDIR)$(BINDIR)/rv
> +ifneq ($(wildcard bpf_monitors/*.o),)
> + $(Q)$(MKDIR) -p $(DESTDIR)$(BPF_MON_DIR)
> + $(call QUIET_INSTALL,bpf_monitors)$(INSTALL) bpf_monitors/*.o -m 644 $(DESTDIR)$(BPF_MON_DIR)
> +endif
[Severity: Medium]
As reported by bot+bpf-ci@kernel.org on v2 [4], does a single-invocation
"make all install" on a clean tree skip installing bpf_monitors/*.o?
$(wildcard bpf_monitors/*.o) is evaluated when the Makefile is parsed,
before the bpf target builds the object files, and it also looks in the
source directory rather than $(OUTPUT)bpf_monitors/*.o.
> diff --git a/tools/verification/rv/bpf_monitors/da_monitor_bpf.h b/tools/verification/rv/bpf_monitors/da_monitor_bpf.h
> new file mode 100644
> index 0000000000000..e9e673c2d1b68
> --- /dev/null
> +++ b/tools/verification/rv/bpf_monitors/da_monitor_bpf.h
[ ... ]
> +/*
> + * BPF Per-Task monitor - uses BPF task storage map
> + */
> +
> +#define da_get_monitor(tsk) da_get_monitor_bpf(BPF_CORE_READ(tsk, pid), tsk)
> +#define da_handle_event(tsk, event) \
> + da_handle_event_bpf(BPF_CORE_READ(tsk, pid), tsk, event)
> +#define da_handle_start_event(tsk, event) \
> + da_handle_start_event_bpf(BPF_CORE_READ(tsk, pid), tsk, event)
> +#define da_handle_start_run_event(tsk, event) \
> + da_handle_start_run_event_bpf(BPF_CORE_READ(tsk, pid), tsk, event)
[ ... ]
> +#elif RV_MON_TYPE == RV_MON_PER_OBJ
> +/*
> + * BPF Per-Object monitor - uses BPF hash map
> + */
> +
> +#define da_get_monitor da_get_monitor_bpf
> +#define da_handle_event da_handle_event_bpf
> +#define da_handle_start_event da_handle_start_event_bpf
> +#define da_handle_start_run_event da_handle_start_run_event_bpf
[ ... ]
> +static inline void da_reset_bpf(da_id_type id, monitor_target_bpf target)
> +{
> + struct da_monitor *da_mon;
> +
> + da_mon = da_get_monitor_bpf(id, target);
> + if (likely(da_mon))
> + da_monitor_reset(da_mon);
> +}
[Severity: Low]
Should RV_MON_PER_TASK and RV_MON_PER_OBJ also map da_reset to
da_reset_bpf()? da_reset_bpf() is defined here, but without the
corresponding #define da_reset macros it is unused and any per-task or
per-object BPF monitor calling da_reset() will fail to compile.
[1] https://lore.kernel.org/r/1081b7a0f143f29745409a1356f223fd8b196c827e18d46cde7f41716def72c0@mail.kernel.org
[2] https://lore.kernel.org/r/1081b7a0f143f29745409a1356f223fd8b196c827e18d46cde7f41716def72c0@mail.kernel.org
[3] https://lore.kernel.org/r/1081b7a0f143f29745409a1356f223fd8b196c827e18d46cde7f41716def72c0@mail.kernel.org
[4] https://lore.kernel.org/r/1081b7a0f143f29745409a1356f223fd8b196c827e18d46cde7f41716def72c0@mail.kernel.org
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126130004.127155-1-gmonaco@redhat.com?part=13
next prev parent reply other threads:[~2026-11-26 13:24 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 12:59 [PATCH v3 00/18] rv: Add support for BPF monitors Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 01/18] sched: Add task enqueue/dequeue trace points Gabriele Monaco
2026-11-26 13:13 ` sashiko-bot
2026-11-26 12:59 ` [PATCH v3 02/18] tools/rv: Skip empty pid error in selftest if command failed Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 03/18] rv: Add wrapper macros for monitor tracepoint definitions Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 04/18] rv: Propagate const to model strings and tracepoints 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 12:59 ` [PATCH v3 06/18] tools/build: Add a feature test for bpftool-btf Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 07/18] tools/rv: Move argument parsing from in_kernel to utils Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 08/18] tools/rv: Move monitor trace handling to trace.c Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 09/18] tools/rv: Implement BPF monitor discovery and listing Gabriele Monaco
2026-11-26 13:17 ` sashiko-bot
2026-11-26 12:59 ` [PATCH v3 10/18] tools/rv: Implement BPF monitor loading and tracing Gabriele Monaco
2026-11-26 13:14 ` sashiko-bot
2026-11-26 12:59 ` [PATCH v3 11/18] tools/rv: Rework tracing to support generic events Gabriele Monaco
2026-11-26 13:13 ` sashiko-bot
2026-11-26 12:59 ` [PATCH v3 12/18] tools/rv: Copy stripped bpf_atomic.h from libarena Gabriele Monaco
2026-11-26 12:59 ` [PATCH v3 13/18] tools/rv: Add BPF monitors Gabriele Monaco
2026-11-26 13:24 ` sashiko-bot [this message]
2026-11-26 13:00 ` [PATCH v3 14/18] tools/rv: Define CONFIG_X86_64 statically for " Gabriele Monaco
2026-11-26 13:00 ` [PATCH v3 15/18] tools/rv: Add -E/--errors-only option Gabriele Monaco
2026-11-26 13:00 ` [PATCH v3 16/18] verification/rvgen: Add support for BPF monitors Gabriele Monaco
2026-11-26 13:14 ` sashiko-bot
2026-11-26 13:00 ` [PATCH v3 17/18] tools/rv: Add selftest for rv bpf monitors Gabriele Monaco
2026-11-26 13:00 ` [PATCH v3 18/18] verification/rvgen: Add selftest for rvgen -b Gabriele Monaco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-235595@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=gmonaco@redhat.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox