Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Andrii Nakryiko
On Thu, May 14, 2020 at 3:56 PM Alexei Starovoitov wrote: > > On Thu, May 14, 2020 at 02:30:11PM -0700, Andrii Nakryiko wrote: > > On Thu, May 14, 2020 at 1:39 PM Thomas Gleixner wrote: > > > > > > Jakub Kicinski writes: > > > > > > > On Wed, 13 May 2020 12:25:27 -0700 Andrii Nakryiko wrote: > >

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Alexei Starovoitov
On Thu, May 14, 2020 at 02:30:11PM -0700, Andrii Nakryiko wrote: > On Thu, May 14, 2020 at 1:39 PM Thomas Gleixner wrote: > > > > Jakub Kicinski writes: > > > > > On Wed, 13 May 2020 12:25:27 -0700 Andrii Nakryiko wrote: > > >> One interesting implementation bit, that significantly simplifies (an

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Alan Maguire
On Wed, 13 May 2020, Andrii Nakryiko wrote: > On Wed, May 13, 2020 at 2:59 PM Alan Maguire wrote: > > > > > > - attach a kprobe program to record the data via bpf_ringbuf_reserve(), > > and store the reserved pointer value in a per-task keyed hashmap. > > Then record the values of interest in

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Paul E. McKenney
On Thu, May 14, 2020 at 02:30:11PM -0700, Andrii Nakryiko wrote: > On Thu, May 14, 2020 at 1:39 PM Thomas Gleixner wrote: > > > > Jakub Kicinski writes: > > > > > On Wed, 13 May 2020 12:25:27 -0700 Andrii Nakryiko wrote: > > >> One interesting implementation bit, that significantly simplifies (an

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Andrii Nakryiko
On Thu, May 14, 2020 at 1:39 PM Thomas Gleixner wrote: > > Jakub Kicinski writes: > > > On Wed, 13 May 2020 12:25:27 -0700 Andrii Nakryiko wrote: > >> One interesting implementation bit, that significantly simplifies (and thus > >> speeds up as well) implementation of both producers and consumers

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Andrii Nakryiko
On Thu, May 14, 2020 at 1:53 PM wrote: > > On 05/14, Andrii Nakryiko wrote: > > On Thu, May 14, 2020 at 10:33 AM wrote: > > > > > > On 05/13, Andrii Nakryiko wrote: > > [...] > > > > > + * void bpf_ringbuf_submit(void *data) > > > > + * Description > > > > + * Submit reserved ring buf

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Jonathan Lemon
On Wed, May 13, 2020 at 12:25:27PM -0700, Andrii Nakryiko wrote: > +static struct bpf_ringbuf *bpf_ringbuf_restore_from_rec(void *meta_ptr) > +{ > + unsigned long addr = (unsigned long)meta_ptr; > + unsigned long off = *(u32 *)(meta_ptr + 4) << PAGE_SHIFT; > + > + return (void*)((addr &

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Andrii Nakryiko
On Thu, May 14, 2020 at 12:06 PM Alexei Starovoitov wrote: > > On Wed, May 13, 2020 at 12:25:27PM -0700, Andrii Nakryiko wrote: > > + > > +/* Given pointer to ring buffer record metadata, restore pointer to struct > > + * bpf_ringbuf itself by using page offset stored at offset 4 > > + */ > > +sta

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Thomas Gleixner
Jakub Kicinski writes: > On Wed, 13 May 2020 12:25:27 -0700 Andrii Nakryiko wrote: >> One interesting implementation bit, that significantly simplifies (and thus >> speeds up as well) implementation of both producers and consumers is how data >> area is mapped twice contiguously back-to-back in t

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Andrii Nakryiko
On Thu, May 14, 2020 at 10:33 AM wrote: > > On 05/13, Andrii Nakryiko wrote: > > This commits adds a new MPSC ring buffer implementation into BPF > > ecosystem, > > which allows multiple CPUs to submit data to a single shared ring buffer. > > On > > the consumption side, only single consumer is as

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Andrii Nakryiko
On Thu, May 14, 2020 at 9:50 AM Jonathan Lemon wrote: > > On Wed, May 13, 2020 at 12:25:27PM -0700, Andrii Nakryiko wrote: > > +static struct bpf_ringbuf *bpf_ringbuf_restore_from_rec(void *meta_ptr) > > +{ > > + unsigned long addr = (unsigned long)meta_ptr; > > + unsigned long off = *(u32

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Jakub Kicinski
On Wed, 13 May 2020 12:25:27 -0700 Andrii Nakryiko wrote: > One interesting implementation bit, that significantly simplifies (and thus > speeds up as well) implementation of both producers and consumers is how data > area is mapped twice contiguously back-to-back in the virtual memory. This > allo

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-14 Thread Alexei Starovoitov
On Wed, May 13, 2020 at 12:25:27PM -0700, Andrii Nakryiko wrote: > + > +/* Given pointer to ring buffer record metadata, restore pointer to struct > + * bpf_ringbuf itself by using page offset stored at offset 4 > + */ > +static struct bpf_ringbuf *bpf_ringbuf_restore_from_rec(void *meta_ptr) > +{

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-13 Thread Andrii Nakryiko
On Wed, May 13, 2020 at 2:59 PM Alan Maguire wrote: > > On Wed, 13 May 2020, Andrii Nakryiko wrote: > > > This commits adds a new MPSC ring buffer implementation into BPF ecosystem, > > which allows multiple CPUs to submit data to a single shared ring buffer. On > > the consumption side, only sing

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-13 Thread kbuild test robot
Hi Andrii, I love your patch! Perhaps something to improve: [auto build test WARNING on bpf-next/master] [also build test WARNING on next-20200512] [cannot apply to bpf/master rcu/dev v5.7-rc5] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW,

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-13 Thread Alan Maguire
On Wed, 13 May 2020, Andrii Nakryiko wrote: > This commits adds a new MPSC ring buffer implementation into BPF ecosystem, > which allows multiple CPUs to submit data to a single shared ring buffer. On > the consumption side, only single consumer is assumed. > > Motivation > -- > There are

Re: [PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-13 Thread kbuild test robot
Hi Andrii, I love your patch! Yet something to improve: [auto build test ERROR on bpf-next/master] [also build test ERROR on next-20200512] [cannot apply to bpf/master rcu/dev v5.7-rc5] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also

[PATCH bpf-next 1/6] bpf: implement BPF ring buffer and verifier support for it

2020-05-13 Thread Andrii Nakryiko
This commits adds a new MPSC ring buffer implementation into BPF ecosystem, which allows multiple CPUs to submit data to a single shared ring buffer. On the consumption side, only single consumer is assumed. Motivation -- There are two distinctive motivators for this work, which are not sa