All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: <sashiko-reviews@lists.linux.dev>, "Qiliang Yuan" <odys.yuan@gmail.com>
Cc: <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next v3] selftests/bpf: Run the enable_stats program with BPF_PROG_TEST_RUN
Date: Wed, 21 Oct 2026 00:06:34 +0000	[thread overview]
Message-ID: <DMA2TKIVB6J4.2UF472OAJGB62@gmail.com> (raw)
In-Reply-To: <sashiko-outbox-176554@kernel.org>

On Mon Oct 19, 2026 at 2:57 AM UTC, sashiko-bot wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] selftests/bpf: deprecated CHECK() macro used in test_enable_stats()
> --
>
> commit 149e144806feffc72e780046d3d7759e157ee137
> Author: Qiliang Yuan <odys.yuan@gmail.com>
>
> selftests/bpf: Run the enable_stats program with BPF_PROG_TEST_RUN
>
> This commit replaces attaching the enable_stats BPF program to sys_enter
> with running it 1000 times via BPF_PROG_TEST_RUN so that concurrent
> syscalls on other CPUs do not race with reading run_cnt and count.
>
>> diff --git a/tools/testing/selftests/bpf/prog_tests/enable_stats.c b/tools/testing/selftests/bpf/prog_tests/enable_stats.c
>> index 75f85d0fe74a4..5b9cc119d072d 100644
>> --- a/tools/testing/selftests/bpf/prog_tests/enable_stats.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/enable_stats.c
>> @@ -5,10 +5,11 @@
>>  void test_enable_stats(void)
>>  {
>>  	struct test_enable_stats *skel;
>> -	int stats_fd, err, prog_fd;
>> +	int stats_fd, err, prog_fd, i;
>>  	struct bpf_prog_info info;
>>  	__u32 info_len = sizeof(info);
>>  	int duration = 0;
>> +	LIBBPF_OPTS(bpf_test_run_opts, topts);
>>  
>>  	skel = test_enable_stats__open_and_load();
>>  	if (CHECK(!skel, "skel_open_and_load", "skeleton open/load failed\n"))
>> @@ -20,13 +21,15 @@ void test_enable_stats(void)
>>  		return;
>>  	}
>>  
>> -	err = test_enable_stats__attach(skel);
>> -	if (CHECK(err, "attach_raw_tp", "err %d\n", err))
>> +	prog_fd = bpf_program__fd(skel->progs.test_enable_stats);
>> +	for (i = 0; i < 1000; i++) {
>> +		err = bpf_prog_test_run_opts(prog_fd, &topts);
>> +		if (err)
>> +			break;
>> +	}
>> +	if (CHECK(err, "test_run", "err %d\n", err))
>>  		goto cleanup;
>
> [Severity: Low]
> Since CHECK() is deprecated in BPF selftests, should this new check in
> test_enable_stats() (and perhaps the surrounding checks in this function)
> use ASSERT_OK(err, "test_run") instead?

bot is correct.

pw-bot: cr

      reply	other threads:[~2026-10-21  0:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  2:53 [PATCH bpf-next v3] selftests/bpf: Run the enable_stats program with BPF_PROG_TEST_RUN Qiliang Yuan
2026-10-19  2:57 ` sashiko-bot
2026-10-21  0:06   ` Alexei Starovoitov [this message]

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=DMA2TKIVB6J4.2UF472OAJGB62@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=odys.yuan@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.