BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>,
	bpf@vger.kernel.org,  ast@kernel.org, andrii@kernel.org,
	daniel@iogearbox.net, kafai@meta.com,  kernel-team@meta.com
Cc: Mykyta Yatsenko <yatsenko@meta.com>
Subject: Re: [PATCH bpf-next 2/3] libbpf: split bpf object load into prepare/load
Date: Sat, 01 Mar 2025 00:12:52 -0800	[thread overview]
Message-ID: <5d7fb7202625b999cb77a1e010ba6f7099dbb561.camel@gmail.com> (raw)
In-Reply-To: <20250228175255.254009-3-mykyta.yatsenko5@gmail.com>

On Fri, 2025-02-28 at 17:52 +0000, Mykyta Yatsenko wrote:

[...]

> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 9ced1ce2334c..dd2f64903c3b 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -4858,7 +4858,7 @@ bool bpf_map__autocreate(const struct bpf_map *map)
>  
>  int bpf_map__set_autocreate(struct bpf_map *map, bool autocreate)
>  {
> -	if (map->obj->state >= OBJ_LOADED)
> +	if (map->obj->state >= OBJ_PREPARED)
>  		return libbpf_err(-EBUSY);

I looked through logic in patches #1 and #2 and changes look correct.
Running tests under valgrind does not show issues with this feature.
The only ask from my side is to consider doing ==/!= comparisons in
cases like above. E.g. it seems that `map->obj->state != OBJ_OPENED`
is a bit simpler to understand when reading condition above.
Or maybe that's just me.

>  	map->autocreate = autocreate;

[...]


  parent reply	other threads:[~2025-03-01  8:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 17:52 [PATCH bpf-next 0/3] Introduce bpf_object__prepare Mykyta Yatsenko
2025-02-28 17:52 ` [PATCH bpf-next 1/3] libbpf: introduce more granular state for bpf_object Mykyta Yatsenko
2025-02-28 22:20   ` Andrii Nakryiko
2025-02-28 22:35   ` Andrii Nakryiko
2025-02-28 17:52 ` [PATCH bpf-next 2/3] libbpf: split bpf object load into prepare/load Mykyta Yatsenko
2025-02-28 22:31   ` Andrii Nakryiko
2025-03-01  8:12   ` Eduard Zingerman [this message]
2025-03-01 21:45     ` Mykyta Yatsenko
2025-03-03 21:38       ` Andrii Nakryiko
2025-03-03 22:04         ` Eduard Zingerman
2025-03-03 23:27           ` Andrii Nakryiko
2025-02-28 17:52 ` [PATCH bpf-next 3/3] selftests/bpf: add tests for bpf_object__prepare Mykyta Yatsenko
2025-02-28 22:39 ` [PATCH bpf-next 0/3] Introduce bpf_object__prepare Andrii Nakryiko

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=5d7fb7202625b999cb77a1e010ba6f7099dbb561.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=kafai@meta.com \
    --cc=kernel-team@meta.com \
    --cc=mykyta.yatsenko5@gmail.com \
    --cc=yatsenko@meta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox