Pavel Safronov [Thu, 17 Aug 2017 17:41:47 +0000 (20:41 +0300)]
Fixes for debian and ubuntu docker build
* Fixed build for debian and ubuntu
* Bumped debian and ubuntu versions (fix some build-dependency issues)
* Make debian and ubuntu Dockerfiles use the same build script
* Build-dependencies now installing automatically via pbuilder
4ast [Thu, 17 Aug 2017 07:36:31 +0000 (00:36 -0700)]
Merge pull request #1294 from iovisor/yhs_dev
avoid large map memory allocation in userspace
Yonghong Song [Wed, 16 Aug 2017 23:18:22 +0000 (16:18 -0700)]
avoid large map memory allocation in userspace
In bcc, internal BPF_F_TABLE defines a structure to
contain all the table information for later easy
extraction. A global structure will be defined
with this type. Note that this structure will be
allocated by LLVM during compilation.
In the table structure, one of field is:
_leaf_type data[_max_entries]
If the _leaf_type and _max_entries are big,
significant memory will be consumed. A big
_leaf_type size example is for BPF_STACK_TRACE map
with 127*8=1016 bytes. If max_entries is bigger
as well, significant amount of memory will be
consumed by LLVM.
This patch replaces
_leaf_type data[_max_entries]
to
unsigned ing max_entries
The detail of a test example can be found in issue #1291.
For the example in #1291, without this patch, for a
BPF_STACK_TRACE map with 1M entries, the RSS is roughly
3GB (roughly 3KB per entry). With this patch, it is 5.8MB.
Signed-off-by: Yonghong Song <yhs@fb.com>
Brendan Gregg [Wed, 16 Aug 2017 19:20:29 +0000 (12:20 -0700)]
Merge pull request #1293 from iovisor/tools_fixes
Couple minor tools fixes
Gabriel Ganne [Wed, 16 Aug 2017 07:23:09 +0000 (09:23 +0200)]
python - set attach_xdp's default flag value to 0
Signed-off-by: Gabriel Ganne <gabriel.ganne@enea.com>
Yonghong Song [Fri, 28 Jul 2017 23:30:35 +0000 (16:30 -0700)]
have uniform uprobe event names for python and C++
This is a followup change for previous commit
0ba15075fc5f
(permit multiple pids attaching to the same probe).
That commit changes the event name for python uprobe API
in order to permit multiple processes attaching to the
same uprobe point. The C++ uprobe event name remains
unchanged and thus a descrepancy.
This patch add changes to C++ side and also make python uretprobe
having the same naming convention.
Originally I experimented to put the common code to generate
event names in libbpf.c. But doing this seems more klunky
than simplicity of C++ and Python. So I stick to the current
design.
No need to add pid to kprobe event names as kprobe bpf invocation
will ignore pid anyway.
Signed-off-by: Yonghong Song <yhs@fb.com>
Brenden Blanco [Wed, 16 Aug 2017 18:29:23 +0000 (11:29 -0700)]
Remove extra S_MAXSTAT array allocation in some tools
Fixes: #1280
Signed-off-by: Brenden Blanco <bblanco@gmail.com>
Brenden Blanco [Wed, 16 Aug 2017 18:26:14 +0000 (11:26 -0700)]
Omit include of ptrace.h for empty usdt contexts
Fixes: #1280
Signed-off-by: Brenden Blanco <bblanco@gmail.com>
Brenden Blanco [Fri, 11 Aug 2017 15:00:14 +0000 (08:00 -0700)]
Add clang check for -nopie option
The -no-pie option is not available in clang until 6.0. Per the
documentation, -nopie serves the same purpose as -no-pie (but not
-fno-pie). Hence, use the -nopie option when clang is in use as the CC.
Fixes: #1237
Signed-off-by: Brenden Blanco <bblanco@gmail.com>
Paul Chaignon [Sun, 6 Aug 2017 12:20:23 +0000 (14:20 +0200)]
Correct commit id for BPF_FUNC_get_socket_cookie
Iago López Galeiras [Fri, 4 Aug 2017 16:13:05 +0000 (18:13 +0200)]
tools/tcptracer: print ns timestamps with -v
Iago López Galeiras [Fri, 4 Aug 2017 14:57:20 +0000 (16:57 +0200)]
tools/tcptracer: add timestamp option
Similar to other tools from the tcp* family.
Nan Xiao [Wed, 2 Aug 2017 02:04:44 +0000 (10:04 +0800)]
Since LUA_GLOBALSINDEX is obsolete from Lua 5.2, use lua_getglobal function
instead.
Brendan Gregg [Thu, 3 Aug 2017 18:49:27 +0000 (11:49 -0700)]
better state default value handling
Brendan Gregg [Tue, 1 Aug 2017 01:39:30 +0000 (18:39 -0700)]
add --state to offcputime
Jean-Tiare Le Bigot [Sun, 30 Jul 2017 17:19:11 +0000 (19:19 +0200)]
explain that 'args' can be used as 'ctx' in tracepoints
Jean-Tiare Le Bigot [Sun, 30 Jul 2017 17:17:57 +0000 (19:17 +0200)]
make it easier to discover the reference documentation
Benjamin Poirier [Fri, 28 Jul 2017 20:25:14 +0000 (13:25 -0700)]
tcptop: Filter out negative values in receive probe
When tcp_cleanup_rbuf() is called from tcp_recvmsg(), "copied" may be an
error code, especially -EAGAIN for non-blocking receives.
Benjamin Poirier [Thu, 27 Jul 2017 23:07:06 +0000 (16:07 -0700)]
tcptop: Cleanup argument parsing
Toshiaki Makita [Mon, 31 Jul 2017 11:20:55 +0000 (20:20 +0900)]
Use unsigned conversion specifier for nlmsg_pid
nlmsg_pid is __u32, so let's use %u instead of %d.
Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Toshiaki Makita [Mon, 31 Jul 2017 11:20:55 +0000 (20:20 +0900)]
Fix wrong netlink port id check
As per man netlink, nlmsg_pid is not process id and in fact a value
different from process id can be used.
bpf: Wrong pid -
1615084642, expected 24407
This problem can be triggered by using pyroute2 with bcc.
Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Nan Xiao [Mon, 31 Jul 2017 05:02:20 +0000 (13:02 +0800)]
Remove redundant semicolon
Nan Xiao [Sat, 29 Jul 2017 02:47:24 +0000 (10:47 +0800)]
1. Use more safe snprintf instead of sprintf;
2. Modify procfilename buffer length in bcc_procutils_language function.
Ivan Babrou [Fri, 28 Jul 2017 21:57:26 +0000 (14:57 -0700)]
Put libfl-dev into Build-Depends on Debian
On Debian Stretch `libfl-dev` is not installed automatically
if you install `flex`, this takjes care of the issue.
Brenden Blanco [Thu, 27 Jul 2017 15:47:08 +0000 (08:47 -0700)]
Merge pull request #1263 from iovisor/yhs_dev
permit multiple pids attaching to the same probe
Yonghong Song [Sat, 22 Jul 2017 05:13:20 +0000 (22:13 -0700)]
permit multiple pids attaching to the same probe
Currently, if more than one pid-associated USDT attaching to
the same probe, usdt readarg code will be generated twice and
the compiler will complain.
This patch solves issue by preventing code duplication if
a previous context with the same mnt point and exec binary
has generated the code for the same probe. The event name is
also changed to have pid embedded so different pid-associated
uprobe event will have different names.
This patch introduces an internal uprobe event name
discrepency. It is a good idea to have event name
generation in libbpf so that both C++ API and Python API
will have consistent name conventions. This will be
addressed in a subsequent commit as it is largely
a different issue.
Signed-off-by: Yonghong Song <yhs@fb.com>
4ast [Wed, 19 Jul 2017 05:08:48 +0000 (22:08 -0700)]
Merge pull request #1261 from iovisor/yhs_dev
generate proper usdt code to prevent llvm meddling with ctx->#fields
Yonghong Song [Tue, 18 Jul 2017 21:12:10 +0000 (14:12 -0700)]
generate proper usdt code to prevent llvm meddling with ctx->#fields
Qin reported a test case where llvm still messes up with ctx->#fields.
For code like below:
switch(ctx->ip) {
case 0x7fdf2ede9820ULL: *((int64_t *)dest) = *(volatile int64_t *)&ctx->r12; return 0;
case 0x7fdf2edecd9cULL: *((int64_t *)dest) = *(volatile int64_t *)&ctx->bx; return 0;
}
The compiler still generates:
# r1 is the pointer to the ctx
r1 += 24
goto LBB0_4
LBB0_3:
r1 += 40
LBB0_4:
r3 = *(u64 *)(r1 + 0)
The verifier will reject the above code since the last load is not "ctx + field_offset"
format.
The responsible llvm optimization pass is CFGSimplifyPass. Its main implementation
in llvm/lib/Transforms/Utils/SimplifyCFG.cpp. The main routine to do the optimization
is SinkThenElseCodeToEnd. The routine canSinkInstructions is used to determine whether
an insn is a candidate for sinking.
Unfortunately, volatile load/store is not a condition to prevent the optimization.
But inline assembly is a condition which can prevent further optimization.
In this patch, instead of using volatile to annotate ctx->#field access, we do
normal ctx->#field access but put a compiler inline assembly memory barrier
__asm__ __volatile__(\"\": : :\"memory\");
after the field access.
Tested with usdt unit test case, usdt_samples example, a couple of usdt unit tests
developed in the past.
Signed-off-by: Yonghong Song <yhs@fb.com>
Igor Mazur [Tue, 18 Jul 2017 07:06:34 +0000 (10:06 +0300)]
MySQL tracing without USDT (#1239)
Support tracing MySQL queries even when MySQL is built
without USDT support, by using uprobes on internal functions
responsible for command (query) dispatching.
4ast [Tue, 18 Jul 2017 07:04:45 +0000 (00:04 -0700)]
Merge pull request #1259 from iovisor/yhs_dev
Fix a clang memory leak
Yonghong Song [Tue, 18 Jul 2017 06:20:17 +0000 (23:20 -0700)]
Fix a clang memory leak
In clang frontend actions, several compiler invocations are called
for rewriter and transforming source code to IR. During the invocation
to transform source code to IR, CodeGenOpts.DisableFree is used
to control whether the top target machine structure should be
freed or not for a particular clang invocation,
and its default value is TRUE.
See clang:lib/CodeGen/BackendUtil.cpp:
~EmitAssemblyHelper() {
if (CodeGenOpts.DisableFree)
BuryPointer(std::move(TM));
}
So by default, the memory held by TM will not freed, even if
BPF module itself is freed. This is even more problematic
when continuous building/loading/unloading happens for long
live service.
This patch explicitly sets CodeGenOpts.DisableFree to FALSE
so memory can be properly freed. I did a simple experiment
to compile/load/unload an empty BPF program and the saving
is roughly 0.5MB.
Signed-off-by: Yonghong Song <yhs@fb.com>
Brenden Blanco [Mon, 17 Jul 2017 22:55:57 +0000 (15:55 -0700)]
Merge pull request #1258 from shodoco/tcpbpf
Update bpf.h and virtual_bpf.h to 4.13-rc1
Huapeng Zhou [Mon, 17 Jul 2017 22:06:14 +0000 (15:06 -0700)]
Update bpf.h and virtual_bpf.h to 4.13-rc1
Geneviève Bastien [Fri, 14 Jul 2017 20:04:12 +0000 (16:04 -0400)]
tools: Add some documentation to lib/ucalls.py output (#1257)
Signed-off-by: Geneviève Bastien <gbastien@versatic.net>
vkhromov [Fri, 14 Jul 2017 19:42:29 +0000 (20:42 +0100)]
Fix trace.py for library filenames containing colons (#1252)
`trace.py` parses a probe using the colon as a separator. As a result, it
fails to create a uprobe for binary/library with a filename containing colons.
This diff fixes that issue with `trace.py`. It requires a kernel with
https://lkml.org/lkml/2017/1/13/585 merged to work properly, otherwise
`trace.py` still fails for create uprobes.
Romain [Tue, 11 Jul 2017 18:15:09 +0000 (11:15 -0700)]
cc: Add open_perf_event to the C/C++ API (#1232)
Rinat Ibragimov [Tue, 11 Jul 2017 18:14:08 +0000 (21:14 +0300)]
memleak: expand allocator coverage (#1214)
* memleak: handle libc allocation functions other than malloc
* memleak: use tracepoints to track kernel allocations
* memleak: add combined-only mode
With large number of outstanding allocations, amount of data passed from
kernel becomes large, which slows everything down.
This patch calculates allocation statistics inside kernel, allowing user-
space part to pull combined statistics data only, thus significantly
reducing amount of passed data.
* memleak: increase hashtable capacities
There are a lot of allocations happen in kernel. Default values are not
enough to keep up.
* test: add a test for the memleak tool
bveldhoen [Tue, 11 Jul 2017 18:09:35 +0000 (20:09 +0200)]
Add USDT sample (#1229)
This sample contains:
- A library with an operation that uses usdt probes.
- A console application that calls the operation.
- Scripts to trace the latency of the operation.
- Corresponding cmake files.
Quentin Monnet [Fri, 7 Jul 2017 11:39:40 +0000 (13:39 +0200)]
docs: update features list
And fix a typo: direct_action -> direct-action
Colin Ian King [Thu, 6 Jul 2017 12:58:17 +0000 (13:58 +0100)]
libbpf: fix build warning on setns (#1246)
The macro _GNU_SOURCE should be defined to pick up the function
declaration for setns. Fixes build warning:
"src/cc/libbpf.c:482:7: warning: implicit declaration of
function 'setns' [-Wimplicit-function-declaration]
if (setns(target_fd, CLONE_NEWNS)) {"
Signed-off-by: Colin Ian King <colin.king@canonical.com>
4ast [Sat, 1 Jul 2017 19:59:49 +0000 (12:59 -0700)]
Merge pull request #1237 from iovisor/yhs_dev
Fix bcc.lua build issue in Ubuntu 17.04
Vicent Marti [Tue, 27 Jun 2017 17:06:46 +0000 (19:06 +0200)]
usdt: Use ProcMountNS
Vicent Marti [Tue, 27 Jun 2017 13:22:38 +0000 (15:22 +0200)]
proc: Enhance bcc_mapping_is_file_backed
Cleanup the `strncmp` code and add a few more ignored map names
Yonghong Song [Fri, 30 Jun 2017 05:46:29 +0000 (22:46 -0700)]
Fix bcc.lua build issue in Ubuntu 17.04
In fc25 box, gcc6.3.1 is configured with pie default off.
Here, pie stands for position independent execution.
In ubuntu 17.04, gcc6.3.0, however, is configured with
pie default on. The gcc driver automatically adds -pie
to the linker options.
Since bcc.lua build needs pie off, previously, -fno-pie
is passed to the compiler. -fno-pie is a gcc option
impacting the code generation and it didn't
negate the -pie option in the linker. The correct way
seems to use gcc linker option -no-pie which can
successfully cancel the default -pie in the linker.
Signed-off-by: Yonghong Song <yhs@fb.com>
Nan Xiao [Fri, 30 Jun 2017 01:52:47 +0000 (09:52 +0800)]
Update LINKS.md
Romain [Thu, 29 Jun 2017 19:00:31 +0000 (12:00 -0700)]
Added helpers for BPF_PERCPU_ARRAY (#1230)
Taekho Nam [Thu, 29 Jun 2017 14:20:47 +0000 (23:20 +0900)]
Add an option to strip leading zeros from histograms (#1226)
Brenden Blanco [Fri, 23 Jun 2017 08:08:07 +0000 (01:08 -0700)]
test: python3 fix for test_uprobes (#1228)
Treat strings as bytes. This is independent of the larger refactor
(#1139) from which it is cherry-picked)
Signed-off-by: Brenden Blanco <bblanco@gmail.com>
Brendan Gregg [Thu, 22 Jun 2017 18:58:21 +0000 (11:58 -0700)]
gethostlatency was rounding to full ms
Yonghong Song [Mon, 12 Jun 2017 01:37:25 +0000 (18:37 -0700)]
Change clang frontend optimization level from 0 to 2
The issue is caused by the following clang change on 5.0:
https://reviews.llvm.org/D28404
Basically, at -O0, unless always inlining is specified, a
function will be marked as optnone and noinline.
This causes two kinds of issues: (1). optnone will generate
suboptimal code with heavy stack use and this high likely can
cause verifier failure; and (2). even if user mark all his/her
defined functions in bpf program as always inlining, some
functions in linux header files are not marked as always inline
and hence will be marked as noinline instead, ultimately
causing llvm complaining about global function reference.
This patch bumps the clang optimization level to -O2.
This should work with older versions of llvm as well.
Signed-off-by: Yonghong Song <yhs@fb.com>
Brendan Gregg [Wed, 14 Jun 2017 16:28:13 +0000 (09:28 -0700)]
Merge pull request #1224 from NavinF/patch-1
Update the installation instructions for Fedora
Navin Francis [Wed, 14 Jun 2017 13:15:07 +0000 (06:15 -0700)]
Update the installation instructions for Fedora
Yonghong Song [Fri, 2 Jun 2017 07:41:44 +0000 (00:41 -0700)]
Add probe result verification for usdt unit test
Signed-off-by: Yonghong Song <yhs@fb.com>
Gary Ching-Pang Lin [Mon, 12 Jun 2017 10:22:10 +0000 (18:22 +0800)]
Add installation instructions for openSUSE (#1222)
Carlos Neira [Fri, 9 Jun 2017 19:07:37 +0000 (15:07 -0400)]
fix cc: error: unrecognized command line option -no-pie
cnb@ubuntu-14:~/iovisor/bcc/build$ make
[ 6%] Built target clang_frontend
[ 9%] Built target bpf-static
[ 16%] Built target bcc-loader-static
[ 30%] Built target b_frontend
[ 47%] Built target bcc-static
[ 48%] Built target CPUDistribution
[ 50%] Built target FollyRequestContextSwitch
[ 51%] Built target HelloWorld
[ 52%] Built target LLCStat
[ 54%] Built target RandomRead
[ 55%] Built target RecordMySQLQuery
[ 56%] Built target TCPSendStack
[ 80%] Built target bcc-shared
[ 83%] Built target bpf-shared
[ 84%] Built target bcc_py
Linking C executable bcc-lua
cc: error: unrecognized command line option â-no-pieâ
make[2]: *** [src/lua/bcc-lua] Error 1
make[1]: *** [src/lua/CMakeFiles/bcc-lua.dir/all] Error
option is called -fno-pie
Ryan Tomayko [Mon, 5 Jun 2017 17:43:46 +0000 (17:43 +0000)]
Fix ld error due to debian/ubuntu -pie default
Fixes #782. Solution taken verbatim from @jepio here:
https://github.com/iovisor/bcc/issues/782#issuecomment-
259075010
I ran into the same issue attempting to compile from source on
a fresh Ubuntu 16.10/Yakkety host:
Linking C executable bcc-lua
/usr/bin/ld: libluajit-5.1.a(ljamalg.o): relocation R_X86_64_32S
against `.rodata' can not be used when making a shared object;
recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
Build succeeded after patch was applied.
Yonghong Song [Tue, 6 Jun 2017 00:55:24 +0000 (17:55 -0700)]
fix incorrect code generation in usdt
o This is caused by my ignorant error in previous usdt change.
Obviously, I need to store into pointer address in order to
propagate value back to caller.
o Thanks Tetsuo Handa pointing this out.
Signed-off-by: Yonghong Song <yhs@fb.com>
Evan Dandrea [Thu, 27 Apr 2017 15:20:39 +0000 (11:20 -0400)]
Add missing funcslower from the snap.
Evan Dandrea [Thu, 27 Apr 2017 15:16:01 +0000 (11:16 -0400)]
Add aliases for all commands in the snap (e.g. bcc.biotop -> biotop)
Evan Dandrea [Mon, 8 May 2017 13:04:00 +0000 (08:04 -0500)]
Require a more recent, auto-updating version of snapd for alises.
Taekho Nam [Mon, 5 Jun 2017 09:52:39 +0000 (09:52 +0000)]
Add libbcc-example package for Ubuntu Xenial
Yonghong Song [Tue, 30 May 2017 13:37:02 +0000 (06:37 -0700)]
Add a python test for usdt
o The sample application covers different aspects
of usdt rewriter code generation:
- const
- *(ctx + offset)
- use bpf_probe_read to get trace data
- the switch in ctx->ip if the same probe
is triggered in multiple .text locations.
o folly (https://github.com/facebook/folly/) tracing
header files are pulled into python test directory and
used to produce USDT probes.
Signed-off-by: Yonghong Song <yhs@fb.com>
Teng Qin [Thu, 25 May 2017 20:30:13 +0000 (13:30 -0700)]
Improve PerfEventArray clean up
4ast [Wed, 31 May 2017 21:08:57 +0000 (14:08 -0700)]
Merge pull request #1212 from iovisor/yhs_dev
Force udst ctx->#reg load to be volatile
4ast [Wed, 31 May 2017 16:08:43 +0000 (09:08 -0700)]
Merge pull request #1211 from iovisor/libbpf_c_includes
Add linux/sched.h to list of libbpf.c includes
Brenden Blanco [Wed, 31 May 2017 15:44:22 +0000 (08:44 -0700)]
Add linux/sched.h to list of libbpf.c includes
This should hopefully fix compile errors on some ubuntu systems.
Also, reorders the includes according to clang-format
Signed-off-by: Brenden Blanco <bblanco@gmail.com>
Brenden Blanco [Wed, 31 May 2017 00:35:53 +0000 (17:35 -0700)]
make libbpf standalone-ready
Break the c++ dependency in libbpf.c, and turn it into a separate lib
from cmake point of view.
Signed-off-by: Brenden Blanco <bblanco@gmail.com>
Brenden Blanco [Thu, 25 May 2017 20:24:15 +0000 (13:24 -0700)]
Move ProcMountNSGuard to separate file
This moves ProcMountNS[Guard] classes to a separate header file and
implementation. The goal will be to use these more directly in libbpf.c
without creating a circular dependency.
Removed the friend class statements and exposed a few public getters instead.
Slightly changed the implementation in ProcMountNS constructor to avoid
a few error cases and the use of snprintf.
Signed-off-by: Brenden Blanco <bblanco@gmail.com>
Christian Resell [Fri, 26 May 2017 19:44:07 +0000 (21:44 +0200)]
bcc_procutils_which: return if snprintf fails or would overflow
Christian Resell [Fri, 26 May 2017 14:50:52 +0000 (16:50 +0200)]
bcc_proc.c: fix stack overflow in bcc_procutils_which()
Yonghong Song [Tue, 30 May 2017 09:03:06 +0000 (02:03 -0700)]
Force udst ctx->#reg load to be volatile
This is related to issue #1133. Compiler sometimes
generates code patterns likes:
r1 = ctx + 96
goto next
here:
r1 = ctx + 48
next:
r3 = load (r1 + 0)
Verifier will fail for such cases as r1 is marked
as "unknown" at the time of load.
The previous workaround is to add volatile attribute
to the store like
*(volatile u64 *)&dest = ctx->bx
The hope is to force ctx related load in-place since
its value is needed for store.
Unfortunately, this does not always work and compiler
still has freedom to merge different ctx loads at the
same time honoring the volatile &dest. In USDT generated
code, different branches of &dest are the same.
This patch directly make ctx->bx itself as a volatile load:
*(volatile u64 *)&ctx->bx
This seems working as compiler stops playing around
the address pointing to a volatile data.
Signed-off-by: Yonghong Song <yhs@fb.com>
Tomaz Solc [Fri, 26 May 2017 11:52:30 +0000 (13:52 +0200)]
Mention that linux-headers deb must be installed.
Brenden Blanco [Thu, 25 May 2017 18:54:14 +0000 (11:54 -0700)]
Merge pull request #1201 from htbegin/master
funclatency/sslsniff: fix the TypeError when enabling pid filter on u…
4ast [Thu, 25 May 2017 05:14:11 +0000 (22:14 -0700)]
Merge pull request #1191 from GBuella/cmake_build_type_fix
Fix usage of CMAKE_BUILD_TYPE setting
4ast [Thu, 25 May 2017 05:13:44 +0000 (22:13 -0700)]
Merge pull request #1190 from palmtenor/cur_cpu
Use BPF_F_CURRENT_CPU in perf_submit when possible
Teng Qin [Tue, 23 May 2017 18:57:44 +0000 (11:57 -0700)]
Use BPF_F_CURRENT_CPU in perf_submit / perf_read when possible
4ast [Wed, 24 May 2017 20:08:26 +0000 (13:08 -0700)]
Merge pull request #1200 from palmtenor/perf_event_clean_up
Improve perf event clean up
Teng Qin [Wed, 24 May 2017 05:18:56 +0000 (22:18 -0700)]
Disable perf event FD before free
Teng Qin [Tue, 23 May 2017 23:35:11 +0000 (16:35 -0700)]
Add bpf_close_perf_event_fd
Add bpf_close_perf_event_fd helper that first disables, then closes a
perf event fd. Use it in Python and C++ API for detach perf event
4ast [Wed, 24 May 2017 16:53:51 +0000 (09:53 -0700)]
Merge pull request #1196 from palmtenor/cpp_sym_option
Support symbol option in C++ API stack table
htbegin [Wed, 24 May 2017 14:53:17 +0000 (22:53 +0800)]
funclatency/sslsniff: fix the TypeError when enabling pid filter on uprobe
attach_uprobe() and attach_uretprobe() expect the type of pid argument
is "int" instead of "str". Fix it by specifying the type of the "-p"/"--pid"
option as "int", and updating the format string of args.pid accordingly.
Fixes:
d73c58f0c8c754bd591264205ac2ddc83c1d2c7f
Brenden Blanco [Tue, 23 May 2017 18:56:59 +0000 (11:56 -0700)]
Merge pull request #1185 from gospo/master
Add support for generic XDP mode
Teng Qin [Tue, 23 May 2017 18:30:33 +0000 (11:30 -0700)]
Support symbol option in C++ API stack table
Andy Gospodarek [Wed, 17 May 2017 20:18:45 +0000 (16:18 -0400)]
Add support for generic XDP mode
Reused some of the code and command-line format from kernel XDP samples.
$ sudo ./xdp_drop_count.py -S enp1s0
Printing drops per IP protocol-number, hit CTRL+C to stop
17: 36616 pkt/s
17:
19720757 pkt/s
17:
19685768 pkt/s
17:
19643601 pkt/s
17:
19694537 pkt/s
[...]
$ sudo ./xdp_drop_count.py enp1s0
Printing drops per IP protocol-number, hit CTRL+C to stop
17: 7029 pkt/s
17:
29996706 pkt/s
17:
30048705 pkt/s
17:
30261417 pkt/s
17:
30291967 pkt/s
[...]
Throughput difference is expected since generic XDP takes more
instructions per packet than optimized XDP.
v2: switch __u32 to uint32_t in bpf_attach_xdp
Signed-off-by: Andy Gospodarek <gospo@broadcom.com>
4ast [Mon, 22 May 2017 16:31:24 +0000 (09:31 -0700)]
Merge pull request #1193 from palmtenor/cppleak
Fix bcc_resolve_symname memory leak in C++ API
4ast [Mon, 22 May 2017 14:56:10 +0000 (07:56 -0700)]
Merge pull request #1192 from palmtenor/perf_config
Unify Perf Event related Enums and checks
4ast [Mon, 22 May 2017 06:24:02 +0000 (23:24 -0700)]
Merge pull request #1194 from palmtenor/minor_fixes
Minor fixes for example and compiler warning
Teng Qin [Sun, 21 May 2017 05:46:00 +0000 (22:46 -0700)]
Fix compiler warning by cast int to pointer
Teng Qin [Sun, 21 May 2017 05:44:32 +0000 (22:44 -0700)]
Get correct PID in TCPSendStack example
Teng Qin [Sun, 21 May 2017 05:11:30 +0000 (22:11 -0700)]
Fix bcc_resolve_symname memory leak in C++ API
Teng Qin [Sat, 20 May 2017 02:10:09 +0000 (19:10 -0700)]
Unify perf event enums in Python API
Teng Qin [Sat, 20 May 2017 02:05:24 +0000 (19:05 -0700)]
Unify perf_event type and config check
Brenden Blanco [Sat, 20 May 2017 05:19:05 +0000 (22:19 -0700)]
Merge pull request #1164 from palmtenor/symboloptions
Add ability for users to control symboling behavior
Teng Qin [Wed, 10 May 2017 19:51:17 +0000 (12:51 -0700)]
Do not pass type flag to symbol callback
As the symbol type check now controled by the specified
`bcc_symbol_option` and handled in lower level, there is not need to
pass the type flag to the callback anymore.
Teng Qin [Wed, 10 May 2017 00:26:02 +0000 (17:26 -0700)]
Use bcc_symbol_option in ProcSyms
This commit makes `ProcSyms` constructor takes a `bcc_symbol_option`,
and pass it down to underlying calls to control symboling behavior.
If `nullptr` is passed, `ProcSyms` will use default setting, which is
to use debug file, verify debug file checksum, and only load function symbols.
This commit also makes `bcc_symcache_new` take a `bcc_symbol_option`
parameter and pass it to the underlying `ProcSyms` constructor.
Teng Qin [Tue, 9 May 2017 22:49:14 +0000 (15:49 -0700)]
Use bcc_symbol_option in bcc_resolve_symname
This commit makes `bcc_resolve_symname` to take an `bcc_symbol_option`
parameter, and pass it to underlying calls to control symboling behavior.
When `NULL` is passed, it will fallback to default which is current
behavior that uses debug file, verify debug file CRC, and check all
types of symbols.
This commit also removes the unneccesary intermediate
`bcc_find_symbol_addr`.
Added documentation for usage of the API, updated most call sites to use
default with `NULL`, and fixed some memory leaks at call sites.
Teng Qin [Tue, 9 May 2017 22:25:39 +0000 (15:25 -0700)]
Fix bcc_resolve_symname memory leak on error
`bcc_resolve_symname` should free `sym->module` on error. Also remove
unused `sym_search_t`
Teng Qin [Thu, 4 May 2017 07:21:20 +0000 (00:21 -0700)]
Use bcc_symbol_option in bcc_foreach_function_symbol
This commit changes `bcc_foreach_symbol` to use the new `bcc_symbol_option` to
control it only wants function symbols. Also renamed it to
bcc_foreach_function_symbol and added comments for better information.
This commit maintained current behavior of the function to prefer use
debug file and check debug file CRC. We could add option to configure
that behavior in the future if needed.
Teng Qin [Thu, 4 May 2017 07:09:20 +0000 (00:09 -0700)]
Add option to control bcc_elf_foreach_sym behavior
This commit adds a `bcc_symbol_option` to configure various symboling
behaviors. Currently added options for reading debug file, and what type
of symbols are wanted.
This commit also makes bcc_elf_foreach_sym take a `bcc_symbol_option`
parameter and repect the specified configurations.
Gabor Buella [Fri, 19 May 2017 13:33:08 +0000 (15:33 +0200)]
Fix usage of CMAKE_BUILD_TYPE setting
The build type was set to Release in the top level cmake file.
This was a rather confusing behaviour, as one would expect to
be able to easily debug the code after using `cmake -DCMAKE_BUILD_TYPE=Debug`.