From: Jiri Olsa <jolsa@redhat.com>
To: Daniel Xu <dxu@dxuuu.xyz>
Cc: bpf@vger.kernel.org, songliubraving@fb.com, yhs@fb.com,
andriin@fb.com, peterz@infradead.org, mingo@redhat.com,
acme@kernel.org, ast@fb.com, alexander.shishkin@linux.intel.com,
namhyung@kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH bpf-next 1/5] perf/core: Add PERF_FORMAT_LOST read_format
Date: Tue, 24 Sep 2019 10:33:42 +0200 [thread overview]
Message-ID: <20190924083342.GA21640@krava> (raw)
In-Reply-To: <20190917133056.5545-2-dxu@dxuuu.xyz>
On Tue, Sep 17, 2019 at 06:30:52AM -0700, Daniel Xu wrote:
SNIP
> + PERF_FORMAT_MAX = 1U << 5, /* non-ABI */
> };
>
> #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 0463c1151bae..ee08d3ed6299 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -1715,6 +1715,9 @@ static void __perf_event_read_size(struct perf_event *event, int nr_siblings)
> if (event->attr.read_format & PERF_FORMAT_ID)
> entry += sizeof(u64);
>
> + if (event->attr.read_format & PERF_FORMAT_LOST)
> + entry += sizeof(u64);
> +
> if (event->attr.read_format & PERF_FORMAT_GROUP) {
> nr += nr_siblings;
> size += sizeof(u64);
> @@ -4734,6 +4737,24 @@ u64 perf_event_read_value(struct perf_event *event, u64 *enabled, u64 *running)
> }
> EXPORT_SYMBOL_GPL(perf_event_read_value);
>
> +static struct pmu perf_kprobe;
> +static u64 perf_event_lost(struct perf_event *event)
> +{
> + struct ring_buffer *rb;
> + u64 lost = 0;
> +
> + rcu_read_lock();
> + rb = rcu_dereference(event->rb);
> + if (likely(!!rb))
> + lost += local_read(&rb->lost);
> + rcu_read_unlock();
> +
> + if (event->attr.type == perf_kprobe.type)
> + lost += perf_kprobe_missed(event);
not sure what was the peterz's suggestion, but here you are mixing
ring buffer's lost count with kprobes missed count, seems wrong
maybe we could add PERF_FORMAT_KPROBE_MISSED
jirka
next prev parent reply other threads:[~2019-09-24 8:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 13:30 [PATCH bpf-next 0/5] Add PERF_FORMAT_LOST read_format Daniel Xu
2019-09-17 13:30 ` [PATCH bpf-next 1/5] perf/core: " Daniel Xu
2019-09-17 14:32 ` kbuild test robot
2019-09-17 15:22 ` kbuild test robot
2019-09-24 8:33 ` Jiri Olsa [this message]
2019-09-27 21:28 ` Daniel Xu
2019-10-25 18:19 ` Daniel Xu
2019-10-28 9:12 ` Peter Zijlstra
2023-03-08 12:20 ` Lorenz Bauer
2019-09-17 13:30 ` [PATCH bpf-next 2/5] perf/core: Sync perf_event.h to tools Daniel Xu
2019-09-17 13:30 ` [PATCH bpf-next 3/5] libbpf: Add helpers to extract perf fd from bpf_link Daniel Xu
2019-09-17 13:30 ` [PATCH bpf-next 4/5] libbpf: Set read_format PERF_FORMAT_LOST on kprobe perf fds Daniel Xu
2019-09-17 13:30 ` [PATCH bpf-next 5/5] libbpf: Add selftest for PERF_FORMAT_LOST perf read_format Daniel Xu
2019-09-17 15:14 [PATCH bpf-next 1/5] perf/core: Add PERF_FORMAT_LOST read_format Daniel Xu
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=20190924083342.GA21640@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=andriin@fb.com \
--cc=ast@fb.com \
--cc=bpf@vger.kernel.org \
--cc=dxu@dxuuu.xyz \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@fb.com \
--cc=yhs@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;
as well as URLs for NNTP newsgroup(s).