All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Jiri Olsa <olsajiri@gmail.com>
Cc: Martin KaFai Lau <martin.lau@linux.dev>,
	Kui-Feng Lee <kuifeng@fb.com>,
	bpf@vger.kernel.org, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@chromium.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Subject: Re: [PATCH bpf-next] selftests/bpf: Add missing bpf_iter_vma_offset__destroy call
Date: Tue, 4 Oct 2022 14:16:24 +0200	[thread overview]
Message-ID: <YzwjQJurtyF6f0W1@krava> (raw)
In-Reply-To: <YzvU3/rwCnbWQM8P@krava>

On Tue, Oct 04, 2022 at 08:38:23AM +0200, Jiri Olsa wrote:
> On Mon, Oct 03, 2022 at 05:12:44PM -0700, Martin KaFai Lau wrote:
> > On 10/2/22 8:11 AM, Jiri Olsa wrote:
> > > Adding missing bpf_iter_vma_offset__destroy call to
> > > test_task_vma_offset_common function and related goto jumps.
> > > 
> > > Fixes: b3e1331eb925 ("selftests/bpf: Test parameterized task BPF iterators.")
> > > Cc: Kui-Feng Lee <kuifeng@fb.com>
> > > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > > ---
> > >   tools/testing/selftests/bpf/prog_tests/bpf_iter.c | 8 +++++---
> > >   1 file changed, 5 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
> > > index 3369c5ec3a17..462fe92e0736 100644
> > > --- a/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
> > > +++ b/tools/testing/selftests/bpf/prog_tests/bpf_iter.c
> > > @@ -1515,11 +1515,11 @@ static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool
> > >   	link = bpf_program__attach_iter(skel->progs.get_vma_offset, opts);
> > 
> > Thanks for the fix.
> > 
> > A nit.  Instead of adding a new goto label.  How about doing
> > 
> > 	skel->links.get_vma_offset = bpf_program_attach_iter(...)
> > 
> > and bpf_iter_vma_offset__destroy(skel) will take care of the link destroy.
> > The earlier test_task_vma_common() is doing that also.
> 
> right, I forgot destroy would do that.. it'll be simpler change

ugh actually no ;-) it's outside (of skeleton) link,
so it won't get closed in bpf_iter_vma_offset__destroy

the earlier test_task_vma_common does not create such link

jirka

> 
> thanks,
> jirka
> 
> > 
> > Kui-Feng, please also take a look.
> > 
> > >   	if (!ASSERT_OK_PTR(link, "attach_iter"))
> > > -		return;
> > > +		goto exit_skel;
> > >   	iter_fd = bpf_iter_create(bpf_link__fd(link));
> > >   	if (!ASSERT_GT(iter_fd, 0, "create_iter"))
> > > -		goto exit;
> > > +		goto exit_link;
> > >   	while ((len = read(iter_fd, buf, sizeof(buf))) > 0)
> > >   		;
> > > @@ -1534,8 +1534,10 @@ static void test_task_vma_offset_common(struct bpf_iter_attach_opts *opts, bool
> > >   	close(iter_fd);
> > > -exit:
> > > +exit_link:
> > >   	bpf_link__destroy(link);
> > > +exit_skel:
> > > +	bpf_iter_vma_offset__destroy(skel);
> > >   }
> > >   static void test_task_vma_offset(void)
> > 

  reply	other threads:[~2022-10-04 12:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-02 15:11 [PATCH bpf-next] selftests/bpf: Add missing bpf_iter_vma_offset__destroy call Jiri Olsa
2022-10-04  0:12 ` Martin KaFai Lau
2022-10-04  6:38   ` Jiri Olsa
2022-10-04 12:16     ` Jiri Olsa [this message]
2022-10-05 22:58       ` Andrii Nakryiko
2022-10-06  7:03         ` Jiri Olsa

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=YzwjQJurtyF6f0W1@krava \
    --to=olsajiri@gmail.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=kpsingh@chromium.org \
    --cc=kuifeng@fb.com \
    --cc=martin.lau@linux.dev \
    --cc=sdf@google.com \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.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.