<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/bpf/runqslower, branch linux-5.16.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.16.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-11-13T01:23:16Z</updated>
<entry>
<title>tools/runqslower: Fix cross-build</title>
<updated>2021-11-13T01:23:16Z</updated>
<author>
<name>Jean-Philippe Brucker</name>
</author>
<published>2021-11-12T15:51:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e4ac80ef8198636a23866a59575917550328886f'/>
<id>urn:sha1:e4ac80ef8198636a23866a59575917550328886f</id>
<content type='text'>
Commit be79505caf3f ("tools/runqslower: Install libbpf headers when
building") uses the target libbpf to build the host bpftool, which
doesn't work when cross-building:

  make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -C tools/bpf/runqslower O=/tmp/runqslower
  ...
    LINK    /tmp/runqslower/bpftool/bpftool
  /usr/bin/ld: /tmp/runqslower/libbpf/libbpf.a(libbpf-in.o): Relocations in generic ELF (EM: 183)
  /usr/bin/ld: /tmp/runqslower/libbpf/libbpf.a: error adding symbols: file in wrong format
  collect2: error: ld returned 1 exit status

When cross-building, the target architecture differs from the host. The
bpftool used for building runqslower is executed on the host, and thus
must use a different libbpf than that used for runqslower itself.
Remove the LIBBPF_OUTPUT and LIBBPF_DESTDIR parameters, so the bpftool
build makes its own library if necessary.

In the selftests, pass the host bpftool, already a prerequisite for the
runqslower recipe, as BPFTOOL_OUTPUT. The runqslower Makefile will use
the bpftool that's already built for selftests instead of making a new
one.

Fixes: be79505caf3f ("tools/runqslower: Install libbpf headers when building")
Signed-off-by: Jean-Philippe Brucker &lt;jean-philippe@linaro.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Reviewed-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Link: https://lore.kernel.org/bpf/20211112155128.565680-1-jean-philippe@linaro.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>tools/runqslower: Install libbpf headers when building</title>
<updated>2021-10-08T18:54:15Z</updated>
<author>
<name>Quentin Monnet</name>
</author>
<published>2021-10-07T19:44:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=be79505caf3f99a2f9cca5946261085b333f7034'/>
<id>urn:sha1:be79505caf3f99a2f9cca5946261085b333f7034</id>
<content type='text'>
API headers from libbpf should not be accessed directly from the
library's source directory. Instead, they should be exported with "make
install_headers". Let's make sure that runqslower installs the
headers properly when building.

We use a libbpf_hdrs target to mark the logical dependency on libbpf's
headers export for a number of object files, even though the headers
should have been exported at this time (since bpftool needs them, and is
required to generate the skeleton or the vmlinux.h).

When descending from a parent Makefile, the specific output directories
for building the library and exporting the headers are configurable with
BPFOBJ_OUTPUT and BPF_DESTDIR, respectively. This is in addition to
OUTPUT, on top of which those variables are constructed by default.

Also adjust the Makefile for the BPF selftests. We pass a number of
variables to the "make" invocation, because we want to point runqslower
to the (target) libbpf shared with other tools, instead of building its
own version. In addition, runqslower relies on (target) bpftool, and we
also want to pass the proper variables to its Makefile so that bpftool
itself reuses the same libbpf.

Signed-off-by: Quentin Monnet &lt;quentin@isovalent.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20211007194438.34443-6-quentin@isovalent.com
</content>
</entry>
<entry>
<title>tools/runqslower: Use __state instead of state</title>
<updated>2021-07-07T16:42:26Z</updated>
<author>
<name>SanjayKumar Jeyakumar</name>
</author>
<published>2021-07-07T05:29:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5616e895ecc56db8ba959e53638031a21353e0e2'/>
<id>urn:sha1:5616e895ecc56db8ba959e53638031a21353e0e2</id>
<content type='text'>
Commit 2f064a59a11f ("sched: Change task_struct::state") renamed task-&gt;state
to task-&gt;__state in task_struct. Fix runqslower to use the new name of the
field.

Fixes: 2f064a59a11f ("sched: Change task_struct::state")
Signed-off-by: SanjayKumar Jeyakumar &lt;vjsanjay@gmail.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20210707052914.21473-1-vjsanjay@gmail.com
</content>
</entry>
<entry>
<title>tools/runqslower: Allow substituting custom vmlinux.h for the build</title>
<updated>2021-03-03T04:14:02Z</updated>
<author>
<name>Andrii Nakryiko</name>
</author>
<published>2021-03-03T00:40:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=303dcc25b5c782547eb13b9f29426de843dd6f34'/>
<id>urn:sha1:303dcc25b5c782547eb13b9f29426de843dd6f34</id>
<content type='text'>
Just like was done for bpftool and selftests in ec23eb705620 ("tools/bpftool:
Allow substituting custom vmlinux.h for the build") and ca4db6389d61
("selftests/bpf: Allow substituting custom vmlinux.h for selftests build"),
allow to provide pre-generated vmlinux.h for runqslower build.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Martin KaFai Lau &lt;kafai@fb.com&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20210303004010.653954-1-andrii@kernel.org
</content>
</entry>
<entry>
<title>bpf: runqslower: Use task local storage</title>
<updated>2021-02-26T19:51:48Z</updated>
<author>
<name>Song Liu</name>
</author>
<published>2021-02-25T23:43:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ced47e30ab8b3ed986e28411f63e041b51c1fdf8'/>
<id>urn:sha1:ced47e30ab8b3ed986e28411f63e041b51c1fdf8</id>
<content type='text'>
Replace hashtab with task local storage in runqslower. This improves the
performance of these BPF programs. The following table summarizes average
runtime of these programs, in nanoseconds:

                          task-local   hash-prealloc   hash-no-prealloc
handle__sched_wakeup             125             340               3124
handle__sched_wakeup_new        2812            1510               2998
handle__sched_switch             151             208                991

Note that, task local storage gives better performance than hashtab for
handle__sched_wakeup and handle__sched_switch. On the other hand, for
handle__sched_wakeup_new, task local storage is slower than hashtab with
prealloc. This is because handle__sched_wakeup_new accesses the data for
the first time, so it has to allocate the data for task local storage.
Once the initial allocation is done, subsequent accesses, as those in
handle__sched_wakeup, are much faster with task local storage. If we
disable hashtab prealloc, task local storage is much faster for all 3
functions.

Signed-off-by: Song Liu &lt;songliubraving@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20210225234319.336131-7-songliubraving@fb.com
</content>
</entry>
<entry>
<title>bpf: runqslower: Prefer using local vmlimux to generate vmlinux.h</title>
<updated>2021-02-26T19:51:48Z</updated>
<author>
<name>Song Liu</name>
</author>
<published>2021-02-25T23:43:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4b0d2d4156cfb9f27d8e52a33d3522a78002fca1'/>
<id>urn:sha1:4b0d2d4156cfb9f27d8e52a33d3522a78002fca1</id>
<content type='text'>
Update the Makefile to prefer using $(O)/vmlinux, $(KBUILD_OUTPUT)/vmlinux
(for selftests) or ../../../vmlinux. These two files should have latest
definitions for vmlinux.h.

Signed-off-by: Song Liu &lt;songliubraving@fb.com&gt;
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20210225234319.336131-6-songliubraving@fb.com
</content>
</entry>
<entry>
<title>tools: Factor Clang, LLC and LLVM utils definitions</title>
<updated>2021-01-29T00:25:34Z</updated>
<author>
<name>Sedat Dilek</name>
</author>
<published>2021-01-28T01:50:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=211a741cd3e124bffdc13ee82e7e65f204e53f60'/>
<id>urn:sha1:211a741cd3e124bffdc13ee82e7e65f204e53f60</id>
<content type='text'>
When dealing with BPF/BTF/pahole and DWARF v5 I wanted to build bpftool.

While looking into the source code I found duplicate assignments in misc tools
for the LLVM eco system, e.g. clang and llvm-objcopy.

Move the Clang, LLC and/or LLVM utils definitions to tools/scripts/Makefile.include
file and add missing includes where needed. Honestly, I was inspired by the commit
c8a950d0d3b9 ("tools: Factor HOSTCC, HOSTLD, HOSTAR definitions").

I tested with bpftool and perf on Debian/testing AMD64 and LLVM/Clang v11.1.0-rc1.

Build instructions:

[ make and make-options ]
MAKE="make V=1"
MAKE_OPTS="HOSTCC=clang HOSTCXX=clang++ HOSTLD=ld.lld CC=clang LD=ld.lld LLVM=1 LLVM_IAS=1"
MAKE_OPTS="$MAKE_OPTS PAHOLE=/opt/pahole/bin/pahole"

[ clean-up ]
$MAKE $MAKE_OPTS -C tools/ clean

[ bpftool ]
$MAKE $MAKE_OPTS -C tools/bpf/bpftool/

[ perf ]
PYTHON=python3 $MAKE $MAKE_OPTS -C tools/perf/

I was careful with respecting the user's wish to override custom compiler, linker,
GNU/binutils and/or LLVM utils settings.

Signed-off-by: Sedat Dilek &lt;sedat.dilek@gmail.com&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Jiri Olsa &lt;jolsa@redhat.com&gt; # tools/build and tools/perf
Link: https://lore.kernel.org/bpf/20210128015117.20515-1-sedat.dilek@gmail.com
</content>
</entry>
<entry>
<title>tools/runqslower: Build bpftool using HOSTCC</title>
<updated>2020-11-11T20:18:22Z</updated>
<author>
<name>Jean-Philippe Brucker</name>
</author>
<published>2020-11-10T16:43:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2d9393fefb506fb8c8a483e5dc9bbd7774657b89'/>
<id>urn:sha1:2d9393fefb506fb8c8a483e5dc9bbd7774657b89</id>
<content type='text'>
When cross building runqslower for an other architecture, the
intermediate bpftool used to generate a skeleton must be built using the
host toolchain. Pass HOSTCC and HOSTLD, defined in Makefile.include, to
the bpftool Makefile.

Signed-off-by: Jean-Philippe Brucker &lt;jean-philippe@linaro.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20201110164310.2600671-7-jean-philippe@linaro.org
</content>
</entry>
<entry>
<title>tools/runqslower: Enable out-of-tree build</title>
<updated>2020-11-11T20:18:22Z</updated>
<author>
<name>Jean-Philippe Brucker</name>
</author>
<published>2020-11-10T16:43:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=85e59344d0790379e063bf3cd3dd0fe91ce3b505'/>
<id>urn:sha1:85e59344d0790379e063bf3cd3dd0fe91ce3b505</id>
<content type='text'>
Enable out-of-tree build for runqslower. Only set OUTPUT=.output if it
wasn't already set by the user.

Signed-off-by: Jean-Philippe Brucker &lt;jean-philippe@linaro.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20201110164310.2600671-6-jean-philippe@linaro.org
</content>
</entry>
<entry>
<title>tools/runqslower: Use Makefile.include</title>
<updated>2020-11-11T20:18:22Z</updated>
<author>
<name>Jean-Philippe Brucker</name>
</author>
<published>2020-11-10T16:43:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3290996e713315dfc9589e2c340a4c4997d90be8'/>
<id>urn:sha1:3290996e713315dfc9589e2c340a4c4997d90be8</id>
<content type='text'>
Makefile.include defines variables such as OUTPUT and CC for out-of-tree
build and cross-build. Include it into the runqslower Makefile and use
its $(QUIET*) helpers.

Signed-off-by: Jean-Philippe Brucker &lt;jean-philippe@linaro.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20201110164310.2600671-5-jean-philippe@linaro.org
</content>
</entry>
</feed>
