[Bpf] Re: [EXTERNAL] RE: Re: Writing into a ring buffer map from user space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Dave and Andrii.

Per bpf: Add user-space-publisher ring buffer map type [LWN.net], the API that you mentioned
"provides single-user-space-producer / single-kernel-consumer semantics over a ring buffer."

But this is not the desired behavior for our case. We want both bpf programs in kernel mode and user application to be able to write to the same ring buffer, which can be consumed by a (potentially different) user application.

Assuming no such API exists, do you see any strong reason against writing such an API? If not, we would like to implement one in microsoft/ebpf-for-windows: eBPF implementation that runs on top of Windows (github.com) and eventually provide a Linux implementation as well.

Thanks,
Shankar

শংকর শীল

 


From: dthaler1968=40googlemail.com@xxxxxxxxxxxxxx <dthaler1968=40googlemail.com@xxxxxxxxxxxxxx>
Sent: Tuesday, May 28, 2024 10:42 AM
To: 'Andrii Nakryiko' <andrii.nakryiko@xxxxxxxxx>; Shankar Seal <Shankar.Seal@xxxxxxxxxxxxx>
Cc: bpf@xxxxxxxx <bpf@xxxxxxxx>; bpf@xxxxxxxxxxxxxxx <bpf@xxxxxxxxxxxxxxx>
Subject: [EXTERNAL] RE: [Bpf] Re: Writing into a ring buffer map from user space
 
[You don't often get email from dthaler1968=40googlemail.com@xxxxxxxxxxxxxx. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

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://nam06.safelinks.protection.outlook.com/?url=""> 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://nam06.safelinks.protection.outlook.com/?url="">
> user_ringbuf.c
>   [1]
>
https://nam06.safelinks.protection.outlook.com/?url="">
> 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://nam06.safelinks.protection.outlook.com/?url="">

Thanks,
Dave



-- 
Bpf mailing list -- bpf@xxxxxxxx
To unsubscribe send an email to bpf-leave@xxxxxxxx

[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux