[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fXtXgnb4nrVtsoxQ6vj8YtzPicFsad6+jB5UUFqMzg4mw@mail.gmail.com>
Date: Fri, 15 May 2020 07:53:33 -0700
From: Ian Rogers <irogers@...gle.com>
To: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
Cc: Jiri Olsa <jolsa@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Kajol Jain <kjain@...ux.ibm.com>,
Andi Kleen <ak@...ux.intel.com>,
John Garry <john.garry@...wei.com>,
Jin Yao <yao.jin@...ux.intel.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Kim Phillips <kim.phillips@....com>,
Adrian Hunter <adrian.hunter@...el.com>,
Leo Yan <leo.yan@...aro.org>,
LKML <linux-kernel@...r.kernel.org>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 4/8] libbpf hashmap: Localize static hashmap__* symbols
On Fri, May 15, 2020 at 7:29 AM Arnaldo Carvalho de Melo
<arnaldo.melo@...il.com> wrote:
>
> Em Fri, May 15, 2020 at 11:17:07AM +0200, Jiri Olsa escreveu:
> > On Thu, May 14, 2020 at 11:56:20PM -0700, Ian Rogers wrote:
> > > Localize the hashmap__* symbols in libbpf.a. To allow for a version in
> > > libapi.
> > >
> > > Before:
> > > $ nm libbpf.a
> > > ...
> > > 000000000002088a t hashmap_add_entry
> > > 000000000001712a t hashmap__append
> > > 0000000000020aa3 T hashmap__capacity
> > > 000000000002099c T hashmap__clear
> > > 00000000000208b3 t hashmap_del_entry
> > > 0000000000020fc1 T hashmap__delete
> > > 0000000000020f29 T hashmap__find
> > > 0000000000020c6c t hashmap_find_entry
> > > 0000000000020a61 T hashmap__free
> > > 0000000000020b08 t hashmap_grow
> > > 00000000000208dd T hashmap__init
> > > 0000000000020d35 T hashmap__insert
> > > 0000000000020ab5 t hashmap_needs_to_grow
> > > 0000000000020947 T hashmap__new
> > > 0000000000000775 t hashmap__set
> > > 00000000000212f8 t hashmap__set
> > > 0000000000020a91 T hashmap__size
> > > ...
> > >
> > > After:
> > > $ nm libbpf.a
> > > ...
> > > 000000000002088a t hashmap_add_entry
> > > 000000000001712a t hashmap__append
> > > 0000000000020aa3 t hashmap__capacity
> > > 000000000002099c t hashmap__clear
> > > 00000000000208b3 t hashmap_del_entry
> > > 0000000000020fc1 t hashmap__delete
> > > 0000000000020f29 t hashmap__find
> > > 0000000000020c6c t hashmap_find_entry
> > > 0000000000020a61 t hashmap__free
> > > 0000000000020b08 t hashmap_grow
> > > 00000000000208dd t hashmap__init
> > > 0000000000020d35 t hashmap__insert
> > > 0000000000020ab5 t hashmap_needs_to_grow
> > > 0000000000020947 t hashmap__new
> > > 0000000000000775 t hashmap__set
> > > 00000000000212f8 t hashmap__set
> > > 0000000000020a91 t hashmap__size
> > > ...
> >
> > I think this will break bpf selftests which use hashmap,
> > we need to find some other way to include this
> >
> > either to use it from libbpf directly, or use the api version
> > only if the libbpf is not compiled in perf, we could use
> > following to detect that:
> >
> > CFLAGS += -DHAVE_LIBBPF_SUPPORT
> > $(call detected,CONFIG_LIBBPF)
>
> And have it in tools/perf/util/ instead?
>
>
> - Arnaldo
*sigh*
$ make -C tools/testing/selftests/bpf test_hashmap
make: Entering directory
'/usr/local/google/home/irogers/kernel-trees/kernel.org/tip/tools/testing/s
elftests/bpf'
BINARY test_hashmap
/usr/bin/ld: /tmp/ccEGGNw5.o: in function `test_hashmap_generic':
/usr/local/google/home/irogers/kernel-trees/kernel.org/tip/tools/testing/selftests/bpf/test_hashmap.
c:61: undefined reference to `hashmap__new'
...
My preference was to make hashmap a sharable API in tools, to benefit
not just perf but say things like libsymbol, libperf, etc. Moving it
into perf and using conditional compilation is kinda gross but having
libbpf tests depend on libapi also isn't ideal I guess. It is tempting
to just cut a hashmap from fresh cloth to avoid this and to share
among tools/. I don't know if the bpf folks have opinions?
I'll do a v2 using conditional compilation to see how bad it looks.
Thanks,
Ian
Powered by blists - more mailing lists