All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Fomichev <sdf@google.com>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com,
	 andrii@kernel.org, martin.lau@linux.dev, song@kernel.org,
	 yonghong.song@linux.dev, kpsingh@kernel.org, haoluo@google.com,
	 jolsa@kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: Add selftest for sleepable bpf_task_under_cgroup()
Date: Thu, 5 Oct 2023 10:13:40 -0700	[thread overview]
Message-ID: <ZR7uxCMaWlfEBkBJ@google.com> (raw)
In-Reply-To: <20231005083953.1281-2-laoar.shao@gmail.com>

On 10/05, Yafang Shao wrote:
> The result as follows,
> 
>   $ tools/testing/selftests/bpf/test_progs --name=task_under_cgroup
>   #237     task_under_cgroup:OK
>   Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED
> 
> And no error messages in dmesg.
> 
> Without the prev patch, there will be RCU warnings in dmesg.
> 
> Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
> ---
>  .../selftests/bpf/prog_tests/task_under_cgroup.c   |  8 +++++--
>  .../selftests/bpf/progs/test_task_under_cgroup.c   | 28 +++++++++++++++++++++-
>  2 files changed, 33 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/task_under_cgroup.c b/tools/testing/selftests/bpf/prog_tests/task_under_cgroup.c
> index 4224727..d1a5a5c 100644
> --- a/tools/testing/selftests/bpf/prog_tests/task_under_cgroup.c
> +++ b/tools/testing/selftests/bpf/prog_tests/task_under_cgroup.c
> @@ -30,8 +30,12 @@ void test_task_under_cgroup(void)
>  	if (!ASSERT_OK(ret, "test_task_under_cgroup__load"))
>  		goto cleanup;
>  
> -	ret = test_task_under_cgroup__attach(skel);
> -	if (!ASSERT_OK(ret, "test_task_under_cgroup__attach"))
> +	skel->links.lsm_run = bpf_program__attach_lsm(skel->progs.lsm_run);
> +	if (!ASSERT_OK_PTR(skel->links.lsm_run, "attach_lsm"))
> +		goto cleanup;
> +

So we rely on the second attach here to trigger the program above?
Maybe add a comment? Otherwise we might risk loosing this dependency
after some refactoring...

Other than that, both patches look good to me, feel free to use for both
if/when you resend:

Acked-by: Stanislav Fomichev <sdf@google.com>

  reply	other threads:[~2023-10-05 17:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-05  8:39 [PATCH bpf-next 1/2] bpf: Fix missed rcu read lock in bpf_task_under_cgroup() Yafang Shao
2023-10-05  8:39 ` [PATCH bpf-next 2/2] selftests/bpf: Add selftest for sleepable bpf_task_under_cgroup() Yafang Shao
2023-10-05 17:13   ` Stanislav Fomichev [this message]
2023-10-06  2:17     ` Yafang Shao

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=ZR7uxCMaWlfEBkBJ@google.com \
    --to=sdf@google.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=laoar.shao@gmail.com \
    --cc=martin.lau@linux.dev \
    --cc=song@kernel.org \
    --cc=yonghong.song@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.