Skip to content

Add BCC and bpftrace #1822

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add BCC and bpftrace #1822

wants to merge 1 commit into from

Conversation

pmenzel
Copy link
Collaborator

@pmenzel pmenzel commented May 26, 2020

Closes: #1820

[Description][1]:

> # BPF Compiler Collection (BCC)
>
> BCC is a toolkit for creating efficient kernel tracing and manipulation
> programs, and includes several useful tools and examples. It makes use of
> extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature
> that was first added to Linux 3.15. Much of what BCC uses requires Linux 4.1
> and above.
>
> eBPF was [described by](https://lkml.org/lkml/2015/4/14/232) Ingo Molnár as:
>
> > One of the more interesting features in this cycle is the ability to
> > attach eBPF programs (user-defined, sandboxed bytecode executed by the
> > kernel) to kprobes. This allows user-defined instrumentation on a live
> > kernel image that can never crash, hang or interfere with the kernel
> > negatively.
>
> BCC makes BPF programs easier to write, with kernel instrumentation in C
> (and includes a C wrapper around LLVM), and front-ends in Python and lua.
> It is suited for many tasks, including performance analysis and network
> traffic control.

[1]: https://github.com/iovisor/bcc/
@pmenzel
Copy link
Collaborator Author

pmenzel commented May 26, 2020

How do we deal with the Python package?

@donald
Copy link
Collaborator

donald commented May 29, 2020

I wouldn't try to put he python modules into /pkg/python-XXX, because then we'd have to rebuild the package for every python, which would be quite a burden.

It could go into its own package. However, it should go into /pkg only if it has proven its usefulness and is important to multiple users. I don't think it of general value currently (e.g. because it seems that the systems are not even prepared for it, see below), so maybe install it into your home for now, get experience and if you use it routinely and still think its of general value, than suggest to install it globally?

Here's a script to install it into a configurable prefix ( or /dev/shm with TESTING=1) : https://github.molgen.mpg.de/gist/donald/467aa35e3ed3cdca3828658c1246f0d6

buczek@deadbird:~/git/pkg-scripts (master)$ (. /dev/shm/bcc-0.14.0-0/profile  ; /dev/shm/bcc-0.14.0-0/share/bcc/examples/tracing/bitehist.py )
modprobe: FATAL: Module kheaders not found in directory /lib/modules/5.4.21.mx64.323
Unable to find kernel headers. Try rebuilding kernel with CONFIG_IKHEADERS=m (module)
chdir(/lib/modules/5.4.21.mx64.323/build): No such file or directory
Traceback (most recent call last):
  File "/dev/shm/bcc-0.14.0-0/share/bcc/examples/tracing/bitehist.py", line 34, in <module>
    """)
  File "/dev/shm/bcc-0.14.0-0/lib/python3.7/site-packages/bcc/__init__.py", line 356, in __init__
    raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>

@pmenzel
Copy link
Collaborator Author

pmenzel commented May 30, 2020

CONFIG_IKHEADERS:

Enable kernel headers through /sys/kernel/kheaders.tar.xz

So, it just needs the Linux kernel headers files. And the ones in MarIuX are outdated.

$ sudo bee list headers
linux-headers-4.14.76-0.x86_64

@donald
Copy link
Collaborator

donald commented Jun 2, 2020

Should be no problem to enable CONFIG_IKHEADERS with the next kernel builds. I still don't know where to put the note to not forget this.

@wwwutz
Copy link
Collaborator

wwwutz commented Jun 2, 2020

I still don't know where to put the note to not forget this.

like it or not: /src/mariux/beeroot/bee-files.issues

add line: linux Add CONFIGBLA

remove line, when done.

@donald
Copy link
Collaborator

donald commented Jul 5, 2020

Request for CONFIG_IKHEADERS added to /src/mariux/beeroot/bee-files.issues

Sign in to join this conversation on GitHub.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add bpftrace
3 participants