Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1442385

Re: [PATCH net-next 1/3] perf, events: add non-linear data support for raw records

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH net-next 1/3] perf, events: add non-linear data support for raw records
Date 2016-07-13 14:20 +0200
Message-ID <rUriW-2WY-17@gated-at.bofh.it> (permalink)
References <rUevn-2IR-7@gated-at.bofh.it> <rUevo-2IR-41@gated-at.bofh.it> <rUnfk-8tL-35@gated-at.bofh.it> <rUoEp-13x-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jul 13, 2016 at 11:24:13AM +0200, Daniel Borkmann wrote:
> Hi Peter,
> 
> On 07/13/2016 09:52 AM, Peter Zijlstra wrote:
> >On Wed, Jul 13, 2016 at 12:36:17AM +0200, Daniel Borkmann wrote:
> >>This patch adds support for non-linear data on raw records. It means
> >>that for such data, the newly introduced __output_custom() helper will
> >>be used instead of __output_copy(). __output_custom() will invoke
> >>whatever custom callback is passed in via struct perf_raw_record_frag
> >>to extract the data into the ring buffer slot.
> >>
> >>To keep changes in perf_prepare_sample() and in perf_output_sample()
> >>minimal, size/size_head split was added to perf_raw_record that call
> >>sites fill out, so that two extra tests in fast-path can be avoided.
> >>
> >>The few users of raw records are adapted to initialize their size_head
> >>and frag data; no change in behavior for them. Later patch will extend
> >>BPF side with a first user and callback for this facility, future users
> >>could be things like XDP BPF programs (that work on different context
> >>though and would thus have a different callback), etc.
> >
> >Why? What problem are we solving?
> 
> I've tried to summarize it in patch 3/3,

Which is pretty useless if you're staring at this patch.

> This currently has 3 issues we'd like to resolve:

> i) We need two copies instead of just a single one for the skb data.
> The data can be non-linear, see also skb_copy_bits() as an example for
> walking/extracting it,

I'm not familiar enough with the network gunk to be able to read that.
But upto skb_walk_frags() it looks entirely linear to me.

> ii) for static verification reasons, the bpf_skb_load_bytes() helper
> needs to see a constant size on the passed buffer to make sure BPF
> verifier can do its sanity checks on it during verification time, so
> just passing in skb->len (or any other non-constant value) wouldn't
> work, but changing bpf_skb_load_bytes() is also not the real solution
> since we still have two copies we'd like to avoid as well, and

> iii) bpf_skb_load_bytes() is just for rather smaller buffers (e.g.
> headers) since they need to sit on the limited eBPF stack anyway. The
> set would improve the BPF helper to address all 3 at once.

Humm, maybe. Lemme go try and reverse engineer that patch, because I'm
not at all sure wth it's supposed to do, nor am I entirely sure this
clarified things :/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 0/3] BPF event output helper improvements Daniel Borkmann <daniel@iogearbox.net> - 2016-07-13 00:40 +0200
  [PATCH net-next 3/3] bpf: avoid stack copy and use skb ctx for event output Daniel Borkmann <daniel@iogearbox.net> - 2016-07-13 00:40 +0200
  [PATCH net-next 1/3] perf, events: add non-linear data support for raw records Daniel Borkmann <daniel@iogearbox.net> - 2016-07-13 00:40 +0200
    Re: [PATCH net-next 1/3] perf, events: add non-linear data support  for raw records Peter Zijlstra <peterz@infradead.org> - 2016-07-13 10:00 +0200
      Re: [PATCH net-next 1/3] perf, events: add non-linear data support  for raw records Daniel Borkmann <daniel@iogearbox.net> - 2016-07-13 11:30 +0200
        Re: [PATCH net-next 1/3] perf, events: add non-linear data support  for raw records Peter Zijlstra <peterz@infradead.org> - 2016-07-13 14:20 +0200
          Re: [PATCH net-next 1/3] perf, events: add non-linear data support  for raw records Daniel Borkmann <daniel@iogearbox.net> - 2016-07-13 15:20 +0200
    Re: [PATCH net-next 1/3] perf, events: add non-linear data support  for raw records Peter Zijlstra <peterz@infradead.org> - 2016-07-13 15:50 +0200
      Re: [PATCH net-next 1/3] perf, events: add non-linear data support  for raw records Daniel Borkmann <daniel@iogearbox.net> - 2016-07-13 16:10 +0200
        Re: [PATCH net-next 1/3] perf, events: add non-linear data support  for raw records Peter Zijlstra <peterz@infradead.org> - 2016-07-13 18:50 +0200
          Re: [PATCH net-next 1/3] perf, events: add non-linear data support  for raw records Daniel Borkmann <daniel@iogearbox.net> - 2016-07-13 19:00 +0200
  [PATCH net-next 2/3] bpf, perf: split bpf_perf_event_output Daniel Borkmann <daniel@iogearbox.net> - 2016-07-13 00:40 +0200

csiph-web