platform/upstream/bcc.git
8 years agoMerge pull request #563 from qmonnet/debug-output
Brenden Blanco [Mon, 13 Jun 2016 11:59:42 +0000 (04:59 -0700)]
Merge pull request #563 from qmonnet/debug-output

libbpf.c: Prepend BPF syscall error to log_bug when debug is enabled.

8 years agopython: With DEBUG_BPF, print BPF error even if log_buf is not empty.
Quentin Monnet [Thu, 9 Jun 2016 12:55:29 +0000 (14:55 +0200)]
python: With DEBUG_BPF, print BPF error even if log_buf is not empty.

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>
8 years agopython: Print BPF syscall error if DEBUG_BPF is on but log_buf is empty.
Quentin Monnet [Thu, 9 Jun 2016 12:55:29 +0000 (14:55 +0200)]
python: Print BPF syscall error if DEBUG_BPF is on but log_buf is empty.

Commit 759029fea8066b41b54be5447137db95cb1313c4 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>
8 years agoMerge pull request #562 from evverx/change-kernel-user-stacks-order
Brendan Gregg [Wed, 8 Jun 2016 18:44:49 +0000 (11:44 -0700)]
Merge pull request #562 from evverx/change-kernel-user-stacks-order

Change kernel/user stacks order

8 years agooffcputime: add the -d option
Evgeny Vereshchagin [Tue, 7 Jun 2016 20:33:54 +0000 (06:33 +1000)]
offcputime: add the -d option

Closes #559

8 years agooffcputime: change user/kernel stack order
Evgeny Vereshchagin [Tue, 7 Jun 2016 20:06:33 +0000 (06:06 +1000)]
offcputime: change user/kernel stack order

see #559

8 years agoMerge pull request #561 from evverx/folded-dont-miss-backtrace-part
Brendan Gregg [Tue, 7 Jun 2016 15:49:19 +0000 (08:49 -0700)]
Merge pull request #561 from evverx/folded-dont-miss-backtrace-part

offcputime -f: don't miss backtrace bounds

8 years agooffcputime -f: don't miss backtrace bounds
Evgeny Vereshchagin [Tue, 7 Jun 2016 08:00:01 +0000 (18:00 +1000)]
offcputime -f: don't miss backtrace bounds

See #559

8 years agoMerge pull request #560 from evverx/clarify-offcputime
Brendan Gregg [Mon, 6 Jun 2016 19:45:02 +0000 (12:45 -0700)]
Merge pull request #560 from evverx/clarify-offcputime

Update manpage for offcputime

8 years agoMerge pull request #554 from evverx/fix-p-option
Brendan Gregg [Mon, 6 Jun 2016 18:18:54 +0000 (11:18 -0700)]
Merge pull request #554 from evverx/fix-p-option

Fix tools[/old]/offcputime -p PID

8 years agoUpdate manpage for offcputime
Evgeny Vereshchagin [Mon, 6 Jun 2016 09:25:54 +0000 (09:25 +0000)]
Update manpage for offcputime

Closes #558

8 years agoFix tools[/old]/offcputime -p PID
Evgeny Vereshchagin [Fri, 27 May 2016 06:13:52 +0000 (06:13 +0000)]
Fix tools[/old]/offcputime -p PID

We should extract pid before THREAD_FILTER

8 years agoMerge pull request #555 from markdrayton/execsnoop
4ast [Fri, 3 Jun 2016 01:15:43 +0000 (18:15 -0700)]
Merge pull request #555 from markdrayton/execsnoop

execsnoop: use BPF_PERF_OUTPUT, add PPID

8 years agoexecsnoop: show PPID in output
Mark Drayton [Thu, 2 Jun 2016 09:53:34 +0000 (10:53 +0100)]
execsnoop: show PPID in output

8 years agoexecsnoop: use BPF_PERF_OUTPUT instead of trace pipe
Mark Drayton [Thu, 2 Jun 2016 09:53:20 +0000 (10:53 +0100)]
execsnoop: use BPF_PERF_OUTPUT instead of trace pipe

8 years agoMerge pull request #557 from ryanmiao/mypr
Brenden Blanco [Wed, 1 Jun 2016 01:21:10 +0000 (18:21 -0700)]
Merge pull request #557 from ryanmiao/mypr

set use_errno to True for libbcc.so

