> verification/rvgen: Add support for BPF monitors

TL;DR: In rvgen, with -b and -a, the printed messages and checklist point to a
nonexistent {monitor.name}/ directory and never say the sources went to
bpf_monitors/. Should they print that location?

> diff --git a/tools/verification/rvgen/__main__.py 
> b/tools/verification/rvgen/__main__.py
> --- a/tools/verification/rvgen/__main__.py
> +++ b/tools/verification/rvgen/__main__.py

[ ... ]

> @@ -80,7 +85,9 @@ if __name__ == '__main__':
>      print("Almost done, checklist")
>      if params.subcmd == "monitor":
>          print(f"  - Edit the {monitor.name}/{monitor.name}.c to add the 
> instrumentation")
> -        print(monitor.fill_tracepoint_tooltip())
> -    print(monitor.fill_makefile_tooltip())
> -    print(monitor.fill_kconfig_tooltip())
> -    print(monitor.fill_monitor_tooltip())
> +        if not params.bpf:
> +            print(monitor.fill_tracepoint_tooltip())
> +    if not params.subcmd == "monitor" or not params.bpf:
> +        print(monitor.fill_makefile_tooltip())
> +        print(monitor.fill_kconfig_tooltip())
> +        print(monitor.fill_monitor_tooltip())

With -b and -a, does this checklist point to a path that is never created?

RVGenerator.__create_directory() returns early for this case:

    if self.auto_patch:
        if self.bpf:
            # no directory for BPF monitors
            return

and RVGenerator._create_file() writes the files to self.rv_tool_dir, which
resolves to tools/verification/rv/bpf_monitors/<name>.c in the kernel tree:

    if self.bpf:
        path = Path(self.rv_tool_dir) / file_name

But __main__ still prints "Writing the monitor into the directory
{monitor.name}" and "Edit the {monitor.name}/{monitor.name}.c to add the
instrumentation", and no {monitor.name}/ directory exists anywhere.

Since fill_monitor_tooltip() is now skipped for BPF monitors, which on the
in-kernel -a path prints "Monitor created in {rv_dir}/monitors/{name}",
nothing in the output tells the user where the generated sources were
written.  Should the BPF -a case print the bpf_monitors/ location instead?


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/36944413541

Reply via email to