BPF List
 help / color / mirror / Atom feed
From: Alan Maguire <alan.maguire@oracle.com>
To: Eduard Zingerman <eddyz87@gmail.com>, andrii@kernel.org
Cc: acme@redhat.com, ast@kernel.org, daniel@iogearbox.net,
	jolsa@kernel.org, martin.lau@linux.dev, song@kernel.org,
	yonghong.song@linux.dev, john.fastabend@gmail.com,
	kpsingh@kernel.org, sdf@google.com, haoluo@google.com,
	mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org,
	mykolal@fb.com, thinker.li@gmail.com, bentiss@kernel.org,
	tanggeliang@kylinos.cn, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next 5/5] selftests/bpf: add kfunc_call test for simple dtor in bpf_testmod
Date: Thu, 20 Jun 2024 10:17:57 +0100	[thread overview]
Message-ID: <fd9268b8-994b-4b4f-a4bb-d5852c823152@oracle.com> (raw)
In-Reply-To: <e17f8c4d644a6f4aa80de092ee29e6c1e5e77c52.camel@gmail.com>

On 19/06/2024 21:12, Eduard Zingerman wrote:
> On Wed, 2024-06-19 at 18:42 +0100, Alan Maguire wrote:
> 
> [...]
> 
>> Sorry, I'm not following here. So I think what you'd like is a way to
>> verify that the dtor actually runs, is that right? The problem there is
>> that the map cleanup gets run when the skeleton gets destroyed, but then
>> it's too late then to collect a count value via that BPF object.
>>
>> The only thing I can think of is to create an additional tracing object
>> that we separately load/attach to bpf_testmod_ctx_release() prior to
>> running kfunc call tests to verify that the destructor fires on cleanup
>> of the kfunc test skeletons. Is that what you have in mind? Thanks!
> 
> Tracing program could be an option, yes.
> I was thinking about some map created by the driver program (the one
> from prog_tests) that could be updated by destructor.
> There is a question of how to pass the map FD to the kfunc,
> probably it could be passed in a constructor for the kfunc and stored
> in the context. But tracing program sounds good as well.
> 
> Again, it might be the case that checking that registration logic
> works is sufficient. In such a case bodies of both kfunc and BPF
> program could be empty.
> 

I explored this further. Even adding a separate skeleton with tracing
prog to catch release is insufficient because the map free is deferred
and the test can have already run by the time the deferred map free is
called. Whatever mechanism we use to detect release would be subject to
the timing of that it seems. This seems like a recipe for a flaky test
and I'd rather not add sleeps etc so I've stuck with the current
approach which exercises the dtor codepaths but doesn't verify release.
Thanks!

Alan

  reply	other threads:[~2024-06-20  9:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240618160454.801527-1-alan.maguire@oracle.com>
     [not found] ` <20240618160454.801527-6-alan.maguire@oracle.com>
     [not found]   ` <4321b99db5b362e278b1f37d6bd9b9a43d859d63.camel@gmail.com>
     [not found]     ` <76509fc5411e35a4820c333abca155b3fa4e5b84.camel@gmail.com>
2024-06-19 16:45       ` [PATCH bpf-next 5/5] selftests/bpf: add kfunc_call test for simple dtor in bpf_testmod Alan Maguire
2024-06-19 16:54         ` Eduard Zingerman
2024-06-19 17:42           ` Alan Maguire
2024-06-19 20:12             ` Eduard Zingerman
2024-06-20  9:17               ` Alan Maguire [this message]
2024-06-20 11:02                 ` Eduard Zingerman
2024-06-18 16:24 [PATCH bpf-next 0/5] bpf: resilient split BTF followups Alan Maguire
2024-06-18 16:24 ` [PATCH bpf-next 5/5] selftests/bpf: add kfunc_call test for simple dtor in bpf_testmod Alan Maguire

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=fd9268b8-994b-4b4f-a4bb-d5852c823152@oracle.com \
    --to=alan.maguire@oracle.com \
    --cc=acme@redhat.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bentiss@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=mykolal@fb.com \
    --cc=nathan@kernel.org \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=tanggeliang@kylinos.cn \
    --cc=thinker.li@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox