From: Peter Zijlstra <peterz@infradead.org>
To: Brendan Gregg <bgregg@netflix.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
linux-kernel@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Wang Nan <wangnan0@huawei.com>
Subject: Re: [PATCH v2 1/3] perf/core: Add a tracepoint for perf sampling
Date: Mon, 8 Aug 2016 11:57:14 +0200 [thread overview]
Message-ID: <20160808095714.GY6879@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <CAJN39ogefQc3i4qRuQg4HmMhqn-Ah1aHYTQ1=-fr0WSBhXiShw@mail.gmail.com>
On Fri, Aug 05, 2016 at 10:22:08AM -0700, Brendan Gregg wrote:
> (Normally I'd use I$ miss overflow, but none of our Linux systems have
> PMCs: cloud.)
I think I had better not comment on that ;-)
> >> > 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?
>
> I was pulling in regs after get_irq_regs(), struct perf_event *event
> after it's populated. Not that hard to duplicate. Just noting it
> didn't map directly to the function entry.
Right, both of which are available to the overflow handler.
> I wanted perf_event just for event->ctx->task->pid, so that a BPF
> program can differentiate between it's samples and other concurrent
> sessions.
>
> (I was thinking of changing my patch to expose pid_t instead of
> perf_event, since I was noticing it didn't add many instructions.)
Slightly confused, event->ctx->task == current, no? We flip that pointer
when we flip the contexts.
At which point, it should be the same as SAMPLE_TID.
!?
> [...]
> >> 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.
>
> Although the timer use case is a bit different, and is via
> hwc->hrtimer.function = perf_swevent_hrtimer.
Still not entirely sure why you could not hook into
event->overflow_handler.
next prev parent reply other threads:[~2016-08-08 9:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-03 2:47 [PATCH v2 0/3] Add a tracepoint for BPF " Brendan Gregg
2016-08-03 2:47 ` [PATCH v2 1/3] perf/core: Add a tracepoint for " Brendan Gregg
2016-08-03 9:48 ` Peter Zijlstra
2016-08-03 18:57 ` Brendan Gregg
2016-08-04 14:28 ` Peter Zijlstra
2016-08-05 1:43 ` Alexei Starovoitov
2016-08-05 4:13 ` Brendan Gregg
2016-08-05 5:24 ` Alexei Starovoitov
2016-08-05 10:52 ` Peter Zijlstra
2016-08-05 17:22 ` Brendan Gregg
2016-08-08 9:57 ` Peter Zijlstra [this message]
2016-08-05 19:45 ` Alexei Starovoitov
2016-08-08 10:03 ` Peter Zijlstra
2016-08-03 2:47 ` [PATCH v2 2/3] samples/bpf: Add a sampling BPF example Brendan Gregg
2016-08-03 2:47 ` [PATCH v2 3/3] perf script: add bpf-output field to usage message Brendan Gregg
2016-08-09 19:16 ` [tip:perf/urgent] perf script: Add 'bpf-output' " tip-bot for Brendan Gregg
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=20160808095714.GY6879@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=bgregg@netflix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.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
Powered by JetHome