Re: [PATCH bpf-next v2] selftests/bpf: Run the enable_stats program with BPF_PROG_TEST_RUN
From: Alexei Starovoitov
Date: Fri Oct 16 2026 - 14:42:03 EST
On Fri, Oct 09, 2026 at 10:04 AM Qiliang Yuan <odys.yuan@xxxxxxxxx> wrote:
> them. As a single run can be shorter than the resolution of the clock,
> run it until its run time shows, unless its runs aren't counted at all.
Did v1 fail anywhere?
It passed BPF CI on x86, arm64 and s390.
> + do {
> + err = bpf_prog_test_run_opts(prog_fd, &topts);
> + if (err)
> + break;
> +
> + memset(&info, 0, info_len);
> + err = bpf_prog_get_info_by_fd(prog_fd, &info, &info_len);
> + } while (!err && info.run_cnt && !info.run_time_ns);
If the kernel counts the runs, but not the time, this loop never ends.
That's the bug this test is for.
check_stats_enabled below can fire only when run_cnt is zero.
The watchdog of test_progs won't help.
It does pthread_kill(SIGSEGV) once. crash_handler() prints
the backtrace and returns. Both bpf() calls don't block,
so there is no EINTR and the loop keeps going.
The test has to fail instead of hang.
Run the prog 1000 times in a for loop and keep get_info as it was in v1.
Then no need for the comment, and check_run_cnt_valid compares
1000 with 1000 instead of 1 with 1.
Also pls don't respin in 12 hours only because a bot said something. Wait for people to reply.
pw-bot: cr