From: Alexei Starovoitov <ast@fb.com>
To: Peter Zijlstra <peterz@infradead.org>, Song Liu <songliubraving@fb.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"acme@kernel.org" <acme@kernel.org>,
"ast@kernel.org" <ast@kernel.org>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH v5 perf, bpf-next 3/7] perf, bpf: introduce PERF_RECORD_BPF_EVENT
Date: Tue, 8 Jan 2019 20:56:54 +0000 [thread overview]
Message-ID: <10039e93-a0a5-a712-4051-20f5c5d79fab@fb.com> (raw)
In-Reply-To: <20190108184116.GC30894@hirez.programming.kicks-ass.net>
On 1/8/19 10:41 AM, Peter Zijlstra wrote:
> On Thu, Dec 20, 2018 at 10:29:00AM -0800, Song Liu wrote:
>> @@ -986,9 +987,35 @@ enum perf_event_type {
>> */
>> PERF_RECORD_KSYMBOL = 17,
>>
>> + /*
>> + * Record bpf events:
>> + * enum perf_bpf_event_type {
>> + * PERF_BPF_EVENT_UNKNOWN = 0,
>> + * PERF_BPF_EVENT_PROG_LOAD = 1,
>> + * PERF_BPF_EVENT_PROG_UNLOAD = 2,
>> + * };
>> + *
>> + * struct {
>> + * struct perf_event_header header;
>> + * u16 type;
>> + * u16 flags;
>> + * u32 id;
>> + * u8 tag[BPF_TAG_SIZE];
>> + * struct sample_id sample_id;
>> + * };
>> + */
>> + PERF_RECORD_BPF_EVENT = 18,
>> +
>
> Elsewhere today, I raised the point that by the time (however short
> interval) userspace gets around to reading this event, the actual
> program could be gone again.
>
> In this case the program has been with us for a very short period
> indeed; but it could still have generated some samples or otherwise
> generated trace data.
>
> It was suggested to allow pinning modules/programs to avoid this
> situation, but that of course has other undesirable effects, such as a
> trivial DoS.
>
> A truly horrible hack would be to include an open filedesc in the event
> that needs closing to release the resource, but I'm sorry for even
> suggesting that **shudder**.
>
> Do we have any sane ideas?
I think we should miss such ultra short lived progs.
If perf record is slower than some user doing for(;;) {load prog;
unload;} than it's a good thing.
I frankly don't think it's practically possible to miss a prog.
perf ring buffer is way faster than prog load/unload.
Even when all scheduling artifacts of perf user space are factored in.
Doing barriers is DoS-able.
Sending FD via ring buffer is not possible.
If there was a non-shudder solution to this we could do it,
but all complications pointing out that this is not a problem
worth solving.
At least since right now none of us see a clean fix I propose
to move ahead with what we have and address it later if better ideas
come up. We've been missing short lived progs and prog notifications
all this time and users complain. That is the problem to address.
next prev parent reply other threads:[~2019-01-08 20:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-20 18:28 [PATCH v5 perf, bpf-next 0/7] reveal invisible bpf programs Song Liu
2018-12-20 18:28 ` [PATCH v5 perf, bpf-next 1/7] perf, bpf: Introduce PERF_RECORD_KSYMBOL Song Liu
2019-01-08 18:31 ` Peter Zijlstra
2019-01-08 18:56 ` Song Liu
2019-01-08 19:43 ` Peter Zijlstra
2018-12-20 18:28 ` [PATCH v5 perf, bpf-next 2/7] sync tools/include/uapi/linux/perf_event.h Song Liu
2018-12-20 18:29 ` [PATCH v5 perf, bpf-next 3/7] perf, bpf: introduce PERF_RECORD_BPF_EVENT Song Liu
2019-01-08 18:41 ` Peter Zijlstra
2019-01-08 19:10 ` Song Liu
2019-01-08 19:43 ` Peter Zijlstra
2019-01-08 23:54 ` Song Liu
2019-01-09 10:18 ` Peter Zijlstra
2019-01-09 11:32 ` Song Liu
2019-01-09 12:59 ` Peter Zijlstra
2019-01-09 16:04 ` Song Liu
2019-01-08 20:16 ` Arnaldo Carvalho de Melo
2019-01-08 23:37 ` Song Liu
2019-01-08 20:56 ` Alexei Starovoitov [this message]
2019-01-08 19:59 ` Peter Zijlstra
2019-01-08 20:29 ` Peter Zijlstra
2019-01-08 20:45 ` Alexei Starovoitov
2019-01-09 12:41 ` Peter Zijlstra
2019-01-09 15:51 ` Song Liu
2018-12-20 18:29 ` [PATCH v5 perf, bpf-next 4/7] sync tools/include/uapi/linux/perf_event.h Song Liu
2018-12-20 18:29 ` [PATCH v5 perf, bpf-next 5/7] perf util: handle PERF_RECORD_KSYMBOL Song Liu
2018-12-20 18:29 ` [PATCH v5 perf, bpf-next 6/7] perf util: handle PERF_RECORD_BPF_EVENT Song Liu
2018-12-20 18:29 ` [PATCH v5 perf, bpf-next 7/7] perf tools: synthesize PERF_RECORD_* for loaded BPF programs Song Liu
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=10039e93-a0a5-a712-4051-20f5c5d79fab@fb.com \
--to=ast@fb.com \
--cc=Kernel-team@fb.com \
--cc=acme@kernel.org \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=songliubraving@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®