- 15 Jun, 2016 1 commit
-
-
Brenden Blanco authored
The check for NULL in the return value from C functions was comparing to None incorrectly, causing an error check to pass improperly. Simply check the truthiness of the return instead seems to be more resilient. Add a test as well. Fixes: #568 Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
-
- 13 Jun, 2016 3 commits
-
-
Brenden Blanco authored
libbpf.c: Prepend BPF syscall error to log_bug when debug is enabled.
-
Quentin Monnet authored
When BPF syscall fails and DEBUG_FLAG has been provided to a Python caller script, the BPF error string would be printed only if log_buf had not been filled by the kernel. This commit removes this requirement, printing the error string even if log_buf is not empty. Signed-off-by: Quentin Monnet <quentin.monnet@6wind.com>
-
Quentin Monnet authored
Commit 759029fe provided an option to store the output from BPF syscall into a buffer (and not to print it systematically to standard output) on program load in libbpf.c. But doing so, it only stores the content of attr.log_buf, while the error string--resulting from a failed BPF syscall--is no more displayed when the DEBUG_BPF flag is used in the Python script responsible for converting and injecting the code. This commit proposes a fix for this bug by printing the error message (associated to the return value from the syscall) from the Python caller, when all the following conditions are met: - the syscall fails, - the DEBUG_BPF flag has been provided, and - log_buf is empty (has not been filled by kernel). Note: when DEBUG_BPF is not provided, the error string is printed in the C wrapper in libbpf.c (bpf_prog_load) anyway. Fixes: 759029fe ("Add option for custom log string to bpf_prog_load") Signed-off-by: Quentin Monnet <quentin.monnet@6wind.com>
-
- 08 Jun, 2016 1 commit
-
-
Brendan Gregg authored
Change kernel/user stacks order
-
- 07 Jun, 2016 4 commits
-
-
Evgeny Vereshchagin authored
Closes #559
-
Evgeny Vereshchagin authored
see #559
-
Brendan Gregg authored
offcputime -f: don't miss backtrace bounds
-
Evgeny Vereshchagin authored
See #559
-
- 06 Jun, 2016 3 commits
-
-
Brendan Gregg authored
Update manpage for offcputime
-
Brendan Gregg authored
Fix tools[/old]/offcputime -p PID
-
Evgeny Vereshchagin authored
Closes #558
-
- 03 Jun, 2016 2 commits
-
-
Evgeny Vereshchagin authored
We should extract pid before THREAD_FILTER
-
4ast authored
execsnoop: use BPF_PERF_OUTPUT, add PPID
-
- 02 Jun, 2016 2 commits
-
-
Mark Drayton authored
-
Mark Drayton authored
-
- 01 Jun, 2016 2 commits
-
-
Brenden Blanco authored
set use_errno to True for libbcc.so
-
Brenden Blanco authored
Add user space stack traces to offcputime
-
- 29 May, 2016 1 commit
-
-
Jincheng Miao authored
Currently, errno could not be accessed by libbcc.py, like: ``` binding socket to 'eth0' cannot create raw socket: Operation not permitted Traceback (most recent call last): File "/home/ryan/Software/bcc/examples/networking/http_filter/http-parse-simple.py", line 73, in <module> BPF.attach_raw_socket(function_http_filter, interface) File "/usr/lib/python2.7/site-packages/bcc/__init__.py", line 330, in attach_raw_socket raise Exception("Failed to open raw device %s: %s" % (dev, errstr)) Exception: Failed to open raw device eth0: Success ``` The exception prints the errno as `Success`, instead of `EPERM`. This patch would fix this problem. Signed-off-by: Jincheng Miao <jincheng.miao@gmail.com>
-
- 27 May, 2016 1 commit
-
-
Brenden Blanco authored
Install tools/old
-
- 26 May, 2016 2 commits
-
-
Evgeny Vereshchagin authored
-
Evgeny Vereshchagin authored
-
- 24 May, 2016 6 commits
-
-
4ast authored
lua: Allow LuaJIT parameterized types in `open_perf_buffer`
-
Vicent Marti authored
-
4ast authored
Use BPF_PERF_OUTPUT for fileslower and stacksnoop
-
Mark Drayton authored
-
Andrew Birchall authored
-
Andrew Birchall authored
Summary: * generalize `KernelSymbolCache` into `SymbolCache` which supports user/kernel space symbols * create `BPF.sym()` for resolving user/kernel space symbols * `_ksym_cache` => `_sym_caches` and create `BPF._sym_cache()` to leverage the symbol caches * update `tools/offcputime.py` to print user space stack traces Test Plan: ``` dev[bcc](abirchall_next): ~/bcc_run_tool.sh offcputime -U -k -f 1 ERROR: Displaying user stacks for kernel threads doesn't make sense. devbig680[bcc](abirchall_next): ~/bcc_run_tool.sh offcputime -K -f 1 | grep python2 | head -n 1 python2.7;system_call_fastpath;sys_futex;do_futex;futex_wait;futex_wait_queue_me;schedule 19 dev[bcc](abirchall_next): ~/bcc_run_tool.sh offcputime -U -f 1 | grep python2 | head -n 1 python2.7;clone;start_thread;t_bootstrap;PyEval_CallObjectWithKeywords;PyObject_Call;instancemethod_call;PyObject_Call;function_call;PyEval_EvalCodeEx;PyEval_EvalFrameEx;PyObject_Call;function_call;PyEval_EvalCodeEx;PyEval_EvalFrameEx;time_sleep;PyEval_RestoreThread 5 devbig680[bcc](abirchall_next): ~/bcc_run_tool.sh offcputime -f 1 | grep python2 | head -n 1 python2.7;system_call_fastpath;sys_futex;do_futex;futex_wait;futex_wait_queue_me;schedule;[unknown];__libc_start_main;Py_Main;RunModule;PyObject_Call;function_call;PyEval_EvalCodeEx;PyEval_EvalFrameEx;PyEval_EvalFrameEx;PyEval_EvalCodeEx;PyEval_EvalFrameEx;lock_PyThread_acquire_lock;PyEval_RestoreThread 39 ```
-
- 23 May, 2016 1 commit
-
-
Brenden Blanco authored
Updated monitor.c to take care of host byte order
-
- 20 May, 2016 2 commits
-
-
Brenden Blanco authored
Fix a few fd leaks
-
Martin KaFai Lau authored
/sys/kernel/debug/tracing.
-
- 19 May, 2016 1 commit
-
-
Qasim Sarfraz authored
-
- 17 May, 2016 3 commits
-
-
Brendan Gregg authored
add --kernel-threads-only to tools/offcputime
-
Andrew Birchall authored
Summary: Adds `--kernel-threads-only` arg The kernel-threads-only arg is exclusive with pid/user-threads-only via `parser.add_mutually_exclusive_group`. The output message now indicates what we are tracing (pid/user threads/kernel threads/all threads). Removed the --verbose arg (unused). Test Plan: Run with combinations of the args; validate output looks sane: // test mutually exclusive group ``` devbig680[bcc](abirchall_dev): ~/bcc_run_tool.sh offcputime -k -u 1 [Running] /data/users/abirchall/bcc/tools/offcputime.py -k -u 1 usage: offcputime.py [-h] [-p PID | -k | -u] [-v] [-f] [duration] offcputime.py: error: argument -u/--user-threads-only: not allowed with argument -k/--kernel-threads-only ``` // kernel threads only ``` devbig680[bcc](abirchall_dev): ~/bcc_run_tool.sh offcputime -f -k 1 [Running] /data/users/abirchall/bcc/tools/offcputime.py -f -k 1 swapper/21;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 11 swapper/16;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 19 swapper/22;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 20 swapper/31;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 20 swapper/23;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 67 swapper/25;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 74 ... ``` `~/bcc_run_tool.sh offcputime -f --kernel-threads-only 1` // user threads only `~/bcc_run_tool.sh offcputime -f --user-threads-only 1` `~/bcc_run_tool.sh offcputime -f -u 1` // specific pid `~/bcc_run_tool.sh offcputime -f -p $(pidof hphpi) 1` ``` devbig680[bcc](abirchall_dev): ~/bcc_run_tool.sh offcputime --pid $(pidof mcrouter) 10 | head [Running] /data/users/abirchall/bcc/tools/offcputime.py --pid 95929 10 Tracing off-CPU time (us) of PID 95929 by kernel stack for 10 secs. ``` Note that this last case (specific PID) doesn't appear to be working; I can debug that in a follow up commit.
-
4ast authored
handle ENOMEM in tools/offcputime
-
- 16 May, 2016 4 commits
-
-
Andrew Birchall authored
Summary: * move ENOMEM comment from tools/offcputime.py to src/cc/export/helpers.h * create --stack-storage-size arg to allow the user to set the stack storage size * requires a positive_nonzero_int type checking function for argparse * clean up the rest of the args a bit * use parser.add_mutually_exclusive_group instead of manually handling the mutual exclusion * use positive_nonzero_int for duration arg * use positive_int for pid arg * only print a warning about increasing the storage size if at least one of the get_stackid errors was a -ENOMEM * remove the debug param (we can add this manually when testing) * fix a bug where all processes are traced when specifying pid of 0 Test Plan: ``` devbig680[bcc](no branch, rebasing abirchall_dev): ~/bcc_run_tool.sh offcputime --help [Running] /data/users/abirchall/bcc/tools/offcputime.py --help usage: offcputime.py [-h] [-u | -p PID] [-v] [-f] [--stack-storage-size STACK_STORAGE_SIZE] [duration] Summarize off-CPU time by kernel stack trace positional arguments: duration duration of trace, in seconds optional arguments: -h, --help show this help message and exit -u, --useronly user threads only (no kernel threads) -p PID, --pid PID trace this PID only -v, --verbose show raw addresses -f, --folded output folded format --stack-storage-size STACK_STORAGE_SIZE the number of unique stack traces that can be stored and displayed examples: ./offcputime # trace off-CPU stack time until Ctrl-C ./offcputime 5 # trace for 5 seconds only ./offcputime -f 5 # 5 seconds, and output in folded format ./offcputime -u # don't include kernel threads (user only) ./offcputime -p 185 # trace fo PID 185 only devbig680[bcc](no branch, rebasing abirchall_dev): ~/bcc_run_tool.sh offcputime -f 0 [Running] /data/users/abirchall/bcc/tools/offcputime.py -f 0 usage: offcputime.py [-h] [-u | -p PID] [-v] [-f] [--stack-storage-size STACK_STORAGE_SIZE] [duration] offcputime.py: error: argument duration: must be positive and nonzero devbig680[bcc](no branch, rebasing abirchall_dev): ~/bcc_run_tool.sh offcputime -f -1 [Running] /data/users/abirchall/bcc/tools/offcputime.py -f -1 usage: offcputime.py [-h] [-u | -p PID] [-v] [-f] [--stack-storage-size STACK_STORAGE_SIZE] [duration] offcputime.py: error: argument duration: must be positive and nonzero devbig680[bcc](no branch, rebasing abirchall_dev): ~/bcc_run_tool.sh offcputime --stack-storage-size 0 -f 1 [Running] /data/users/abirchall/bcc/tools/offcputime.py --stack-storage-size 0 -f 1 usage: offcputime.py [-h] [-u | -p PID] [-v] [-f] [--stack-storage-size STACK_STORAGE_SIZE] [duration] offcputime.py: error: argument --stack-storage-size: must be positive and nonzero devbig680[bcc](no branch, rebasing abirchall_dev): ~/bcc_run_tool.sh offcputime --stack-storage-size 1 -f 1 [Running] /data/users/abirchall/bcc/tools/offcputime.py --stack-storage-size 1 -f 1 swapper/27;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 7 swapper/29;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 102 swapper/25;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 113 swapper/26;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 138 swapper/28;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 164 swapper/30;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 177 swapper/24;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 980 swapper/31;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 1556 swapper/1;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2038 swapper/3;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2190 swapper/2;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2235 swapper/15;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2260 swapper/13;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2450 swapper/6;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2646 swapper/12;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2675 swapper/11;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2769 swapper/8;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2885 swapper/4;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 3134 swapper/10;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 3416 swapper/14;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 3702 swapper/7;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 4343 swapper/9;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 5397 swapper/5;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 6836 swapper/17;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 13792 swapper/19;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 14488 swapper/22;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 15298 swapper/18;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 15735 swapper/20;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 17333 swapper/16;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 17645 swapper/23;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 17681 swapper/21;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 18607 WARNING: 92 stack traces could not be displayed. Consider increasing --stack-storage-size.
-
Andrew Birchall authored
Summary: BPF_STACK_TRACE(_name, _size) will allocate space for _size stack traces (see https://github.com/torvalds/linux/blob/master/kernel/bpf/stackmap.c#L30-L50). If we've already used all of this space, subsequent calls to bpf_get_stackid() will return -ENOMEM (see https://github.com/torvalds/linux/blob/master/kernel/bpf/stackmap.c#L173-L176). This causes our BPF bytecode to store this value in key_t.stack_id and subsequently causes our python application to crash due to a KeyError when invoking stack_traces.walk(k.stack_id). Let's avoid calling stack_traces.walk(k.stack_id) with back stackid's Test Plan: Run offcputime.py in an extreme case; with space for only a single stack trace ``` devbig680[bcc](tools): sed_in_file 's/BPF_STACK_TRACE(stack_traces, 1024)/BPF_STACK_TRACE(stack_traces, 1)/' tools/offcputime.py && \ > ~/bcc_run_tool.sh offcputime -f 5; \ > git reset --hard HEAD swapper/30;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 496 swapper/26;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 553 swapper/28;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 604 swapper/31;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 692 swapper/23;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 713 swapper/18;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 919 swapper/16;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 1051 swapper/20;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 1056 swapper/21;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 1585 swapper/24;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 1597 swapper/27;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 1610 swapper/17;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 1674 swapper/22;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2390 swapper/25;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2574 swapper/19;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 2589 swapper/29;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 8428 swapper/8;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 15272 swapper/15;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 15591 swapper/11;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 17934 swapper/9;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 18100 swapper/14;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 18266 swapper/10;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 20124 swapper/12;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 20887 swapper/13;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 23453 swapper/3;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 27296 swapper/5;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 29094 swapper/6;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 29799 swapper/7;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 31522 swapper/1;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 32269 swapper/4;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 35585 swapper/2;start_secondary;cpu_startup_entry;schedule_preempt_disabled;schedule 37627 WARNING: 249 stack traces could not be displayed. Consider increasing stack trace storage size. HEAD is now at d3365e9 [RFC] handle ENOMEM in tools/offcputime` ```
-
4ast authored
http_filter fixes
-
Bertrone Matteo authored
-
- 13 May, 2016 1 commit
-
-
Qasim Sarfraz authored
-