-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install libbcc into Travis CI build #1
Conversation
660d808
to
68b1ebb
Compare
.travis.yml
Outdated
@@ -5,6 +5,12 @@ go: | |||
- master | |||
|
|||
before_install: | |||
# Install bcc | |||
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648A4A16A23015EEF4A66B8E4052245BD4284CDD | |||
- echo "deb https://repo.iovisor.org/apt/xenial xenial main" | sudo tee /etc/apt/sources.list.d/iovisor.list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
travis.ci has some shortcuts for this https://docs.travis-ci.com/user/installing-dependencies/#Adding-APT-Sources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem to support dynamic release name and it requires key_url
, when I only have key id.
THese are useful for percpu maps, as they allow to drop the locking on increment. * Before: `25: (db) lock *(u64 *)(r0 +0) += r1` * After: `24: (79) r1 = *(u64 *)(r0 +0)` Full diff for xlated: ```diff ivan@vm:~$ sudo bpftool prog dump xlated name softirq_entry | grep -v '^;' | sed 's/map\[.*\]/map[]/' | sed 's/^....:.//' > after.txt ivan@vm:~$ sudo bpftool prog dump xlated name softirq_entry | grep -v '^;' | sed 's/map\[.*\]/map[]/' | sed 's/^....:.//' > before.txt ivan@vm:~$ diff -rup before.txt after.txt --- before.txt 2023-10-18 03:46:10.507608182 +0000 +++ after.txt 2023-10-18 03:45:51.562022297 +0000 @@ -19,8 +19,9 @@ int softirq_entry(unsigned long long * c (18) r1 = map[] (bf) r2 = r6 (85) call htab_percpu_map_lookup_elem#244720 -(15) if r0 == 0x0 goto pc+2 -(b7) r1 = 1 -(db) lock *(u64 *)(r0 +0) += r1 +(15) if r0 == 0x0 goto pc+3 +(79) r1 = *(u64 *)(r0 +0) +(07) r1 += 1 +(7b) *(u64 *)(r0 +0) = r1 (b4) w0 = 0 (95) exit ``` Full diff for jited: ```diff ivan@vm:/mnt/linux/tools/bpf/bpftool$ sudo ./bpftool prog dump jited name softirq_entry | grep -v '^;' | grep -v "movk.x0" | sed 's/^....:.//' > after.txt ivan@vm:/mnt/linux/tools/bpf/bpftool$ sudo ./bpftool prog dump jited name softirq_entry | grep -v '^;' | grep -v "movk.x0" | sed 's/^....:.//' > before.txt ivan@vm:/mnt/linux/tools/bpf/bpftool$ diff -rup before.txt after.txt --- before.txt 2023-10-18 04:38:34.404554692 +0000 +++ after.txt 2023-10-18 04:38:24.403621346 +0000 @@ -1,5 +1,5 @@ int softirq_entry(unsigned long long * ctx): -bpf_prog_0e306b10531b7f14_softirq_entry: +bpf_prog_902733a94d79c04a_softirq_entry: add x9, x30, #0x0 nop paciasp @@ -48,9 +48,10 @@ movk x10, #0xffe9, lsl #32 blr x10 add x7, x0, #0x0 cmp x7, #0x0 -b.eq 0x000000e4 // b.none -mov x0, #0x1 // #1 -stadd x0, [x7] +b.eq 0x000000e8 // b.none +ldr x0, [x7] +add x0, x0, #0x1 +str x0, [x7] mov w7, #0x0 // #0 add sp, sp, #0x10 ldp x27, x28, [sp], #16 @@ -61,7 +62,6 @@ ldp x29, x30, [sp], #16 add x0, x7, #0x0 autiasp ret -nop ldr x10, 0x00000118 br x10 ``` As expected, there's `stadd` in the sync version, which is a sync version of `add`: * https://developer.arm.com/documentation/dui0801/h/A64-Data-Transfer-Instructions/STADD--STADDL--STADDL
Attaching uprobes if fickle and requires function attributes to work properly. Let's switch to usdt, which have no such downside. The price we pay is a dependecy on `systemtap-sdt-dev`, which is manageable. We get nicer attachment code with `BPF_USDT` as a bonus. The usdt probes can be inspected: ``` ivan@vm:~/projects/ebpf_exporter$ sudo tplist-bpfcc -vv -l tracing/demos/cfs-throttling/demo ebpf_exporter:cfs_set_parent_span [sema 0x0] location #1 tracing/demos/cfs-throttling/demo 0x92f3cc argument #1 8 unsigned bytes @ regs[10] argument #2 8 unsigned bytes @ regs[9] argument #3 8 unsigned bytes @ regs[8] location #2 tracing/demos/cfs-throttling/demo 0x92f408 argument #1 8 unsigned bytes @ regs[13] argument #2 8 unsigned bytes @ regs[11] argument #3 8 unsigned bytes @ regs[8] ebpf_exporter:cfs_clear_parent_span [sema 0x0] location #1 tracing/demos/cfs-throttling/demo 0x92f3d8 location #2 tracing/demos/cfs-throttling/demo 0x92f3e0 ```
No description provided.