On Fri, Jul 12, 2024 at 6:10 AM Peter Zijlstra <pet...@infradead.org> wrote: > > On Thu, Jul 11, 2024 at 09:57:44PM -0700, Andrii Nakryiko wrote: > > > Anyways, if you'd like to use it, it's at [0]. All you should need to > > build and run it is: > > > > $ cd examples/c > > $ make -j$(nproc) uprobe-stress > > $ sudo ./uprobe-stress -tN -aM -mP -fR > > > [0] > > https://github.com/libbpf/libbpf-bootstrap/commit/2f88cef90f9728ec8c7bee7bd48fdbcf197806c3 > > So, I cannot clone that [0] URL I had to click around github shite for a > while to figure out wtf to clone and where your commit lives, turns out > it is:
Sorry, my bad, it's just "normal" Github stuff, but yes, I also find it quite confusing, so should have been more explicit that this is uprobe-stress branch in libbpf/libbpf-bootstrap Github repo. > > $ git clone https://github.com/libbpf/libbpf-bootstrap.git > $ cd libbpf-bootstrap > $ git checkout uprobe-stress Yes, sorry, as I said, I should have been more thorough in my instructions. You did a great job figuring all the above out, the next step is to make sure all the git submodules are checked out, so, in addition to the above you are just missing git submodule initialization: $ git submodule update --init --recursive $ cd examples/c $ make -j%(nproc) uprobe-stress NOTE: Don't run just `make`, because it will build all the examples, which have extra dependencies, and we don't want to go over that with you :) Stick to `make uprobe-stress` to build just an uprobe-stress binary. The only extra thing that you might need (if you don't have that already on your build machine) is development versions of libelf and zlib, as dependencies of libbpf (that would be elfutils-libelf-devel and zlib-devel packages in Fedora, I think). libbpf-bootstrap is trying to be as self-contained and dependency free as possible (which is also why git submodules). You were worried about BTF. This tool doesn't need BTF and it should work without it enabled in kernel config (but if you do want BTF generation to succeed, I think the only kernel build requirement for that is up-to-date pahole from dwarves package). As for the kernel config, I don't think you need anything BPF-specific beyond: CONFIG_BPF=y CONFIG_BPF_EVENTS=y CONFIG_BPF_SYSCALL=y But just in case, we maintain a list of kernel configuration that *all of BPF selftests* require (see [0]), so worst case just append that to your config (but really, above three is probably all you need, assuming you have all the non-BPF perf/tracing/uprobe configs enabled). [0] https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/config > > But then I do the above and I'm greeted with: > > root@ivb-ep:/usr/src/libbpf-bootstrap/examples/c# make -j40 > MKDIR .output > MKDIR .output/libbpf > MKDIR bpftool > LIB libbpf.a > BPFTOOL bpftool/bootstrap/bpftool > make[1]: *** /usr/src/libbpf-bootstrap/libbpf/src: No such file or directory. > Stop. > make: *** [Makefile:87: > /usr/src/libbpf-bootstrap/examples/c/.output/libbpf.a] Error 2 > make: *** Waiting for unfinished jobs.... > make[1]: *** /usr/src/libbpf-bootstrap/bpftool/src: No such file or > directory. Stop. > make: *** [Makefile:95: > /usr/src/libbpf-bootstrap/examples/c/.output/bpftool/bootstrap/bpftool] Error > 2 > > > Now what ?!? > > BPF is ever such unusable shite :/ It's very near as bad as qemu. > Sorry, not going into discussions about this :) I do agree initial setup is not straightforward, and this libbpf-bootstrap repo is actually an attempt to let users start quickly by doing a minimal and more-or-less straightforward BPF setup (which is why I built uprobe-stress on top of libbpf-bootstrap setup instead of BPF selftests; that would be even more painful process for you which I didn't want to force you through, see above about selftests/bpf/config). But just keep in mind that using BPF here isn't some sort of random choice just because I tend to work mostly with BPF. BPF is the only interface to multi-uprobe attachment, it's a lightweight and low-overhead way to know whether uprobes are triggered (I do memory-mapped sharing of per-cpu counters between BPF/kernel and user space, no extra syscall overhead, blocking, or unnecessary memory ordering is added). And in general, whether you like it or not, most people would never care to use uprobes if not for BPF as an interface into that. I'm not trying to convert you into BPF or anything like that, but this has to use BPF for end-to-end testing. But you are close, please don't give up!