platform/upstream/bcc.git
2 years agodbus-glib-receiving: new options: --raw and --output 63/271463/5 accepted/tizen_7.0_unified accepted/tizen_7.0_unified_hotfix tizen_7.0 tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.062846 accepted/tizen/7.0/unified/hotfix/20221116.110623 accepted/tizen/unified/20220713.144350 submit/tizen/20220713.022109 tizen_7.0_m2_release
Hubert Kowalski [Mon, 7 Feb 2022 15:39:25 +0000 (16:39 +0100)]
dbus-glib-receiving: new options: --raw and --output

Change-Id: Ie63bcea512ff33565b7be2fb87adb063b9244da7

2 years agodbus tools: print averages 62/271462/5
Adrian Szyndela [Fri, 28 Jan 2022 13:59:10 +0000 (14:59 +0100)]
dbus tools: print averages

This adds collecting and printing of average timings for
the dbus tools. Unfortunately, it is in a copy & paste style
as I didn't find a way to share BPF maps code between the tools.
I've even tried static implementation in an included header. Doesn't work.
Apparently bcc needs it in one file, analysed by bcc, before
it is passed to libllvm's preprocessor.

Change-Id: Id1c259b47ee7cfb0b05ac36d4800ea041af11e9c

2 years agodbus-latency: rework command line options 61/271461/5
Adrian Szyndela [Wed, 26 Jan 2022 10:36:05 +0000 (11:36 +0100)]
dbus-latency: rework command line options

Remove '--histogram', it is now default.
Make 'count' option work.
Add '--no-gio' and '--no-libdbus' for flexibility.

Change-Id: If1cdc3e9b9d0f99fc636517894b25ae7bea6fa64

2 years agodbus-tools: new tools for message path in glib 60/271460/5
Adrian Szyndela [Tue, 18 Jan 2022 14:43:29 +0000 (15:43 +0100)]
dbus-tools: new tools for message path in glib

Add new tools for measurements:
dbus-glib-client-sending - for gio API usage
dbus-glib-sending - for threads gap while sending
dbus-glib-receiving - for threads gap while receiving

Change-Id: I3d26346df5a3f7273794d4e240acdc350fda2d67

2 years agodbus tools: switch tools to python3 44/271444/1
Adrian Szyndela [Mon, 21 Feb 2022 09:50:12 +0000 (10:50 +0100)]
dbus tools: switch tools to python3

New version of bcc is built for python3.
This is a convenience change for our tools, to run them
smoothly when both python3 and python2 are installed on the system,
and /usr/bin/python points to python2.

Change-Id: I782972cee553af9a27f2b013b48eef70b94a7591

2 years agofix running eBPF programs on 64-bit architectures 43/271443/1
Adrian Szyndela [Mon, 21 Feb 2022 08:58:21 +0000 (09:58 +0100)]
fix running eBPF programs on 64-bit architectures

32-bit architectures are not supported by the original bcc.
Our changes, which were supposed to support bcc on armv7l,
appeared to be working also with 64-bit architectures
before the bcc upgrade. Now, they break running the programs
on aarch64. So, let's step back, bring back aarch64, and hack it once again,
if ever needed.

Change-Id: I9b30b8f4267d36008ea4b753e3832514ab1682b6

2 years agopackaging: enable building for aarch64 38/271438/1
Adrian Szyndela [Fri, 18 Feb 2022 13:02:53 +0000 (14:02 +0100)]
packaging: enable building for aarch64

Change-Id: Id8c602cb897c3223ee863d4d81d6f402f73ae188

2 years agopackaging: bump version to v0.24.0 77/271277/1
Adrian Szyndela [Thu, 17 Feb 2022 12:08:43 +0000 (13:08 +0100)]
packaging: bump version to v0.24.0

Change-Id: Ifc55899f22eb3ae9e0b5b76e8eb41d15d19110e7

2 years agoMerge 'v0.24.0' into tizen 76/271276/1
Adrian Szyndela [Thu, 17 Feb 2022 12:08:00 +0000 (13:08 +0100)]
Merge 'v0.24.0' into tizen

Change-Id: I7826c3d82ddea6b3918020acd53c85f8995335be

2 years agoadd BPF syscall number for x86 arch 61/271261/1 accepted/tizen/unified/20220217.204833 submit/tizen/20220217.092523
Adrian Szyndela [Thu, 17 Feb 2022 08:15:42 +0000 (09:15 +0100)]
add BPF syscall number for x86 arch

