From: Yonghong Song <yhs@fb.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: <ast@fb.com>, <daniel@iogearbox.net>, <netdev@vger.kernel.org>,
<kernel-team@fb.com>
Subject: Re: [PATCH bpf-next v2 1/7] perf/core: add perf_get_event() to return perf_event given a struct file
Date: Fri, 18 May 2018 09:32:09 -0700 [thread overview]
Message-ID: <cf3c38d5-f5b9-61ae-4b53-259c97dc84ab@fb.com> (raw)
In-Reply-To: <20180518071822.GC12217@hirez.programming.kicks-ass.net>
On 5/18/18 12:18 AM, Peter Zijlstra wrote:
> On Thu, May 17, 2018 at 10:32:53PM -0700, Yonghong Song wrote:
>> A new extern function, perf_get_event(), is added to return a perf event
>> given a struct file. This function will be used in later patches.
>
> Can't you do a narrower interface? Like return the prog. I'm not too
> keen on random !perf code frobbing around inside the event.
Hi, Peter,
My initial implementation (not upstreamed) actually have the whole
function bpf_get_perf_event_info() in the events/core.c. In that
case, the "struct file *" pointer is passed. This way, the event pointer
does not need to go to kernel/bpf/syscall.c or kernel/trace/bpf_trace.c.
I dropped this mechanism since it added more codes in the events/core.c
file, and I felt that such query code might clutter events/core.c.
The function bpf_get_perf_event_info() is now placed in
kernel/trace/bpf_trace.c.
Just getting bpf prog pointer is not enough as it does not provide
enough attachment information. Getting such information requires
poking into event/tp_event etc.
Currently we have this extern function exposed by events/core.c:
extern struct perf_event *perf_get_event(struct file *file);
We could make the result value "const" like
extern const struct perf_event *perf_get_event(struct file *file);
This will make it clear that we do not change "event" fields, and
merely poking at it.
Please let me know your preference.
Thanks!
Yonghong
prev parent reply other threads:[~2018-05-18 16:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-18 5:32 [PATCH bpf-next v2 1/7] perf/core: add perf_get_event() to return perf_event given a struct file Yonghong Song
2018-05-18 7:18 ` Peter Zijlstra
2018-05-18 16:32 ` Yonghong Song [this message]
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=cf3c38d5-f5b9-61ae-4b53-259c97dc84ab@fb.com \
--to=yhs@fb.com \
--cc=ast@fb.com \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
/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