From: Eduard Zingerman <eddyz87@gmail.com>
To: Ning Ding <dingning04@gmail.com>, bpf@vger.kernel.org
Cc: memxor@gmail.com, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, shuah@kernel.org
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: Test RCU iterator state pruning
Date: Mon, 10 Aug 2026 12:36:56 -0700 [thread overview]
Message-ID: <394bdd5e8cd366cacaa6ced8a32e851b43e67e11.camel@gmail.com> (raw)
In-Reply-To: <20260807004320.134069-3-dingning04@gmail.com>
On Thu, 2026-08-06 at 17:43 -0700, Ning Ding wrote:
...
> +SEC("?fentry.s/" SYS_PREFIX "sys_getpgid")
> +__failure __msg("expected an RCU CS when using bpf_iter_task_next")
> +__flag(BPF_F_TEST_STATE_FREQ)
> +int BPF_PROG(iter_tasks_rcu_state_pruning)
> +{
> + struct bpf_iter_task it;
> +
> + bpf_rcu_read_lock();
> + bpf_iter_task_new(&it, NULL, BPF_TASK_ITER_ALL_PROCS);
> +
> + if (likely(bpf_get_prandom_u32())) {
Could you please convert this test to inline assembly?
The presence of 'likely' might not be sufficient to guarantee
the codegen pattern, so we usually resort to the assembly for
tests where that is important.
> + /* Keep the outer RCU lock active. */
> + bpf_rcu_read_lock();
> + bpf_rcu_read_unlock();
> + } else {
> + /* Create an unprotected gap. */
> + bpf_rcu_read_unlock();
> + bpf_rcu_read_lock();
> + }
> +
> + bpf_iter_task_next(&it);
> + bpf_iter_task_destroy(&it);
> + bpf_rcu_read_unlock();
> +
> + return 0;
> +}
> +
> SEC("?fentry.s/" SYS_PREFIX "sys_getpgid")
> __failure __msg("expected an RCU CS when using bpf_iter_css_next")
> int BPF_PROG(iter_css_lock_and_unlock)
next prev parent reply other threads:[~2026-08-10 19:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 0:43 [PATCH bpf-next 0/2] bpf: Compare iterator types during state pruning Ning Ding
2026-08-07 0:43 ` [PATCH bpf-next 1/2] " Ning Ding
2026-08-10 19:35 ` Eduard Zingerman
2026-08-07 0:43 ` [PATCH bpf-next 2/2] selftests/bpf: Test RCU iterator " Ning Ding
2026-08-10 19:36 ` Eduard Zingerman [this message]
2026-08-11 0:32 ` Ning Ding
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=394bdd5e8cd366cacaa6ced8a32e851b43e67e11.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dingning04@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=memxor@gmail.com \
--cc=shuah@kernel.org \
/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