Change-Id: Ic47df8ca4ab848dbec8a934c105680f43c34fc29

2 years agopackaging: bump version to 0.21.0 90/271190/2
Adrian Szyndela [Wed, 16 Feb 2022 22:02:34 +0000 (23:02 +0100)]
packaging: bump version to 0.21.0

Change-Id: I40efa640a63c6ff91d56ac5f2e6ce42879ae4a55

2 years agoMerge branch 'upstream' into tizen 89/271189/2
Adrian Szyndela [Wed, 16 Feb 2022 16:46:52 +0000 (17:46 +0100)]
Merge branch 'upstream' into tizen

Change-Id: Ia7bec8aef691640dd8f586752307e2d4cb908810

2 years agoRemoved erroneous 'if' statement in get_delay() 81/269581/4
Hubert Kowalski [Tue, 18 Jan 2022 12:41:25 +0000 (13:41 +0100)]
Removed erroneous 'if' statement in get_delay()

That 'if' statement will break average val calculation after 1000 hits.

Change-Id: I77689b6dd1e8fb12925eae47c3cee2cfeacdd05c

2 years agoupdate debian changelog for release v0.24.0 upstream v0.24.0
Yonghong Song [Fri, 14 Jan 2022 17:26:33 +0000 (09:26 -0800)]
update debian changelog for release v0.24.0

  * Support for kernel up to 5.16
  * bcc tools: update for trace.py, sslsniff.py, tcptop.py, hardirqs.py, etc.
  * new libbpf tools: bashreadline
  * allow specify wakeup_events for perf buffer
  * support BPF_MAP_TYPE_{INODE, TASK}_STORAGE maps
  * remove all deprecated libbpf function usage
  * remove P4/B language support
  * major test infra change, using github actions now
  * doc update, bug fixes and other tools improvement

Signed-off-by: Yonghong Song <yhs@fb.com>
2 years agolibbpf: Fix kernel BTF detection logic
Mauricio Vásquez [Thu, 13 Jan 2022 19:39:33 +0000 (14:39 -0500)]
libbpf: Fix kernel BTF detection logic

bpf_has_kernel_btf() is used to check whether the kernel has BTF or not.
It's part of the logic that checks if kfunc and lsm programs are supported.
Before this commit it used libbpf_find_vmlinux_btf_id(), this function
calls btf__load_vmlinux_btf() that tries to load the BTF from different
places, the canonical vmlinux in sysfs and other locations.

This is not accurate as kfunc and lsm programs require to have the BTF
file exposed directly by the kernel (CONFIG_DEBUG_INFO_BTF should be set).
This commit updates that function to check if BTF is exposed directly
by the kernel.

This was causing opensnoop to try to use kfunc programs (instead of
kprobes) in systems where they are not supported:

$ ls /usr/lib/debug/boot/vmlinux-$(uname -r)
/usr/lib/debug/boot/vmlinux-5.11.0-38-generic

$ cat /boot/config-$(uname -r) | grep -i CONFIG_DEBUG_INFO_BTF
$ sudo stat /sys/kernel/btf/vmlinux
stat: cannot stat '/sys/kernel/btf/vmlinux': No such file or directory

$ sudo python3 /usr/share/bcc/tools/opensnoop
bpf: Failed to load program: Invalid argument

