BPF atomic macros require CONFIG_X86_64 to determine barrier instructions. Reading this from the system Kconfig can fail if the configuration is missing or in an unexpected location, causing the loading phase to fail.
Since the rv tool is compiled for the target architecture, the architecture is known at compile-time. Define the CONFIG_X86_64 value statically via the libbpf open options to bypass Kconfig dependency and ensure reliable loading. Signed-off-by: Gabriele Monaco <[email protected]> --- tools/verification/rv/src/bpf_monitor.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/verification/rv/src/bpf_monitor.c b/tools/verification/rv/src/bpf_monitor.c index 7e24a71dfac7..d2d1d90bbf73 100644 --- a/tools/verification/rv/src/bpf_monitor.c +++ b/tools/verification/rv/src/bpf_monitor.c @@ -505,6 +505,12 @@ static struct bpf_object *open_bpf_monitor(const char *monitor_name, const char LIBBPF_OPTS(bpf_object_open_opts, opts, .pin_root_path = BPF_PIN_BASE_PATH, + /* Define statically as arch is known, Kconfig may not be available */ +#ifdef __x86_64__ + .kconfig = "CONFIG_X86_64=y\n", +#else + .kconfig = "CONFIG_X86_64=n\n", +#endif ); if (!path) { -- 2.55.0
