Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1457024
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling |
| Date | 2016-08-05 13:00 +0200 |
| Message-ID | <s2L17-6pn-13@gated-at.bofh.it> (permalink) |
| References | (3 earlier) <s29yy-6kO-15@gated-at.bofh.it> <s2rON-1X4-1@gated-at.bofh.it> <s2CqR-WV-1@gated-at.bofh.it> <s2Ff3-2Of-1@gated-at.bofh.it> <s2FRL-3iN-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Aug 04, 2016 at 10:24:06PM -0700, Alexei Starovoitov wrote: > tracepoints are actually zero overhead already via static-key mechanism. > I don't think Peter's objection for the tracepoint was due to overhead. Almost 0, they still have some I$ footprint, but yes. My main worry is that we can feed tracepoints into perf, so having tracepoints in perf is tricky. I also don't much like this tracepoint being specific to the hrtimer bits, I can well imagine people wanting to do the same thing for hardware based samples or whatnot. > > The perf:perf_hrtimer probe point is also reading state mid-way > > through a function, so it's not quite as simple as wrapping the > > function pointer. I do like that idea, though, but for things like > > struct file_operations. So what additional state to you need? > > > Currently overflow_handler is set at event alloc time. If we start > > > changing it on the fly with atomic xchg(), afaik things shouldn't > > > break, since each overflow_handler is run to completion and doesn't > > > change global state, right? Yes, or even a simple WRITE_ONCE() to replace it, as long as we make sure to use a READ_ONCE() to load the pointer. As long as we're sure to limit this poking to a single user its fairly simple to get right. The moment there can be concurrency a lot of fail can happen. > instead of adding a tracepoint to perf_swevent_hrtimer we can replace > overflow_handler for that particular event with some form of bpf wrapper. > (probably new bpf program type). Then not only periodic events > will be triggering bpf prog, but pmu events as well. Exactly. > So instead of normal __perf_event_output() writing into ringbuffer, > a bpf prog will be called that can optionally write into different > rb via bpf_perf_event_output. It could even chain and call into the original function once its done and have both outputs. > The question is what to pass into the > program to make the most use out of it. 'struct pt_regs' is done deal. > but perf_sample_data we cannot pass as-is, since it's kernel internal. Urgh, does it have to be stable API? Can't we simply rely on the kernel headers to provide the right structure definition?
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Brendan Gregg <bgregg@netflix.com> - 2016-08-03 05:00 +0200
Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Peter Zijlstra <peterz@infradead.org> - 2016-08-03 12:20 +0200
Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Brendan Gregg <bgregg@netflix.com> - 2016-08-03 21:00 +0200
Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Peter Zijlstra <peterz@infradead.org> - 2016-08-04 16:30 +0200
Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-08-05 03:50 +0200
Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Brendan Gregg <bgregg@netflix.com> - 2016-08-05 06:50 +0200
Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-08-05 07:30 +0200
Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Peter Zijlstra <peterz@infradead.org> - 2016-08-05 13:00 +0200
Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Brendan Gregg <bgregg@netflix.com> - 2016-08-05 19:30 +0200
Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Peter Zijlstra <peterz@infradead.org> - 2016-08-08 12:00 +0200
Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-08-05 21:50 +0200
Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling Peter Zijlstra <peterz@infradead.org> - 2016-08-08 12:10 +0200
csiph-web