From: Yonghong Song <yonghong.song@linux.dev>
To: Chuyi Zhou <zhouchuyi@bytedance.com>, bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@kernel.org
Subject: Re: [PATCH bpf-next v3 3/3] selftests/bpf: Add test for using css_task iter in sleepable progs
Date: Mon, 30 Oct 2023 17:20:10 -0700 [thread overview]
Message-ID: <c361ad7b-9c82-4ec2-ad39-86bdcdf9bd60@linux.dev> (raw)
In-Reply-To: <20231025075914.30979-4-zhouchuyi@bytedance.com>
On 10/25/23 12:59 AM, Chuyi Zhou wrote:
> This Patch add a test to prove css_task iter can be used in normal
> sleepable progs.
>
> Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
> ---
> .../selftests/bpf/progs/iters_task_failure.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/progs/iters_task_failure.c b/tools/testing/selftests/bpf/progs/iters_task_failure.c
> index 6b1588d70652..fe0b19e545d0 100644
> --- a/tools/testing/selftests/bpf/progs/iters_task_failure.c
> +++ b/tools/testing/selftests/bpf/progs/iters_task_failure.c
> @@ -103,3 +103,22 @@ int BPF_PROG(iter_css_task_for_each)
> bpf_cgroup_release(cgrp);
> return 0;
> }
> +
> +SEC("?fentry.s/" SYS_PREFIX "sys_getpgid")
> +int BPF_PROG(iter_css_task_for_each_sleep)
> +{
> + u64 cg_id = bpf_get_current_cgroup_id();
> + struct cgroup *cgrp = bpf_cgroup_from_id(cg_id);
> + struct cgroup_subsys_state *css;
> + struct task_struct *task;
> +
> + if (cgrp == NULL)
> + return 0;
> + css = &cgrp->self;
> +
> + bpf_for_each(css_task, task, css, CSS_TASK_ITER_PROCS) {
> +
> + }
> + bpf_cgroup_release(cgrp);
> + return 0;
> +}
Could you move this prog toiters_css_task.c and add a subtest in cgroup_iter.c? The file
iters_task_failure.c intends for negative tests. This prog succeeds with
loading.
next prev parent reply other threads:[~2023-10-31 0:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 7:59 [PATCH bpf-next v3 0/3] Relax allowlist for open-coded css_task iter Chuyi Zhou
2023-10-25 7:59 ` [PATCH bpf-next v3 1/3] bpf: Relax allowlist for " Chuyi Zhou
2023-10-31 0:05 ` Yonghong Song
2023-10-25 7:59 ` [PATCH bpf-next v3 2/3] selftests/bpf: Add tests for css_task iter combining with cgroup iter Chuyi Zhou
2023-10-31 0:14 ` Yonghong Song
2023-10-25 7:59 ` [PATCH bpf-next v3 3/3] selftests/bpf: Add test for using css_task iter in sleepable progs Chuyi Zhou
2023-10-31 0:20 ` Yonghong Song [this message]
2023-10-31 2:28 ` Chuyi Zhou
2023-10-31 2:41 ` Yonghong Song
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=c361ad7b-9c82-4ec2-ad39-86bdcdf9bd60@linux.dev \
--to=yonghong.song@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=martin.lau@kernel.org \
--cc=zhouchuyi@bytedance.com \
/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.