8 years agoMerge pull request #544 from abirchall/abirchall_release
Brenden Blanco [Wed, 1 Jun 2016 01:16:06 +0000 (18:16 -0700)]
Merge pull request #544 from abirchall/abirchall_release

Add user space stack traces to offcputime

8 years agoset use_errno to True for libbcc.so
Jincheng Miao [Sun, 29 May 2016 05:17:03 +0000 (13:17 +0800)]
set use_errno to True for libbcc.so

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>
8 years agoMerge pull request #552 from evverx/install-tools-old
Brenden Blanco [Fri, 27 May 2016 00:42:13 +0000 (17:42 -0700)]
Merge pull request #552 from evverx/install-tools-old

Install tools/old

8 years agoPoint people to tools/old
Evgeny Vereshchagin [Thu, 26 May 2016 09:11:44 +0000 (09:11 +0000)]
Point people to tools/old

8 years agoInstall tools/old too
Evgeny Vereshchagin [Thu, 26 May 2016 08:50:50 +0000 (08:50 +0000)]
Install tools/old too

8 years agoMerge pull request #551 from vmg/vmg/lua-para
4ast [Tue, 24 May 2016 20:30:39 +0000 (13:30 -0700)]
Merge pull request #551 from vmg/vmg/lua-para

lua: Allow LuaJIT parameterized types in `open_perf_buffer`

8 years agolua: Allow LuaJIT parameterized types in `open_perf_buffer`
Vicent Marti [Tue, 24 May 2016 15:57:34 +0000 (17:57 +0200)]
lua: Allow LuaJIT parameterized types in `open_perf_buffer`

8 years agoMerge pull request #550 from markdrayton/trace-fields
4ast [Tue, 24 May 2016 15:43:51 +0000 (08:43 -0700)]
Merge pull request #550 from markdrayton/trace-fields

Use BPF_PERF_OUTPUT for fileslower and stacksnoop

8 years agoUse BPF_PERF_OUTPUT for fileslower and stacksnoop
Mark Drayton [Tue, 24 May 2016 14:01:01 +0000 (07:01 -0700)]
Use BPF_PERF_OUTPUT for fileslower and stacksnoop

8 years agoUpdate documentation and man page for offcputime
Andrew Birchall [Tue, 24 May 2016 08:44:41 +0000 (01:44 -0700)]
Update documentation and man page for offcputime

