Linux Trace Kernel
 help / color / mirror / Atom feed
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 16/18] verification/rvgen: Add support for BPF monitors
Date: Thu, 26 Nov 2026 13:14:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-235583@kernel.org> (raw)
In-Reply-To: <20261126130004.127155-17-gmonaco@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] verification/rvgen: missing self.bpf in
  Dot2c.format_automaton_definition()
--

commit f6c387dbb1dd7cab260bf2fa7f3c9e7a20021e5e
Author: Gabriele Monaco <gmonaco@redhat.com>

verification/rvgen: Add support for BPF monitors

This commit adds the -b/--bpf option to rvgen to generate BPF-based
deterministic automaton monitors.

> diff --git a/tools/verification/rvgen/rvgen/dot2c.py b/tools/verification/rvgen/rvgen/dot2c.py
> index c6bd4d00d92e1..246b769316609 100644
> --- a/tools/verification/rvgen/rvgen/dot2c.py
> +++ b/tools/verification/rvgen/rvgen/dot2c.py
> @@ -111,10 +111,17 @@ class Dot2c(Automata):
>          min_type = self.get_minimun_type()
>          buff = []
>          buff.append(f"struct {self.struct_automaton_def} {{")
> -        buff.append(f"\tconst char *state_names[state_max{self.enum_suffix}];")
> -        buff.append(f"\tconst char *event_names[event_max{self.enum_suffix}];")
> -        if self.is_hybrid_automata():
> -            buff.append(f"\tconst char *env_names[env_max{self.enum_suffix}];")
> +        if self.bpf:
> +            # BPF struggles with non-fixed string pointers
> +            buff.append(f"\tconst char state_names[state_max{self.enum_suffix}][32];")
> +            buff.append(f"\tconst char event_names[event_max{self.enum_suffix}][32];")
> +            if self.is_hybrid_automata():
> +                buff.append(f"\tconst char env_names[env_max{self.enum_suffix}][32];")
> +        else:
> +            buff.append(f"\tconst char *state_names[state_max{self.enum_suffix}];")
> +            buff.append(f"\tconst char *event_names[event_max{self.enum_suffix}];")
> +            if self.is_hybrid_automata():
> +                buff.append(f"\tconst char *env_names[env_max{self.enum_suffix}];")

[Severity: Medium]
Does checking self.bpf here raise an AttributeError when Dot2c is
instantiated directly?

self.bpf is only initialized in RVGenerator.__init__(), which Dot2c does
not inherit from.  Running the standalone tools/verification/rvgen/dot2c
utility instantiates Dot2c directly and calls print_model_classic() ->
format_model() -> format_automaton_definition(), crashing with
"AttributeError: 'Dot2c' object has no attribute 'bpf'".  Setting
self.bpf = False in Dot2c.__init__() (or as a class attribute on Dot2c)
would avoid this regression.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126130004.127155-1-gmonaco@redhat.com?part=16

  reply	other threads:[~2026-11-26 13:14 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
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 [this message]
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-235583@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