Date
1 - 4 of 4
Detecting modification of a bpf map from userspace
Pablo Alvarez
Dear devs,
Is there a way to poll() or select() or otherwise not-busy-wait on a bpf map in userspace? I would like to react quickly to new data coming into the map from my bpf program withoug consuming too many resources. I ran an experiment using the map fd and poll(), and found that the revents field always returned with POLLIN set, whether there was new data in the map or not. This makes a certain sense, since one never calls read() on the map to clear the field, but is not particularly useful. The question applies both to - a tc cls map added with "tc filter add dev eth0 egress bpf da obj clsact_get_packet.o sec getpacket" - a map accessed from a bpf program inserted into a TCP socket (with load_bpf_file() and setsockopt(sockfd, SOL_SOCKET, SO_ATTACH_BPF, prog_fd, sizeof(prog_fd[0])). If not, is there another way to get a bpf program to signal up to userspace that something has happened? Thanks Pablo Alvarez |
|
Fulvio Risso
Pablo,
toggle quoted message
Show quoted text
this looks very similar to Francesco's request here: https://lists.iovisor.org/pipermail/iovisor-dev/2018-February/001225.html FYI, Francesco and Sebastiano are currently working on a patch to enable this feature. You can get in touch directly with them. fulvio On 21/02/2018 17:49, Alvarez, Pablo via iovisor-dev wrote:
Dear devs, |
|
Pablo Alvarez
Thanks. I will follow up with Francesco and Sebastiano.
toggle quoted message
Show quoted text
Pablo On 2/22/18 1:58 AM, Fulvio Risso wrote:
Pablo, |
|
David S. Miller
From: "Alvarez, Pablo via iovisor-dev" <iovisor-dev@...>
Date: Wed, 21 Feb 2018 11:49:47 -0500 Is there a way to poll() or select() or otherwise not-busy-wait on aHowever we deal with this, we have to carefully take into consideration that polling may be the only option when the BPF map is offloaded to hardware. I don't want to see programs written with the built-in assumption that poll() or select() or whatever notification mechanism we choose will be available always for BPF maps. |
|