From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Wang Nan <wangnan0@huawei.com>
Cc: pi3orama@163.com, linux-kernel@vger.kernel.org,
lizefan@huawei.com, Wang Nan <wangnan0@hauwei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Jiri Olsa <jolsa@kernel.org>
Subject: Re: [PATCH 4/4] perf bpf: Automatically create bpf-output event __bpf_stdout__
Date: Fri, 8 Apr 2016 14:54:28 -0300 [thread overview]
Message-ID: <20160408175428.GA25165@kernel.org> (raw)
In-Reply-To: <1460128045-97310-5-git-send-email-wangnan0@huawei.com>
Em Fri, Apr 08, 2016 at 03:07:25PM +0000, Wang Nan escreveu:
> struct bpf_map_def SEC("maps") __bpf_stdout__ = {
> .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
> .key_size = sizeof(int),
> .value_size = sizeof(u32),
> .max_entries = __NR_CPUS__,
> };
>
> static inline int __attribute__((always_inline))
> func(void *ctx, int type)
> {
> char output_str[] = "Raise a BPF event!";
> char err_str[] = "BAD %d\n";
> int err;
>
> err = perf_event_output(ctx, &channel, get_smp_processor_id(),
I had to change channel here to __bpf_stdout__, then it works :-)
> &output_str, sizeof(output_str));
> if (err)
> trace_printk(err_str, sizeof(err_str), err);
> return 1;
Asking for strace-like output for 'nanosleep', the function hooked:
[root@jouet bpf]# trace -e nanosleep --ev test_bpf_stdout.c usleep 1
0.007 ( 0.007 ms): usleep/729 nanosleep(rqtp: 0x7ffc5bbc5fe0) ...
0.007 ( ): __bpf_stdout__:Raise a BPF event!..)
0.008 ( ): perf_bpf_probe:func_begin:(ffffffff81112460))
0.069 ( ): __bpf_stdout__:Raise a BPF event!..)
0.070 ( ): perf_bpf_probe:func_end:(ffffffff81112460 <- ffffffff81003d92))
0.072 ( 0.072 ms): usleep/729 ... [continued]: nanosleep()) = 0
[root@jouet bpf]#
Ok, merged those, now lets see how all this mixes with callchains...
- Arnaldo
next prev parent reply other threads:[~2016-04-08 17:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-08 15:07 [PATCH 0/4] perf bpf: Add __bpf_stdout__ support Wang Nan
2016-04-08 15:07 ` [PATCH 1/4] perf trace: Improve error message when receive non-tracepoint events Wang Nan
2016-04-08 15:22 ` Arnaldo Carvalho de Melo
2016-04-08 16:12 ` Wangnan (F)
2016-04-08 17:33 ` Arnaldo Carvalho de Melo
2016-04-08 15:07 ` [PATCH 2/4] perf trace: Print content of bpf-output event Wang Nan
2016-04-08 15:55 ` Wangnan (F)
2016-04-08 17:25 ` Arnaldo Carvalho de Melo
2016-04-08 15:07 ` [PATCH 3/4] perf bpf: Clone bpf stdout events in multiple bpf scripts Wang Nan
2016-04-08 17:35 ` Arnaldo Carvalho de Melo
2016-04-13 7:22 ` [tip:perf/core] " tip-bot for Wang Nan
2016-04-08 15:07 ` [PATCH 4/4] perf bpf: Automatically create bpf-output event __bpf_stdout__ Wang Nan
2016-04-08 17:54 ` Arnaldo Carvalho de Melo [this message]
2016-04-13 7:22 ` [tip:perf/core] " tip-bot for Wang Nan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160408175428.GA25165@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=pi3orama@163.com \
--cc=wangnan0@hauwei.com \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).