From: "Alvarez, Pablo via 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 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?

However 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

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.
iovisor-dev mailing list

Reply via email to