Remove deprecated functions from benchmarks.
Closed this issue · 3 comments
As it stands we use a deprecated function bpf_prog_load_xattr
to open and load our benchmarks. This deprecated version does not exist in newer versions of Libbpf (exists on 0.8 but not on 1.1). The objective is to make our project compliant with the 1.1 version, so we need to substitute that function for the new counterpart. After this change we will have most if not all of the project compliant with the newer versions of Libbpf, helping us to solve issue #34.
Currently all deprecated functions with the exception of bpf_perf_event_read_simple
in xdpdump
have been updated with newer versions that maintain the same functionality. This currently lies in the RmDeprecatedFunc
branch and will be merged into master soon.
Substituting bpf_perf_event_read_simple
has been harder than expected and has lead to many dead ends. I shall describe here what attempts I have made made so that others don't repeat my mistakes.
bpf_perf_event_read_simple
was called in the front-end file. The front-end has to includelibbpf.h
for the functions to do many of the steps to load and attach the programs.libbpf.h
has a conflict withbpf_helpers.h
, which is used in the back-end. This halted research in the solution of using functions likebpf_perf_event_read
orbpf_perf_event_read_value
, as those are located inbpf_helpers.h
- We were given an example from ChatGPT that used the library
bpf_perf.h
to get thebpf_perf_event_read
to the front-end. Sadly, the only instance ofbpf_perf.h
I could find was by cloninggit://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
with a depth of 1, and that instance does not contain any function of the type ofbpf_perf_...
(or any function at all). The file can be found inlinux/tools/lib/perf/include/perf
.
And here are some information sources that may provide useful for whomever tackles this issue next:
- The only relevant information about
bpf_perf_event_read_simple
is located in this issue. It's implicit from it thatperf_buffer__poll
andperf_buffer__consume
may be replacements for the functionality ofbpf_perf_event_read_simple
, however they don't seem as easy to use. - The documentation of what
bpf_perf_event_read_value
can do is found in this link and seems to be a good substitute. Sadly, it seems like that function was made to operate in the back-end of LIBBPF, not the front-end.
Substituting
bpf_perf_event_read_simple
has been harder than expected and has lead to many dead ends. I shall describe here what attempts I have made made so that others don't repeat my mistakes.
bpf_perf_event_read_simple
was called in the front-end file. The front-end has to includelibbpf.h
for the functions to do many of the steps to load and attach the programs.libbpf.h
has a conflict withbpf_helpers.h
, which is used in the back-end. This halted research in the solution of using functions likebpf_perf_event_read
orbpf_perf_event_read_value
, as those are located inbpf_helpers.h
- We were given an example from ChatGPT that used the library
bpf_perf.h
to get thebpf_perf_event_read
to the front-end. Sadly, the only instance ofbpf_perf.h
I could find was by cloninggit://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
with a depth of 1, and that instance does not contain any function of the type ofbpf_perf_...
(or any function at all). The file can be found inlinux/tools/lib/perf/include/perf
.And here are some information sources that may provide useful for whomever tackles this issue next:
- The only relevant information about
bpf_perf_event_read_simple
is located in this issue. It's implicit from it thatperf_buffer__poll
andperf_buffer__consume
may be replacements for the functionality ofbpf_perf_event_read_simple
, however they don't seem as easy to use.- The documentation of what
bpf_perf_event_read_value
can do is found in this link and seems to be a good substitute. Sadly, it seems like that function was made to operate in the back-end of LIBBPF, not the front-end.
I've replaced bpf_perf_event_read_simple
with perf_buffer__new
, following the example of xdp_sample_pkts_user.c.