[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbaBcySm3bVumBTrkHMmVDWEVxckdVKvUk=4j9HhSsmBA@mail.gmail.com>
Date: Mon, 6 Dec 2021 18:37:55 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Song Liu <song@...nel.org>
Cc: bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Kernel Team <kernel-team@...com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCH bpf-next] perf/bpf_counter: use bpf_map_create instead of bpf_create_map
On Mon, Dec 6, 2021 at 3:08 PM Song Liu <song@...nel.org> wrote:
>
> bpf_create_map is deprecated. Replace it with bpf_map_create.
>
> Fixes: 992c4225419a ("libbpf: Unify low-level map creation APIs w/ new bpf_map_create()")
This is not a bug fix, it's an improvement. So I don't think "Fixes: "
is warranted here, tbh.
> Signed-off-by: Song Liu <song@...nel.org>
> ---
> tools/perf/util/bpf_counter.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
> index c17d4a43ce065..ed150a9b3a0c0 100644
> --- a/tools/perf/util/bpf_counter.c
> +++ b/tools/perf/util/bpf_counter.c
> @@ -320,10 +320,10 @@ static int bperf_lock_attr_map(struct target *target)
> }
>
> if (access(path, F_OK)) {
> - map_fd = bpf_create_map(BPF_MAP_TYPE_HASH,
> + map_fd = bpf_map_create(BPF_MAP_TYPE_HASH, NULL,
I think perf is trying to be linkable with libbpf as a shared library,
so on some older versions of libbpf bpf_map_create() won't be (yet)
available. So to make this work, I think you'll need to define your
own weak bpf_map_create function that will use bpf_create_map().
> sizeof(struct perf_event_attr),
> sizeof(struct perf_event_attr_map_entry),
> - ATTR_MAP_SIZE, 0);
> + ATTR_MAP_SIZE, NULL);
> if (map_fd < 0)
> return -1;
>
> --
> 2.30.2
>
Powered by blists - more mailing lists