forked from iovisor/bcc
-
Notifications
You must be signed in to change notification settings - Fork 2
Updated elgohr/Publish-Docker-Github-Action to a supported version (v5) #1
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
Open
elgohr
wants to merge
312
commits into
htejun:master
Choose a base branch
from
elgohr-update:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Systemtap defines argument size as either 1, 2, 4, or 8 bytes signed or unsigned. Thus the constant variable should be stored in a long long instead of an int to ensure at least 8 bytes size.
The current install steps for Debian from source is out of date, use the distribution name sid instead of jessie, stretch, buster due to the latter always change, update and simplify the install steps like other distributions which is clear and always right. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Wenbo Zhang <ethercflow@gmail.com>
Commit 95c9229 replaced the blk_account_io_completion kprobe with blk_account_io_done. Unfortunately the req->__data_len field is 0 in blk_account_io_done, therefore we need to save the __data_len field in blk_start_request Resolves iovisor#3099
Upstream (llvm13) patch https://reviews.llvm.org/D97223 changed function signature for CreateAtomicRMW(). The error message: /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc: In member function ‘ebpf::StatusTuple ebpf::cc::CodegenLLVM ::emit_atomic_add(ebpf::cc::MethodCallExprNode*)’: /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc:720:75: error: no matching function for call to ‘llvm::IRBuilder<>::CreateAtomicRMW(llvm::AtomicRMWInst::BinOp, llvm::Value*&, llvm::Value*&, llvm:: AtomicOrdering)’ AtomicRMWInst::Add, lhs, rhs, AtomicOrdering::SequentiallyConsistent); ^ In file included from /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc:31: /home/yhs/work/llvm-project/llvm/build/install/include/llvm/IR/IRBuilder.h:1721:18: note: candidate: ‘llvm::AtomicRMWInst* llvm::IRBuilderBase::CreateAtomicRMW(llvm::AtomicRMWInst::BinOp, llvm::Value*, llvm::Value*, llvm::MaybeAlign, llvm::AtomicOrdering, llvm::SyncScope::ID)’ AtomicRMWInst *CreateAtomicRMW(AtomicRMWInst::BinOp Op, Value *Ptr, ^~~~~~~~~~~~~~~ /home/yhs/work/llvm-project/llvm/build/install/include/llvm/IR/IRBuilder.h:1721:18: note: candidate expects 6 arguments, 4 provided Fixed the issue with correct arguments. Signed-off-by: Yonghong Song <yhs@fb.com>
This is a port of BCC's funclatency. Usage: --------- Time functions and print latency as a histogram Usage: funclatency [-h] [-m|-u] [-p PID] [-d DURATION] [ -i INTERVAL ] [-T] FUNCTION Choices for FUNCTION: FUNCTION (kprobe) LIBRARY:FUNCTION (uprobe a library in -p PID) :FUNCTION (uprobe the binary of -p PID) -m, --milliseconds Output in milliseconds -u, --microseconds Output in microseconds -p, --pid=PID Process ID to trace -d, --duration=DURATION Duration to trace -i, --interval=INTERVAL Summary interval in seconds -T, --timestamp Print timestamp -?, --help Give this help list --usage Give a short usage message -V, --version Print program version Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. Examples: ./funclatency do_sys_open # time the do_sys_open() kernel function ./funclatency -m do_nanosleep # time do_nanosleep(), in milliseconds ./funclatency -u vfs_read # time vfs_read(), in microseconds ./funclatency -p 181 vfs_read # time process 181 only ./funclatency -p 181 c:read # time the read() C library function ./funclatency -p 181 :foo # time foo() from pid 181's userspace ./funclatency -i 2 -d 10 vfs_read # output every 2 seconds, for 10s ./funclatency -mTi 5 vfs_read # output every 5 seconds, with timestamps --------- It supports kprobes and has limited support for uprobes. Currently, you cannot uprobe a library unless you provide a PID. It does not support wildcard patterns. Some of the functions for uprobes are useful for other programs, so I put those in uprobe_helpers.{c,h}. Signed-off-by: Barret Rhoden <brho@google.com>
…ntry_text_start On my ARM64 kernel 5.4 case Symbol: ffffffc0100820b8 T __irqentry_text_end ffffffc0100820b8 T __irqentry_text_start It will ignore all functions after __irqentry_text_start until __irqentry_text_end. But this case __irqentry_text_end is before __irqentry_text_start. So the problem happens. Signed-off-by: Edward Wu <edwardwu@realtek.com>
Otherwise the `make` fails with lack of `FlexLexer.h` error.
add option to include 'LPORT' in tcpconnect otuput and update man page for tcpconnect and add examples
Signed-off-by: yeya24 <yb532204897@gmail.com>
Signed-off-by: Wenbo Zhang <ethercflow@gmail.com>
The adress of struct sock, which are used as the map key, are often reused. When it happens random duration appears in the MS field for new connections (CLOSE->SYN_SENT and LISTEN->SYN_RECV transitions). Let's forget about the socket when the connection is closed.
When buildiing kernel with GCC10 [2] in Debian on an Arm64 machine, it was found the new "inter-procedural optimization improvements" [1] makes symbol name 'finish_task_switch' changed to 'finish_task_switch.isra.0'. Details: The results, when built with gcc 9.3: nm ../linux.buildout/kernel/sched/core.o | grep finish_task_switch 0000000000001288 t finish_task_switch However, when built with gcc 10.2: nm ../linux.buildout/kernel/sched/core.o | grep finish_task_switch 00000000000012d0 t finish_task_switch.isra.0 The same symbols (with xxx.isra.0 or without, respectively of course) also appear in final file 'System.map' and in '/proc/kallsyms' when booting. This negatively impact the tracing tools commonly used in kernel debugging, such as bcc tools offcputime and runqlat. They hardcode 'finish_task_switch' (without the .isra.0 suffix) into their scripts. This patch fix the issue by changing the hardcoded 'finish_task_switch' string to a python regular expression pattern who can match both the traditional form 'finish_task_switch' and the new gcc10 form 'finish_task_switch.isra.0' (with single digit at the end). attach_kprobe()'s input parameter 'event_re' is used for this type of pattern matching. [1] https://gcc.gnu.org/gcc-10/changes.html [2] ARCH=arm64 make Image Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
Add device driver/name filter for virtiostat. Suggested by Yonghong, also use bpf_probe_read_kernel_str to copy string from kernel. Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Fix all the found instances of declaring loop variable inside for() construct, which is not supported in C89 standard, which is what libbpf-tools are trying to adhere to, both in user-space and BPF source code. It actually causes compilation errors on some versions of GCC, as reported by customers in private conversations. Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Wenbo Zhang <ethercflow@gmail.com>
libbcc.so is actually installed to /usr/lib64 instead of /usr/local/lib in my computer system: $ find /usr -name libbcc.so /usr/lib64/libbcc.so And also we can find out bcc-python: $ find /usr/lib -name bcc /usr/lib/python2.7/site-packages/bcc It is better to use one line command to export environment variable LD_LIBRARY_PATH and PYTHONPATH. Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
Signed-off-by: Wenbo Zhang <ethercflow@gmail.com>
Signed-off-by: Mariusz Barczak <mariusz.barczak@intel.com>
The recent linux distros already support PIE so it shouldn't be a problem to remove "-no-pie". To avoid issue#782, we make "-no-pie" optional and enable it by default. For the distro with PIE luajit, just add the following build option: -DENABLE_NO_PIE=OFF Then, bcc-lua will be built with PIE support. Signed-off-by: Gary Lin <glin@suse.com>
sync with latest libbpf with top commit: 092a60685625 Makefile: fix install flags order Signed-off-by: Yonghong Song <yhs@fb.com>
* Support for kernel up to 5.11 * allow BCC as a cmake subproject * add LPORT support in tcpconnlat and tcpconnect * added bpf_map_lookup_and_delete_batch support * new tools: virtiostat * new libbpf-tools: cpufreq, funclatency, cachestat * add install target to libbpf-tools * a few lua fixes * doc update and bug fixes Signed-off-by: Yonghong Song <yhs@fb.com>
In order to fix the following errors when running bpf program on the MIPS Loongson64 platform, add some basic support, with this patch, running hello_world.py can get the expected result. root@linux:/home/loongson/bcc# python examples/hello_world.py In file included from <built-in>:3: In file included from /virtual/include/bcc/helpers.h:51: In file included from include/uapi/linux/if_packet.h:5: arch/mips/include/uapi/asm/byteorder.h:17:3: error: "MIPS, but neither __MIPSEB__, nor __MIPSEL__???" # error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???" ^ In file included from <built-in>:3: In file included from /virtual/include/bcc/helpers.h:53: In file included from include/linux/log2.h:12: In file included from include/linux/bitops.h:32: In file included from arch/mips/include/asm/bitops.h:19: In file included from arch/mips/include/asm/barrier.h:11: arch/mips/include/asm/addrspace.h:13:10: fatal error: 'spaces.h' file not found #include <spaces.h> ^~~~~~~~~~ 2 errors generated. Traceback (most recent call last): File "examples/hello_world.py", line 12, in <module> BPF(text='int kprobe__sys_clone(void *ctx) { bpf_trace_printk("Hello, World!\\n"); return 0; }').trace_print() File "/usr/lib/python2.7/site-packages/bcc/__init__.py", line 364, in __init__ raise Exception("Failed to compile BPF module %s" % (src_file or "<text>")) Exception: Failed to compile BPF module <text> root@linux:/home/loongson/bcc# python examples/hello_world.py In file included from <built-in>:3: In file included from /virtual/include/bcc/helpers.h:53: In file included from include/linux/log2.h:12: In file included from include/linux/bitops.h:32: arch/mips/include/asm/bitops.h:101:3: error: invalid output constraint '+ZC' in asm __bit_op(*m, __INS "%0, %3, %2, 1", "i"(bit), "r"(~0)); ^ arch/mips/include/asm/bitops.h:40:19: note: expanded from macro '__bit_op' : "=&r"(__temp), "+" GCC_OFF_SMALL_ASM()(mem) \ ^ [...] arch/mips/include/asm/atomic.h:154:1: error: invalid output constraint '+ZC' in asm arch/mips/include/asm/atomic.h:151:2: note: expanded from macro 'ATOMIC_OPS' ATOMIC_FETCH_OP(pfx, op, type, c_op, asm_op, ll, sc) ^ arch/mips/include/asm/atomic.h:141:4: note: expanded from macro 'ATOMIC_FETCH_OP' "+" GCC_OFF_SMALL_ASM() (v->counter) \ ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. Traceback (most recent call last): File "examples/hello_world.py", line 12, in <module> BPF(text='int kprobe__sys_clone(void *ctx) { bpf_trace_printk("Hello, World!\\n"); return 0; }').trace_print() File "/usr/lib/python2.7/site-packages/bcc/__init__.py", line 364, in __init__ raise Exception("Failed to compile BPF module %s" % (src_file or "<text>")) Exception: Failed to compile BPF module <text> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
The lookup_fast function can be rename lookup_fast.constprop.x by gcc constant propagation optimization and that breaks dcstat and dcsnoop. Let's look for both name using a regular expression.
Signed-off-by: Wenbo Zhang <ethercflow@gmail.com>
sync up to the following libbpf commit: eaea2bce024f sync: remove redundant test on $BPF_BRANCH Signed-off-by: Yonghong Song <yhs@fb.com>
Add a new function kernel_struct_has_field, which allows user to check that whether a kernel struct has a specific field. This enable us to deal with some kernel changes like in 2f064a59a1 ([0]) of the linux kernel. [0]: torvalds/linux@2f064a59a1 Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
Kernel commit 2f064a59a1 ("sched: Change task_struct::state") changes the name of task_struct::state to task_struct::__state, which breaks several bcc tools. Fix this issue by checking field existence in vmlinux BTF. Since this change was intruduce in kernel v5.14, we should have BTF support. Closes iovisor#3658 . Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
libbpf-tools: Fix memory leaks in ksnoop/gethostlatency
Fix issue iovisor#3687. The tool cachestat.py doesn't work with 5.15 kernel due to kprobe function renaming. Adapt to the new function. Also added a comment that static functions might get inlined and the result may not be accurate if this happens. More work can be done in the future to make the tool more robust. Signed-off-by: Yonghong Song <yhs@fb.com>
The tool cachetop.py doesn't work with 5.15 kernel due to kprobe function renaming. Adapt to the new function. Commit 61087b9 ("tools: fix cachestat.py with 5.15 kernel") fixed a similar issue for cachestat.py. Signed-off-by: Yonghong Song <yhs@fb.com>
After this fix, the output may look like this: NAME/TYPE # ALLOCS # BYTES [B 1 1016 [D 1 8016
* Support for kernel up to 5.15 * bcc tools: update for kvmexit.py, tcpv4connect.py, cachetop.py, cachestat.py, etc. * libbpf tools: update for update for mountsnoop, ksnoop, gethostlatency, etc. * fix renaming of task_struct->state * get pid namespace properly for a number of tools * initial work for more libbpf utilization (less section names) * doc update, bug fixes and other tools improvement Signed-off-by: Yonghong Song <yhs@fb.com>
…-actions-1 gh actions: run test and publish actions on pull_request, not push
resending
it wasn't running on ubuntu-18.04 test runner b/c of the kernel version check and is failing now as I try to add ubuntu-20.04 test runner Will investigate separately from GH actions changes
Since commit d5299b67dd59 ("bpf: Memcg-based memory accounting for bpf maps"), memory locked by bpf maps is no longer counted against rlimit. Ubuntu 20.04's 5.11 kernel has this commit, so we should skip this test there. When we add future distros to github actions it may be necessary to modify the version check here.
add ubuntu-20.04 to bcc-test.yml
Sync with latest libbpf repo upto commit: 94a49850c5ee Makefile: enforce gnu89 standard Signed-off-by: Yonghong Song <yhs@fb.com>
The test send a udp packet to test tailcalls. The test may fail due to udp packet loss. Let us mark the test as mayFail. Signed-off-by: Yonghong Song <yhs@fb.com>
…sor#3713) set CMP0074 to allow the use of `LLVM_ROOT` env var
Create examples/tracing/undump.py examples text file and update permission (+x) for undump.py.
By just running `$ sudo amazon-linux-extras install BCC`, dependencies are install. ``` $ sudo amazon-linux-extras install BCC ... ================================================================================================================================================================== Package Arch Version Repository Size ================================================================================================================================================================== Installing: bcc x86_64 0.18.0-1.amzn2.0.3 amzn2-core 28 M Installing for dependencies: bcc-tools x86_64 0.18.0-1.amzn2.0.3 amzn2-core 557 k clang-libs x86_64 11.1.0-1.amzn2.0.2 amzn2-core 22 M clang-resource-filesystem x86_64 11.1.0-1.amzn2.0.2 amzn2-core 17 k cpp10 x86_64 10.3.1-1.amzn2.0.1 amzn2-core 9.5 M elfutils-libelf-devel x86_64 0.176-2.amzn2 amzn2-core 40 k gcc10 x86_64 10.3.1-1.amzn2.0.1 amzn2-core 38 M gcc10-binutils x86_64 2.35-21.amzn2.0.1 amzn2-core 2.9 M gcc10-binutils-gold x86_64 2.35-21.amzn2.0.1 amzn2-core 795 k glibc-devel x86_64 2.26-56.amzn2 amzn2-core 994 k glibc-headers x86_64 2.26-56.amzn2 amzn2-core 514 k isl x86_64 0.16.1-6.amzn2 amzn2-core 833 k kernel-devel x86_64 5.10.75-79.358.amzn2 amzn2extra-kernel-5.10 16 M kernel-headers x86_64 5.10.75-79.358.amzn2 amzn2extra-kernel-5.10 1.3 M libbpf x86_64 0.3.0-2.amzn2.0.3 amzn2-core 102 k libmpc x86_64 1.0.1-3.amzn2.0.2 amzn2-core 52 k libzstd x86_64 1.3.3-1.amzn2.0.1 amzn2-core 203 k llvm-libs x86_64 11.1.0-1.amzn2.0.2 amzn2-core 22 M mpfr x86_64 3.1.1-4.amzn2.0.2 amzn2-core 208 k python3-bcc noarch 0.18.0-1.amzn2.0.3 amzn2-core 86 k python3-netaddr noarch 0.7.18-3.amzn2.0.2 amzn2-core 1.3 M zlib-devel x86_64 1.2.7-18.amzn2 amzn2-core 50 k ... ```
The data_loc field (defined as __string in kernel source) should be treated as string NOT a fixed-size array, add a new macro TP_DATA_LOC_READ_STR which use bpf_probe_read_str to reflect this. Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
Fixes iovisor#3720. Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
This makes few improvements: * This can send much larger data payload and also adds --max-buffer-size CLI option which allow changing this param. * Fixes dealing with non ASCII protocols, previously struct was defined as array of chars which made python ctypes treat it as NULL terminated string and it prevents from displaying any data past the null byte (which is very common for http2). * Adds more filtering and displaying options (--print-uid, --print-tid, --uid <uid>) This also deals correctly with rare cases when bpf_probe_read_user fails (so buffer should be empty and should not be displayed).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
elgohr/Publish-Docker-Github-Action@master is not supported anymore