8 years agoAdd user space stack traces to offcputime
Andrew Birchall [Thu, 5 May 2016 17:56:40 +0000 (10:56 -0700)]
Add user space stack traces to offcputime

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
```

8 years agoMerge pull request #535 from MQasimSarfraz/patch-1
Brenden Blanco [Mon, 23 May 2016 02:55:06 +0000 (19:55 -0700)]
Merge pull request #535 from MQasimSarfraz/patch-1

Updated monitor.c to take care of host byte order

8 years agoMerge pull request #546 from iamkafai/master
Brenden Blanco [Fri, 20 May 2016 17:31:30 +0000 (10:31 -0700)]
Merge pull request #546 from iamkafai/master

Fix a few fd leaks

8 years agoThis diff fixes a few fd leaks after reading files under
Martin KaFai Lau [Fri, 20 May 2016 06:04:41 +0000 (23:04 -0700)]
This diff fixes a few fd leaks after reading files under
/sys/kernel/debug/tracing.

8 years agoRemoving htons in tunnel.py for consistency.
Qasim Sarfraz [Thu, 19 May 2016 10:02:26 +0000 (15:02 +0500)]
Removing htons in tunnel.py for consistency.

8 years agoMerge pull request #543 from abirchall/abirchall_release
Brendan Gregg [Tue, 17 May 2016 20:41:33 +0000 (13:41 -0700)]
Merge pull request #543 from abirchall/abirchall_release

add --kernel-threads-only to tools/offcputime

8 years agoadd --kernel-threads-only to tools/offcputime
Andrew Birchall [Wed, 4 May 2016 23:03:34 +0000 (16:03 -0700)]
add --kernel-threads-only to tools/offcputime

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.

8 years agoMerge pull request #533 from abirchall/abirchall_dev
4ast [Tue, 17 May 2016 18:10:48 +0000 (11:10 -0700)]
Merge pull request #533 from abirchall/abirchall_dev

handle ENOMEM in tools/offcputime

8 years agomove ENOMEM comment; create --stack-storage-size arg; misc cleanup
Andrew Birchall [Thu, 12 May 2016 01:31:49 +0000 (18:31 -0700)]
move ENOMEM comment; create --stack-storage-size arg; misc cleanup

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.

8 years agohandle ENOMEM in tools/offcputime
Andrew Birchall [Tue, 3 May 2016 23:54:00 +0000 (16:54 -0700)]
handle ENOMEM in tools/offcputime

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`
```

8 years agoMerge pull request #542 from mbertrone/master
4ast [Mon, 16 May 2016 14:23:21 +0000 (07:23 -0700)]
Merge pull request #542 from mbertrone/master

http_filter fixes

8 years agoinvalid access fixed. parameter for specify the interface added
Bertrone Matteo [Mon, 16 May 2016 13:46:01 +0000 (06:46 -0700)]
invalid access fixed. parameter for specify the interface added

8 years agoMerge branch 'master' into patch-1
Qasim Sarfraz [Fri, 13 May 2016 13:15:43 +0000 (18:15 +0500)]
Merge branch 'master' into patch-1

8 years agoAvoid byte swap for vxlan port
Qasim Sarfraz [Wed, 11 May 2016 07:37:55 +0000 (12:37 +0500)]
Avoid byte swap for vxlan port

Signed-off-by: MQasimSarfraz <qasims@example.com>
8 years agoMerge pull request #539 from markdrayton/lua-tools
4ast [Fri, 13 May 2016 00:26:02 +0000 (17:26 -0700)]
Merge pull request #539 from markdrayton/lua-tools

Lua ports of biosnoop and stacksnoop

8 years agoLua ports of biosnoop and stacksnoop
Mark Drayton [Wed, 20 Apr 2016 21:11:00 +0000 (14:11 -0700)]
Lua ports of biosnoop and stacksnoop

8 years agoMerge pull request #541 from zaafar/master
Brenden Blanco [Thu, 12 May 2016 16:06:21 +0000 (09:06 -0700)]
Merge pull request #541 from zaafar/master

updated cmake system to include lua and new networking example

8 years agoUpdated the cmake file system to include lua and new networking tools.
Zaafar Ahmed [Wed, 11 May 2016 22:38:35 +0000 (03:38 +0500)]
Updated the cmake file system to include lua and new networking tools.

8 years agoMerge pull request #536 from valkum/master
4ast [Wed, 11 May 2016 20:58:14 +0000 (13:58 -0700)]
Merge pull request #536 from valkum/master

Add new example with test case for for unroll, as requested.

8 years agoMerge pull request #538 from iovisor/luajit_header_revert
Brenden Blanco [Wed, 11 May 2016 20:48:54 +0000 (13:48 -0700)]
Merge pull request #538 from iovisor/luajit_header_revert

Revert "Force lua main.c to include luajit headers"

8 years agoRevert "Force lua main.c to include luajit headers"
Brenden Blanco [Wed, 11 May 2016 19:57:16 +0000 (12:57 -0700)]
Revert "Force lua main.c to include luajit headers"

This reverts commit c21b9c036cba26e2927fbb5e46985faa73ef743e.

Instead, use `LUAJIT_DIR=/usr/include/luajit-2.0 cmake ..` or similar as
required.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
8 years agoMissed this one by extracting this from my actual program.
Valkum [Wed, 11 May 2016 18:34:30 +0000 (20:34 +0200)]
Missed this one by extracting this from my actual program.

8 years agoAdd dns_matching example with test case for for unroll, as requested at iovisor-dev...
Valkum [Wed, 11 May 2016 12:47:35 +0000 (14:47 +0200)]
Add dns_matching example with test case for for unroll, as requested at iovisor-dev@lists.iovisor.org

8 years agoMerge pull request #531 from kivikakk/lua-install-docs
Brenden Blanco [Fri, 6 May 2016 18:29:41 +0000 (11:29 -0700)]
Merge pull request #531 from kivikakk/lua-install-docs

Lua installation instructions.

8 years agoLua installation instructions.
Nicole Izumi [Fri, 6 May 2016 18:19:14 +0000 (11:19 -0700)]
Lua installation instructions.

8 years agoMerge pull request #518 from vmg/vmg/lua-usdt-2
Brenden Blanco [Fri, 6 May 2016 14:09:18 +0000 (07:09 -0700)]
Merge pull request #518 from vmg/vmg/lua-usdt-2

[RFC] New USDT API

8 years agocc: Use `unique_ptr` instead of `shared_ptr`
Vicent Marti [Fri, 6 May 2016 08:51:54 +0000 (10:51 +0200)]
cc: Use `unique_ptr` instead of `shared_ptr`

8 years agocc: Style fixes
Vicent Marti [Wed, 4 May 2016 14:59:57 +0000 (16:59 +0200)]
cc: Style fixes

8 years agocc: Better memory handling for USDT probes
Vicent Marti [Wed, 4 May 2016 14:58:51 +0000 (16:58 +0200)]
cc: Better memory handling for USDT probes

8 years agousdt: Implement `bpf_usdt_readarg` as frontend action
Vicent Marti [Wed, 4 May 2016 11:01:55 +0000 (13:01 +0200)]
usdt: Implement `bpf_usdt_readarg` as frontend action

8 years agocc: Style fixes
Vicent Marti [Sun, 1 May 2016 11:41:33 +0000 (13:41 +0200)]
cc: Style fixes

8 years agolua: Fix tests
Vicent Marti [Sun, 1 May 2016 11:40:43 +0000 (13:40 +0200)]
lua: Fix tests

8 years agolua: Implement "Hello world" USDT example
Vicent Marti [Sun, 1 May 2016 10:54:51 +0000 (12:54 +0200)]
lua: Implement "Hello world" USDT example

8 years agolua: Implement an USDT helper
Vicent Marti [Sun, 1 May 2016 10:54:25 +0000 (12:54 +0200)]
lua: Implement an USDT helper

8 years agocc: Wrap the USDT probe context in a C API
Vicent Marti [Sun, 1 May 2016 10:53:46 +0000 (12:53 +0200)]
cc: Wrap the USDT probe context in a C API

8 years agocc: Implement `bcc_resolve_global_addr` helper
Vicent Marti [Sun, 1 May 2016 10:52:46 +0000 (12:52 +0200)]
cc: Implement `bcc_resolve_global_addr` helper

8 years agoMerge pull request #530 from iovisor/bblanco_dev
4ast [Thu, 5 May 2016 20:44:13 +0000 (13:44 -0700)]
Merge pull request #530 from iovisor/bblanco_dev

Add check for number of arguments

8 years agoFixup tplist and argdist for python3 compat
Brenden Blanco [Thu, 5 May 2016 19:05:07 +0000 (12:05 -0700)]
Fixup tplist and argdist for python3 compat

sys.exc_value and sys.exc_type should come from sys.exc_info()

Convert (decode) char* return values from C functions to a native python
str.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
8 years agoAdd check for number of arguments
Brenden Blanco [Thu, 5 May 2016 18:37:59 +0000 (11:37 -0700)]
Add check for number of arguments

There are two problems here:
 1. bcc is leaving the extra function parameters in the prototype, when
 these really just serve as an annotation on the method being traced.
 They aren't really passed into the function. LLVM lowering phase later
 errors out on such functions.
 2. bcc doesn't limit the size of the argument list, when currently it
 just supports up to the number of arguments held in registers (6).

Fix 1. by rewriting the arguments out of the prototype and into the
preamble where they are currently being initialized.
Fix 2. by enforcing the limit and returning a more meaningful error
message.

Added a test case.

Extra fix included for string type on python3.

Fixes: #497
Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
8 years agoMerge pull request #529 from rnav/ptregs_helpers_v2
Brenden Blanco [Thu, 5 May 2016 15:36:22 +0000 (08:36 -0700)]
Merge pull request #529 from rnav/ptregs_helpers_v2

Introduce helpers to access pt_regs in an arch-independent manner

8 years agocc: introduce helpers to access pt_regs in an arch-independent manner
Naveen N. Rao [Tue, 3 May 2016 09:24:21 +0000 (14:54 +0530)]
cc: introduce helpers to access pt_regs in an arch-independent manner

Convert some of the examples and tools to use the new helpers.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
8 years agoMerge pull request #528 from iovisor/bblanco_dev
Brenden Blanco [Thu, 5 May 2016 06:20:37 +0000 (23:20 -0700)]
Merge pull request #528 from iovisor/bblanco_dev

fix llvm 3.9 build

8 years agofix llvm 3.9 build
Brenden Blanco [Thu, 5 May 2016 06:13:01 +0000 (23:13 -0700)]
fix llvm 3.9 build

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
8 years agoMerge pull request #524 from iovisor/luajit_header
4ast [Thu, 5 May 2016 00:19:49 +0000 (17:19 -0700)]
Merge pull request #524 from iovisor/luajit_header

Force lua main.c to include luajit headers

8 years agoForce lua main.c to include luajit headers
Brenden Blanco [Wed, 4 May 2016 06:49:37 +0000 (23:49 -0700)]
Force lua main.c to include luajit headers

On my system, when both lua and luajit are installed, multiple headers
exist in /usr/include. However, my lua installation is 5.3, which has
some api-breaking changes, which means that the standard lua.h must not
be included.

Simply force lua.h to come from luajit-2.0 directory.

8 years agoMerge pull request #523 from iovisor/bblanco_dev
4ast [Tue, 3 May 2016 16:49:57 +0000 (09:49 -0700)]
Merge pull request #523 from iovisor/bblanco_dev

Make style-check test non-blocking

8 years agoMake style-check test non-blocking
Brenden Blanco [Tue, 3 May 2016 16:39:54 +0000 (09:39 -0700)]
Make style-check test non-blocking

Since the codebase is as of yet inconsistent, disable per-commit style
check enforcement.

This should be turned back on once the codebase style is consistent.

8 years agoMerge pull request #521 from iovisor/bblanco_dev
Brendan Gregg [Tue, 3 May 2016 16:18:23 +0000 (09:18 -0700)]
Merge pull request #521 from iovisor/bblanco_dev

Adjust pid filtering/display in runqlat

8 years agoAdjust pid filtering/display in runqlat
Brenden Blanco [Tue, 3 May 2016 06:32:44 +0000 (23:32 -0700)]
Adjust pid filtering/display in runqlat

The filtering and display of pids in the runqlat tool was not correct.
Internally, the kernel keeps pid and tgid, which correspond to thread-id
and user process-id, respectively. The runqlat tool was filtering and
displaying pid instead of tgid.

Change -P and -p options to filter by tgid, and add a new option to give
a breakdown by pid (thread-id).

Update the docs with the -L option.

8 years agoMerge pull request #519 from iovisor/bblanco_dev
4ast [Mon, 2 May 2016 15:46:58 +0000 (08:46 -0700)]
Merge pull request #519 from iovisor/bblanco_dev

Fixes for clang frontend bugs and misc

8 years agoMerge branch 'master' into bblanco_dev
Brenden Blanco [Mon, 2 May 2016 15:34:47 +0000 (08:34 -0700)]
Merge branch 'master' into bblanco_dev

8 years agoMerge pull request #520 from rnav/powerpc-support-v2
4ast [Mon, 2 May 2016 15:34:15 +0000 (08:34 -0700)]
Merge pull request #520 from rnav/powerpc-support-v2

Powerpc support v2

8 years agotests: fix a few tests to use the right register on powerpc
Naveen N. Rao [Fri, 29 Apr 2016 11:16:05 +0000 (16:46 +0530)]
tests: fix a few tests to use the right register on powerpc

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
8 years agotests: only test arch-specific symbols
Naveen N. Rao [Fri, 29 Apr 2016 11:14:41 +0000 (16:44 +0530)]
tests: only test arch-specific symbols

__per_cpu_start has a different address on each architecture. Instead,
use a arch-unique symbol for the test.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
8 years agocc: add powerpc support
Naveen N. Rao [Fri, 29 Apr 2016 11:12:58 +0000 (16:42 +0530)]
cc: add powerpc support

Basic support for building on powerpc. Tested on ppc64le.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
8 years agoFix errors on python3
Brenden Blanco [Mon, 2 May 2016 05:42:04 +0000 (22:42 -0700)]
Fix errors on python3

8 years agoUse local key/leaf definition instead of bpf_tunnel_key
Brenden Blanco [Mon, 2 May 2016 04:31:16 +0000 (21:31 -0700)]
Use local key/leaf definition instead of bpf_tunnel_key

Even after fixing the nested union issue in the preceding commits, this
example was failing. The reason was that the kernel was filling in all
bits of the bpf_tunnel_key, which in recent kernels includes non-zero
fields such as ttl. That non-zero field would break the lookup in the
tunkey2if table, which was populated assuming all extra bytes would be
zero.

Fix it by defining a simpler key structure, and copy the required fields
out from the local variable.

Fixes: #510

8 years agoAdd clang support for nested struct/union as key field
Brenden Blanco [Mon, 2 May 2016 04:29:08 +0000 (21:29 -0700)]
Add clang support for nested struct/union as key field

Clang was up until now not able to parse nested structs or unions as a
field in the table key or leaf. Add support in the library side, as well
as python support for the exported json description.

8 years agoAdd a test for broken nested union clang parsing
Brenden Blanco [Mon, 2 May 2016 04:27:19 +0000 (21:27 -0700)]
Add a test for broken nested union clang parsing

8 years agoAvoid a warning in bpf_module.cc
Brenden Blanco [Mon, 2 May 2016 04:26:04 +0000 (21:26 -0700)]
Avoid a warning in bpf_module.cc

The variable inside the if statement was unused, unliked the blocks
above and below it. Use the isa<> check instead.

8 years agoskip include of kernel bpf.h in test, forward declare instead
Brenden Blanco [Mon, 2 May 2016 04:24:29 +0000 (21:24 -0700)]
skip include of kernel bpf.h in test, forward declare instead

8 years agoMerge pull request #517 from vmg/vmg/clang-diag
4ast [Sat, 30 Apr 2016 23:04:00 +0000 (16:04 -0700)]
Merge pull request #517 from vmg/vmg/clang-diag

cc/clang: Use positional arguments for diagnostic messages

8 years agoMerge pull request #515 from vmg/vmg/static-lua
4ast [Sat, 30 Apr 2016 15:11:31 +0000 (08:11 -0700)]
Merge pull request #515 from vmg/vmg/static-lua

Lua tooling improvements

8 years agocc/clang: Use positional arguments for diagnostic messages
Vicent Marti [Sat, 30 Apr 2016 12:57:52 +0000 (14:57 +0200)]
cc/clang: Use positional arguments for diagnostic messages

8 years agolua: Proper style for main.c
Vicent Marti [Sat, 30 Apr 2016 12:35:47 +0000 (14:35 +0200)]
lua: Proper style for main.c

8 years agolua: Do not try to detach buffers as kprobes
Vicent Marti [Sat, 30 Apr 2016 12:13:26 +0000 (14:13 +0200)]
lua: Do not try to detach buffers as kprobes

8 years agotable.py: Call `__delitem__ when deleting an item :)
Vicent Marti [Sat, 30 Apr 2016 12:00:11 +0000 (14:00 +0200)]
table.py: Call `__delitem__ when deleting an item :)

8 years agolua: Fix regeneration of `bcc.lua`
Vicent Marti [Sat, 30 Apr 2016 11:50:48 +0000 (13:50 +0200)]
lua: Fix regeneration of `bcc.lua`

8 years agobcc-lua: Build as a C executable
Vicent Marti [Sat, 30 Apr 2016 11:37:09 +0000 (13:37 +0200)]
bcc-lua: Build as a C executable

8 years agolua: Make all probes executable
Vicent Marti [Sat, 30 Apr 2016 11:22:42 +0000 (13:22 +0200)]
lua: Make all probes executable

8 years agolua: build as a standalone tool with static libbcc
Vicent Marti [Sat, 30 Apr 2016 11:14:28 +0000 (13:14 +0200)]
lua: build as a standalone tool with static libbcc

8 years agoMerge pull request #514 from mcaleavya/master
Brendan Gregg [Fri, 29 Apr 2016 17:57:45 +0000 (10:57 -0700)]
Merge pull request #514 from mcaleavya/master

updated opensnoop to use bpf_perf_output

8 years agoupdated opensnoop to use bpf_perf_output
mcaleavya [Fri, 29 Apr 2016 12:38:51 +0000 (13:38 +0100)]
updated opensnoop to use bpf_perf_output

8 years agoMerge pull request #498 from vmg/vmg/usdt
4ast [Thu, 28 Apr 2016 21:14:41 +0000 (14:14 -0700)]
Merge pull request #498 from vmg/vmg/usdt

[WIP] Native implementation for USDT probes