From: Peter Zijlstra <peterz@infradead.org>
To: Alexei Starovoitov <ast@fb.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Brendan Gregg <bgregg@netflix.com>,
Daniel Borkmann <daniel@iogearbox.net>, Teng Qin <qinteng@fb.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-team@fb.com
Subject: Re: [PATCH v3 net-next 1/3] perf, bpf: Add BPF support to all perf_event types
Date: Fri, 2 Jun 2017 10:06:05 +0200 [thread overview]
Message-ID: <20170602080605.h42o7i27vmjrhz25@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20170602020336.1062853-2-ast@fb.com>
On Thu, Jun 01, 2017 at 07:03:34PM -0700, Alexei Starovoitov wrote:
> diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c
> index 172dc8ee0e3b..ab93490d1a00 100644
> --- a/kernel/bpf/arraymap.c
> +++ b/kernel/bpf/arraymap.c
> @@ -452,39 +452,18 @@ static void bpf_event_entry_free_rcu(struct bpf_event_entry *ee)
> static void *perf_event_fd_array_get_ptr(struct bpf_map *map,
> struct file *map_file, int fd)
> {
> - const struct perf_event_attr *attr;
> struct bpf_event_entry *ee;
> - struct perf_event *event;
> struct file *perf_file;
>
> perf_file = perf_event_get(fd);
> if (IS_ERR(perf_file))
> return perf_file;
>
> - event = perf_file->private_data;
> - ee = ERR_PTR(-EINVAL);
> -
> - attr = perf_event_attrs(event);
> - if (IS_ERR(attr) || attr->inherit)
> - goto err_out;
> -
> - switch (attr->type) {
> - case PERF_TYPE_SOFTWARE:
> - if (attr->config != PERF_COUNT_SW_BPF_OUTPUT)
> - goto err_out;
> - /* fall-through */
> - case PERF_TYPE_RAW:
> - case PERF_TYPE_HARDWARE:
> - ee = bpf_event_entry_gen(perf_file, map_file);
> - if (ee)
> - return ee;
> - ee = ERR_PTR(-ENOMEM);
> - /* fall-through */
> - default:
> - break;
> - }
Would it make sense to call perf_event_read_local() on the events here
in order to weed out the -EOPNOTSUPP ones?
> + ee = bpf_event_entry_gen(perf_file, map_file);
> + if (ee)
> + return ee;
>
> -err_out:
> + ee = ERR_PTR(-ENOMEM);
> fput(perf_file);
> return ee;
> }
next prev parent reply other threads:[~2017-06-02 8:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-02 2:03 [PATCH v3 net-next 0/3] bpf: Add BPF support to all perf_event Alexei Starovoitov
2017-06-02 2:03 ` [PATCH v3 net-next 1/3] perf, bpf: Add BPF support to all perf_event types Alexei Starovoitov
2017-06-02 8:06 ` Peter Zijlstra [this message]
2017-06-02 14:33 ` Alexei Starovoitov
2017-06-02 2:03 ` [PATCH v3 net-next 2/3] samples/bpf: add tests for more perf event types Alexei Starovoitov
2017-06-02 2:03 ` [PATCH v3 net-next 3/3] bpf: update perf event helper functions documentation Alexei Starovoitov
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=20170602080605.h42o7i27vmjrhz25@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ast@fb.com \
--cc=bgregg@netflix.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=qinteng@fb.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
all inboxes | Powered by JetHome®