Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> wrote: > On Tue, May 28, 2024 at 9:32 AM Shankar Seal > <Shankar.Seal=40microsoft.com@xxxxxxxxxxxxxx> wrote: > > > > Adding bpf@xxxxxxxxxxxxxxx > > > > A common use case of an BPF ring buffer map to use as a queue of > > events generated by BPF programs that can be read in-order by user > > space applications. I have a scenario requirement for a user space > > application to write into a ring buffer (or similar) map, such that > > events by BPF programs in kernel and user space applications are > > interleaved in the order they were generated, that can be consumed by > > another user space application > > > > I would like to implement this new feature in the > https://github.com/microsoft/ebpf-for-windows project. But before I go ahead with > the implementation, I wanted to check if there is any way to accomplish this in > Linux today? If not, is there any reason why this should not be done? > > Yes, there is. See user_ring_buffer ([0], [1]). > > [0] > https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/prog_tests/ > user_ringbuf.c > [1] > https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/progs/user_ > ringbuf_success.c Both of those links go to GPL code so I suspect Shankar cannot use those links. I think the answer is that BPF_MAP_TYPE_USER_RINGBUF is defined for this purpose and Shankar can read https://lwn.net/Articles/907056/ Thanks, Dave