Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1245585
| From | He Kuang <hekuang@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers |
| Date | 2015-10-13 13:00 +0200 |
| Message-ID | <qj5th-4gD-23@gated-at.bofh.it> (permalink) |
| References | (4 earlier) <qiYBr-2Ii-5@gated-at.bofh.it> <qiYUO-35B-3@gated-at.bofh.it> <qiZe9-3H1-9@gated-at.bofh.it> <qiZxw-46G-9@gated-at.bofh.it> <qj0ae-55H-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
hi, Alexei >> What about using similar >> implementation >> like PERF_EVENT_IOC_SET_OUTPUT, creating a new ioctl like >> PERF_EVENT_IOC_SET_ENABLER, >> then let perf to select an event as 'enabler', then BPF can still >> control one atomic >> variable to enable/disable a set of events. > > you lost me on that last sentence. How this 'enabler' will work? > Also I'm still missing what's wrong with perf doing ioctl() on > events on all cpus manually when bpf program tells it to do so. > Is it speed you concerned about or extra work in perf ? > > For not having too much wakeups, perf ringbuffer has a watermark limit to cache events and reduce the wakeups, which causes perf userspace tool can not receive perf events immediately. Here's a simple demo expamle to prove it, 'sleep_exec' does some writes and prints a timestamp every second, and an lable is printed when perf poll gets events. $ perf record -m 2 -e syscalls:sys_enter_write sleep_exec 1000 userspace sleep time: 0 seconds userspace sleep time: 1 seconds userspace sleep time: 2 seconds userspace sleep time: 3 seconds perf record wakeup onetime 0 userspace sleep time: 4 seconds userspace sleep time: 5 seconds userspace sleep time: 6 seconds userspace sleep time: 7 seconds perf record wakeup onetime 1 userspace sleep time: 8 seconds perf record wakeup onetime 2 .. $ perf record -m 1 -e syscalls:sys_enter_write sleep_exec 1000 userspace sleep time: 0 seconds userspace sleep time: 1 seconds perf record wakeup onetime 0 userspace sleep time: 2 seconds userspace sleep time: 3 seconds perf record wakeup onetime 1 userspace sleep time: 4 seconds userspace sleep time: 5 seconds .. By default, if no mmap_pages is specified, perf tools wakeup only when the target executalbe finished: $ perf record -e syscalls:sys_enter_write sleep_exec 5 userspace sleep time: 0 seconds userspace sleep time: 1 seconds userspace sleep time: 2 seconds userspace sleep time: 3 seconds userspace sleep time: 4 seconds perf record wakeup onetime 0 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.006 MB perf.data (54 samples) ] If we want perf to reflect as soon as our sample event be generated, --no-buffering should be used, but this option has a greater impact on performance. $ perf record --no-buffering -e syscalls:sys_enter_write sleep_exec 1000 userspace sleep time: 0 seconds perf record wakeup onetime 0 perf record wakeup onetime 1 perf record wakeup onetime 2 perf record wakeup onetime 3 perf record wakeup onetime 4 perf record wakeup onetime 5 perf record wakeup onetime 6 .. Thank you -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers Kaixu Xia <xiakaixu@huawei.com> - 2015-10-12 11:10 +0200
Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers Alexei Starovoitov <ast@plumgrid.com> - 2015-10-12 21:30 +0200
Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-13 05:30 +0200
Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers Alexei Starovoitov <ast@plumgrid.com> - 2015-10-13 05:40 +0200
Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-13 06:00 +0200
Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers Alexei Starovoitov <ast@plumgrid.com> - 2015-10-13 06:20 +0200
Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-13 06:40 +0200
Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers Alexei Starovoitov <ast@plumgrid.com> - 2015-10-13 07:20 +0200
Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-13 09:10 +0200
Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers He Kuang <hekuang@huawei.com> - 2015-10-13 13:00 +0200
Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers "Wangnan (F)" <wangnan0@huawei.com> - 2015-10-13 13:20 +0200
Re: [RFC PATCH 2/2] bpf: Implement bpf_perf_event_sample_enable/disable() helpers Alexei Starovoitov <ast@plumgrid.com> - 2015-10-14 07:20 +0200
csiph-web