Traceback (most recent call last):
  File "/usr/share/bcc/tools/opensnoop", line 321, in <module>
    b = BPF(text=bpf_text)
  File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 483, in __init__
    self._trace_autoload()
  File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 1466, in _trace_autoload
    self.attach_kretfunc(fn_name=func_name)
  File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 1140, in attach_kretfunc
    fn = self.load_func(fn_name, BPF.TRACING)
  File "/usr/lib/python3/dist-packages/bcc/__init__.py", line 522, in load_func
    raise Exception("Failed to load BPF program %s: %s" %
Exception: Failed to load BPF program b'kretfunc____x64_sys_open': Invalid argument

Fixes: 1ad2656a1d9c ("Add support_kfunc function to BPF object")

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2 years agoSync with latest libbpf repo
Yonghong Song [Fri, 14 Jan 2022 06:35:44 +0000 (22:35 -0800)]
Sync with latest libbpf repo

Sync up to the following commit:
  22411acc4b2c ci: Add userfaultfd kernel config

Signed-off-by: Yonghong Song <yhs@fb.com>
2 years agotools/trace.py: aggregate trace events by '-A' option
zhenwei pi [Thu, 13 Jan 2022 11:56:32 +0000 (19:56 +0800)]
tools/trace.py: aggregate trace events by '-A' option

Orignally we can save the backtrace of a specified function into a
text file, then try to analyze the messy trace to guess why the
function is called.

To make the work easier, aggregate amount of trace by -A with -M EVENTS.
A typical example:
1, if we find that the sys CPU utilization is higher by 'top' command
2, then find that the timer interrupt is more normal by 'irqtop' command
3, to confirm kernel timer setting frequence by 'funccount -i 1 clockevents_program_event'
4, to trace timer setting by 'trace clockevents_program_event -K -A -M 1000'

1294576 1294584 CPU 0/KVM       clockevents_program_event
        clockevents_program_event+0x1 [kernel]
        hrtimer_start_range_ns+0x209 [kernel]
        start_sw_timer+0x173 [kvm]
        restart_apic_timer+0x6c [kvm]
        kvm_set_msr_common+0x442 [kvm]
        __kvm_set_msr+0xa2 [kvm]
        kvm_emulate_wrmsr+0x36 [kvm]
        vcpu_enter_guest+0x326 [kvm]
        kvm_arch_vcpu_ioctl_run+0xcc [kvm]
        kvm_vcpu_ioctl+0x22f [kvm]
        do_vfs_ioctl+0xa1 [kernel]
        ksys_ioctl+0x60 [kernel]
        __x64_sys_ioctl+0x16 [kernel]
        do_syscall_64+0x59 [kernel]
        entry_SYSCALL_64_after_hwframe+0x44 [kernel]
-->COUNT 271

...
Then we can know that 271 timer setting in recent 1000(~27%) occurs in
KVM code path.

To avoid too large size of a dictionary in python, -A works always with
-M.

Also fix several minor changes to keep 'trace -h' aligned with trace_example.txt.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2 years agoMerge pull request #3806 from davemarchevsky/davemarchevsky_rw_engine_tests
Dave Marchevsky [Wed, 12 Jan 2022 02:04:15 +0000 (21:04 -0500)]
Merge pull request #3806 from davemarchevsky/davemarchevsky_rw_engine_tests

Add rwengine=OFF test run, disable tests we expect to fail during it

2 years agoAdd RW_ENGINE_ENABLED=OFF test run for ubuntu Debug build
Dave Marchevsky [Wed, 12 Jan 2022 00:08:13 +0000 (19:08 -0500)]
Add RW_ENGINE_ENABLED=OFF test run for ubuntu Debug build

2 years agoDisable tests that will fail when rwengine=off
Dave Marchevsky [Tue, 11 Jan 2022 23:42:20 +0000 (18:42 -0500)]
Disable tests that will fail when rwengine=off

When ENABLE_LLVM_NATIVECODEGEN is OFF, the bpf module rw_engine code
will not be used. This is the code that generates custom sscanf and
printf functions for BPF map defs. These generated functions are used
to serialize arguments to update_value (and similar calls which take
string as input) to the correct key / value types.

It's still possible to use update_value and its ilk without rw_engine
enabled, just need to use the variants that take raw bytes and do
serialization manually. In the future we can add some simple
sscanf/printfs for common types that can be used without LLVM
generation.

For now, when rw_engine is disabled, it's fine to skip tests that
require these autogenerated functions.

2 years agoAdd perf_reader_consume
Dave Marchevsky [Tue, 11 Jan 2022 06:30:13 +0000 (01:30 -0500)]
Add perf_reader_consume

In order to read 'remainder' events from perf buffers w/ 'wakeup_events
> 1', an API to force reading from a program's perf buffers regardless
of whether their fds are in "ready to read" state is necessary. This
commit introduces such an API, perf_reader_consume, modeled after
libbpf's perf_buffer__consume.

Future work will refactor bcc to use libbpf's perf buffer
support as much as possible instead of duplicating functionality. For
now, since #3801 was commited let's add this piece of missing
functionality.

2 years agoMerge pull request #3802 from thcipriani/patch-1
Dave Marchevsky [Mon, 10 Jan 2022 20:30:15 +0000 (15:30 -0500)]
Merge pull request #3802 from thcipriani/patch-1

Typo "flgas" -> "flags"

2 years agoremove extra spaces (#3804)
Rong Tao [Mon, 10 Jan 2022 16:01:50 +0000 (00:01 +0800)]
remove extra spaces (#3804)

remove extra spaces

2 years agoMerge pull request #3803 from iovisor/davemarchevsky-patch-5
Dave Marchevsky [Sun, 9 Jan 2022 22:55:45 +0000 (17:55 -0500)]
Merge pull request #3803 from iovisor/davemarchevsky-patch-5

Add davemarchevsky to CODEOWNERS for everything

2 years agoAdd davemarchevsky to CODEOWNERS for everything
Dave Marchevsky [Sun, 9 Jan 2022 22:14:26 +0000 (17:14 -0500)]
Add davemarchevsky to CODEOWNERS for everything

I can't figure out how to get emailed for all PRs, and I'm doing reviews for the whole repo, so add self to codeowners everywhere.

2 years agoTypo "flgas" -> "flags"
Tyler Cipriani [Sun, 9 Jan 2022 21:38:26 +0000 (14:38 -0700)]
Typo "flgas" -> "flags"

2 years agoMerge pull request #3801 from chenhengqi/issue-3793
Dave Marchevsky [Sun, 9 Jan 2022 09:52:47 +0000 (04:52 -0500)]
Merge pull request #3801 from chenhengqi/issue-3793

bcc: Allow specify wakeup_events for perf buffer

2 years agolibbpf-tools: README how to update libbpf submodule
Liz Rice [Fri, 7 Jan 2022 14:51:36 +0000 (14:51 +0000)]
libbpf-tools: README how to update libbpf submodule

An outdated libbpf submodule can cause the libbpf-tools `make` to fail. Adding note to the README on how to update it.

2 years agoreallocarray: eliminate compilation warnings (#3798)
Rong Tao [Sat, 8 Jan 2022 19:36:00 +0000 (03:36 +0800)]
reallocarray: eliminate compilation warnings (#3798)

there are compile warnings below for klockstat.

```bash
  CC       klockstat.o
klockstat.c: In function ‘print_stats’:
klockstat.c:396:12: warning: implicit declaration of function ‘reallocarray’; did you mean ‘realloc’? [-Wimplicit-function-declaration]
    stats = reallocarray(stats, stats_sz, sizeof(void *));
            ^~~~~~~~~~~~
            realloc
klockstat.c:396:10: warning: assignment to ‘struct stack_stat **’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    stats = reallocarray(stats, stats_sz, sizeof(void *));
          ^
  BINARY   klockstat
```

Defining _GNU_SOURCE fixed the problem.

2 years agobcc: Allow specify wakeup_events for perf buffer
Hengqi Chen [Sat, 8 Jan 2022 14:47:54 +0000 (22:47 +0800)]
bcc: Allow specify wakeup_events for perf buffer

This commit adds a new option `wakeup_events` to the open_perf_buffer API.
This provides an alternative to solve #3793.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agoMerge pull request #3794 from etep/vdso-detection-fix
Dave Marchevsky [Fri, 7 Jan 2022 20:36:43 +0000 (15:36 -0500)]
Merge pull request #3794 from etep/vdso-detection-fix

bcc_syms.cc: bug fix; identify VDSO using 'name' vs. 'path'

2 years agobcc_syms.cc: bug fix; identify VDSO using 'name' vs. 'path' (use of path incorrectly...
Pete Stevenson [Thu, 6 Jan 2022 23:09:54 +0000 (15:09 -0800)]
bcc_syms.cc: bug fix; identify VDSO using 'name' vs. 'path' (use of path incorrectly compares /proc/<pid>/root[vdso] with [vdso]).

Signed-off-by: Pete Stevenson <jps@pixielabs.ai>
2 years agoMerge pull request #3796 from davemarchevsky/davemarchevsky_klockstat_fixups
Dave Marchevsky [Fri, 7 Jan 2022 03:50:32 +0000 (22:50 -0500)]
Merge pull request #3796 from davemarchevsky/davemarchevsky_klockstat_fixups

libbpf-tools/klockstat: no more rlimit bumping + add comment

2 years agolibbpf-tools/klockstat: no more rlimit bumping + add comment
Dave Marchevsky [Fri, 7 Jan 2022 03:19:36 +0000 (22:19 -0500)]
libbpf-tools/klockstat: no more rlimit bumping + add comment

The PR adding the libbpf-tools port of klockstat was sitting in a
mergeable state for some time. Meanwhile, libbpf stopped exposing
rlimit_memlock bumping API and now does the rlimit bump automatically if
necessary. So remove the bump_rlimit_memlock call and set libbpf strict
mode for this tool.

Also, add a comment (from @brho's PR summary in #3688) detailing the
differences in default behavior between the libbpf-tools and bcc-python
versions.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
2 years agoMerge pull request #3795 from Rtoax/patch-7
Dave Marchevsky [Fri, 7 Jan 2022 02:36:12 +0000 (21:36 -0500)]
Merge pull request #3795 from Rtoax/patch-7

`-4` is better

2 years ago`-4` is better
Rong Tao [Fri, 7 Jan 2022 02:34:40 +0000 (10:34 +0800)]
`-4` is better

2 years agoMerge pull request #3688 from brho/master
Dave Marchevsky [Thu, 6 Jan 2022 20:27:02 +0000 (15:27 -0500)]
Merge pull request #3688 from brho/master

libbpf-tools: add klockstat

2 years agolibbpf-tools: fix dev_t type issue
Wei Fu [Tue, 28 Dec 2021 15:21:20 +0000 (23:21 +0800)]
libbpf-tools: fix dev_t type issue

The vmlinux.h uses u32 to define dev_t. But the user-space process uses
<sys/types.h> which uses 8 bytes for dev_t. When the libbpf uses mapped
memory to update .rodata, it might override other variable's value. We
should use u32 to fix it.

And also fix `biosnoop -d $dev-name` issue.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2 years agobcc: Replace deprecated libbpf APIs
Hengqi Chen [Wed, 5 Jan 2022 15:30:40 +0000 (23:30 +0800)]
bcc: Replace deprecated libbpf APIs

Several libbpf APIs used by BCC are deprecated, which causes
annoying compilation warnings. Update BCC to use the replacement
APIs. The code is mainly borrowed from libbpf itself.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agobcc/docs: fix broken links in reference guide (#3789)
Hengqi Chen [Wed, 5 Jan 2022 16:13:51 +0000 (00:13 +0800)]
bcc/docs: fix broken links in reference guide (#3789)

fix broken links in reference guide

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agoexamples: Add local storage examples
Hengqi Chen [Tue, 4 Jan 2022 16:02:49 +0000 (00:02 +0800)]
examples: Add local storage examples

Add examples to demostrate BPF_{INODE, TASK}_STORAGE usage.

$ sudo ./task_storage.py
b'              nc-668442  [000] d..21 1221279.139354: bpf_trace_printk: inet_listen entry: store timestamp 1221271907116757'
b'              nc-668442  [000] d..21 1221279.139375: bpf_trace_printk: inet_listen exit: cost 26us'

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agobcc: support BPF_MAP_TYPE_{INODE, TASK}_STORAGE maps
Hengqi Chen [Tue, 4 Jan 2022 16:00:39 +0000 (00:00 +0800)]
bcc: support BPF_MAP_TYPE_{INODE, TASK}_STORAGE maps

Add support for BPF_MAP_TYPE_{INODE, TASK}_STORAGE in BCC.
Like sk local storage, this commit allows creating inode/task
local storage using BPF_{INODE, TASK}_STORAGE macros, and
manipulating maps using map.{inode, task}_storage_get() and
map.{inode, task}_storage_delete() helpers.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agoVendor deprecated btf_ext APIs and structs
Dave Marchevsky [Wed, 29 Dec 2021 23:48:39 +0000 (18:48 -0500)]
Vendor deprecated btf_ext APIs and structs

Some btf_ext-related APIs in libbpf are being deprecated because they
make incorrect assumptions. They're being used only by bcc currently, so
vendor them before they get deleted.

After / as part of #3660, may need to revisit the incorrect assumptions
being made here.

The functions and structs were ripped directly from libbpf with minimal
changes:
  * Change void* arithmetic to uint8_t
  * __u32 -> uint32_t and similar
  * Add a wrapping namespace
  * `rec_size` functions were not needed - just grab the rec_size
directly since type is no longer opaque to bcc

2 years agobcc: Fix array type handling due to llvm changes
Hengqi Chen [Mon, 3 Jan 2022 13:36:48 +0000 (21:36 +0800)]
bcc: Fix array type handling due to llvm changes

The llvm commit aee49255074f ([0]) changes array type
from `int [4]` to `int[4]` (with space removed), which
breaks the assumption in BCC. This commit fixes this
issue and adds a comment to the related code. While at
it, also remove execution permission of file `table.py`.

  [0]: https://github.com/llvm/llvm-project/commit/aee49255074fd4ef38d97e6e70cbfbf2f9fd0fa7

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agolibbpf-tools: fix fentry prog in tcprtt (#3757)
chendotjs [Tue, 4 Jan 2022 19:26:15 +0000 (03:26 +0800)]
libbpf-tools: fix fentry prog in tcprtt (#3757)

This commit fixes judgement if tcp_rcv_established fentry exists and
fentry prog by introducing BPF_CORE_READ.

Signed-off-by: chendotjs <chendotjs@gmail.com>
2 years agoMerge pull request #3779 from davemarchevsky/davemarchevsky_build_libbpf_tools
Dave Marchevsky [Sat, 1 Jan 2022 21:37:40 +0000 (16:37 -0500)]
Merge pull request #3779 from davemarchevsky/davemarchevsky_build_libbpf_tools

Build libbpf tools as part of fedora test run

2 years agoBuild libbpf-tools as part of test workflow on fedora
Dave Marchevsky [Thu, 30 Dec 2021 21:08:44 +0000 (16:08 -0500)]
Build libbpf-tools as part of test workflow on fedora

2 years agoMerge pull request #3778 from davemarchevsky/davemarchevsky_fedora_tests
Dave Marchevsky [Wed, 29 Dec 2021 19:37:07 +0000 (14:37 -0500)]
Merge pull request #3778 from davemarchevsky/davemarchevsky_fedora_tests

add fedora docker tests + move dockerfiles to a new dir

2 years agoadd fedora docker tests + move dockerfiles to a new dir
Dave Marchevsky [Wed, 29 Dec 2021 03:45:22 +0000 (22:45 -0500)]
add fedora docker tests + move dockerfiles to a new dir

Dockerfiles are cluttering up the main repo dir, so move them to a
newly-created 'docker' dir.

Add a fedora dockerfile and use it in bcc-test workflow.

2 years agoMerge pull request #3773 from chenhengqi/support-verbose-mode
Dave Marchevsky [Wed, 29 Dec 2021 07:10:21 +0000 (02:10 -0500)]
Merge pull request #3773 from chenhengqi/support-verbose-mode

libbpf-tools: Support verbose mode and set custom libbpf print callback

2 years agoMerge pull request #3765 from bveldhoen/usdt_sample_update
Dave Marchevsky [Wed, 29 Dec 2021 04:33:29 +0000 (23:33 -0500)]
Merge pull request #3765 from bveldhoen/usdt_sample_update

Updated usdt_sample for ubuntu 21.10 (and python3)

2 years agoMerge pull request #3774 from MdSalih/docs-fixup-cpudist-example-by-pid
Dave Marchevsky [Wed, 29 Dec 2021 04:32:08 +0000 (23:32 -0500)]
Merge pull request #3774 from MdSalih/docs-fixup-cpudist-example-by-pid

docs: Fixup cpudist pid example in man page

2 years agodocs: Fixup cpudist pid example in man page
Mohammad Noor [Mon, 27 Dec 2021 19:27:20 +0000 (19:27 +0000)]
docs: Fixup cpudist pid example in man page

-P prints all by process id
-p prints specific process id

also fixed port num in example

2 years agolibbpf-tools: Make custom libbpf callback function static
Hengqi Chen [Sat, 25 Dec 2021 04:29:07 +0000 (12:29 +0800)]
libbpf-tools: Make custom libbpf callback function static

Update all tools to make libbpf_print_fn function static. While
at it, also keep the function signature in a single line since
they fit in a 100-character line.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agolibbpf-tools: Add verbose option to statsnoop
Hengqi Chen [Sat, 25 Dec 2021 04:11:23 +0000 (12:11 +0800)]
libbpf-tools: Add verbose option to statsnoop

Support verbose mode and set custom libbpf print callback
in statsnoop.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agolibbpf-tools: Add verbose option to solisten
Hengqi Chen [Sat, 25 Dec 2021 04:10:55 +0000 (12:10 +0800)]
libbpf-tools: Add verbose option to solisten

Support verbose mode and set custom libbpf print callback
in solisten.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agolibbpf-tools: Add verbose option to mountsnoop
Hengqi Chen [Sat, 25 Dec 2021 04:10:22 +0000 (12:10 +0800)]
libbpf-tools: Add verbose option to mountsnoop

Support verbose mode and set custom libbpf print callback
in mountsnoop.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agolibbpf-tools: Add verbose option to ksnoop
Hengqi Chen [Sat, 25 Dec 2021 04:09:54 +0000 (12:09 +0800)]
libbpf-tools: Add verbose option to ksnoop

Support verbose mode and set custom libbpf print callback
in ksnoop.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agolibbpf-tools: Add verbose option to gethostlatency
Hengqi Chen [Sat, 25 Dec 2021 04:09:27 +0000 (12:09 +0800)]
libbpf-tools: Add verbose option to gethostlatency

Support verbose mode and set custom libbpf print callback
in gethostlatency.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agolibbpf-tools: Add verbose option to funclatency
Hengqi Chen [Sat, 25 Dec 2021 04:08:41 +0000 (12:08 +0800)]
libbpf-tools: Add verbose option to funclatency

Support verbose mode and set custom libbpf print callback
in funclatency.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agolibbpf-tools: Add verbose option to filetop
Hengqi Chen [Sat, 25 Dec 2021 04:07:56 +0000 (12:07 +0800)]
libbpf-tools: Add verbose option to filetop

Support verbose mode and set custom libbpf print callback
in filetop.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agolibbpf-tools: Add verbose option to exitsnoop
Hengqi Chen [Sat, 25 Dec 2021 04:07:16 +0000 (12:07 +0800)]
libbpf-tools: Add verbose option to exitsnoop

Support verbose mode and set custom libbpf print callback
in exitsnoop.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agolibbpf-tools: Add verbose option to bindsnoop
Hengqi Chen [Sat, 25 Dec 2021 04:06:39 +0000 (12:06 +0800)]
libbpf-tools: Add verbose option to bindsnoop

Support verbose mode and set custom libbpf print callback
in bindsnoop.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agolibbpf-tools: Add verbose option to bashreadline
Hengqi Chen [Sat, 25 Dec 2021 04:05:54 +0000 (12:05 +0800)]
libbpf-tools: Add verbose option to bashreadline

Support verbose mode and set custom libbpf print callback
in bashreadline.

Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2 years agoexclude static functions with prefix __SCT__ (#3772)
Achilles [Thu, 23 Dec 2021 18:59:59 +0000 (00:29 +0530)]
exclude static functions with prefix __SCT__ (#3772)

The kernel functions with prefix __SCT__ are for static calls. These static call functions are not in
/sys/kernel/debug/tracing/available_filter_functions and not in /sys/kernel/debug/kprobes/blacklist
either. Let us do filtering in get_kprobe_functions() to filter them out.

Co-authored-by: prameet.p <prameet.p@inba-prameet.p-210508>
2 years agoUpdated usdt_sample for ubuntu 21.10 (and python3)
Bram Veldhoen [Tue, 14 Dec 2021 07:39:45 +0000 (08:39 +0100)]
Updated usdt_sample for ubuntu 21.10 (and python3)

* Updated readme for Ubuntu 21.10 and python3.
* Readability improvements.
* Using atomic_increment (thus requires bcc 0.21+).
* Using/tested probes created using systemtap (dtrace), next to the
probes created with macros in the folly header.
* Also tested while building usdt_sample with clang.
* Some (modern) cmake changes.
* Added script to execute build and sample python scripts.

2 years agodocker: Run tests on ubuntu-20.04 as well
Dave Marchevsky [Tue, 21 Dec 2021 04:05:16 +0000 (23:05 -0500)]
docker: Run tests on ubuntu-20.04 as well

Move bcc-test github action's `matrix.os` to indicate the OS to run in
the container, not the test runner itself (just pin the latter to
ubuntu-20.04).

Also, fixup some tests that were failing when trying to run on 20.04
manually.

2 years agodocker: Bump default LLVM used for tests to 11
Dave Marchevsky [Mon, 20 Dec 2021 22:47:11 +0000 (17:47 -0500)]
docker: Bump default LLVM used for tests to 11

This is another prep commit for running docker tests on both 18.04 and
20.04 versions of ubuntu. 20.04 doesn't have some LLVM 8 libs that the
docker build expects, so bump to 11.

Bumping to 11 causes test_disassembler to fail because it expects a map
w/ a certain format with FD 3, and the LLVM bump causes the map to be
FD 4. The purpose of the test is to ensure that the format of the
diassembled map is correct, not that it has a specific FD, so make some
small changes to the test so that it doesn't care what the FD number is.

2 years agodocker + tests: Run tests using python3, refactor Dockerfile
Dave Marchevsky [Mon, 20 Dec 2021 20:23:37 +0000 (15:23 -0500)]
docker + tests: Run tests using python3, refactor Dockerfile

In #3707, I added ubuntu-20.04 to the list of OS's bcc-test uses to run
tests. I expected that this would result in the tests running on both
18.04 and 20.04. Unfortunately this change was effectively a no-op as
the tests are run in a Docker container and the os field in bcc-test.yml
dictates the type/version of the _host_ OS, not the container's OS.

So it's not necessary to run on both, just run on 20.04. It will be
necessary to modify Dockerfile.test to use both 18.04 and 20.04. To
prepare for this, move all python tests to use python3 interpreter, as
20.04 doesn't have python2 pip readily available.

Also, refactor Dockerfile.tests a bit so that it's possible to provide
ubuntu version and shortname as build input.

This commit does not result in the docker test container working/running
both 18.04 and 20.04, rather lays groundwork for future commits to do
so.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
2 years agoMerge pull request #3761 from anakryiko/libbpf-tools-modernize
Dave Marchevsky [Mon, 20 Dec 2021 21:53:55 +0000 (16:53 -0500)]
Merge pull request #3761 from anakryiko/libbpf-tools-modernize

libbpf-tools: modernize all tools to libbpf 1.0 mode

2 years agolibbpf-tools: remove now unnecessary bump_memlock_rlimit()
Andrii Nakryiko [Fri, 17 Dec 2021 22:24:37 +0000 (14:24 -0800)]
libbpf-tools: remove now unnecessary bump_memlock_rlimit()

libbpf will now automatically decide whether it's necessary, and if yes,
will do it on behalf of the application.

All the subsequet tools should make sure to set:

```
libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
```

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update vfsstat for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update vfsstat for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update tcprtt for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update tcprtt for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update tcpconnlat for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update tcpconnlat for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update tcpconnect for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update tcpconnect for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update syscount for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update syscount for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update statsnoop for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update statsnoop for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update solisten for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update solisten for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update softirqs for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update softirqs for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update runqslower for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update runqslower for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update runqlen for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update runqlen for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update runqlat for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update runqlat for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update readahead for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update readahead for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update opensnoop for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:30 +0000 (14:32 -0800)]
libbpf-tools: update opensnoop for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update offcputime for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:29 +0000 (14:32 -0800)]
libbpf-tools: update offcputime for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update numamove for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:29 +0000 (14:32 -0800)]
libbpf-tools: update numamove for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update mountsnoop for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:29 +0000 (14:32 -0800)]
libbpf-tools: update mountsnoop for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update llcstat for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:29 +0000 (14:32 -0800)]
libbpf-tools: update llcstat for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update ksnoop for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:29 +0000 (14:32 -0800)]
libbpf-tools: update ksnoop for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update hardirqs for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:29 +0000 (14:32 -0800)]
libbpf-tools: update hardirqs for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update gethostlatency for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:32:29 +0000 (14:32 -0800)]
libbpf-tools: update gethostlatency for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update funclatency for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:23:49 +0000 (14:23 -0800)]
libbpf-tools: update funclatency for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update fsslower for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:23:29 +0000 (14:23 -0800)]
libbpf-tools: update fsslower for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update fsdist for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:23:14 +0000 (14:23 -0800)]
libbpf-tools: update fsdist for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update filetop for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:23:01 +0000 (14:23 -0800)]
libbpf-tools: update filetop for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update filelife for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:22:48 +0000 (14:22 -0800)]
libbpf-tools: update filelife for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update exitsnoop for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 20:22:07 +0000 (12:22 -0800)]
libbpf-tools: update exitsnoop for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update execsnoop for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:22:09 +0000 (14:22 -0800)]
libbpf-tools: update execsnoop for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update cpudist for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:21:44 +0000 (14:21 -0800)]
libbpf-tools: update cpudist for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2 years agolibbpf-tools: update drsnoop for libbpf 1.0
Andrii Nakryiko [Fri, 17 Dec 2021 22:21:25 +0000 (14:21 -0800)]
libbpf-tools: update drsnoop for libbpf 1.0

Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>