BPF Timers Support Set To Finally Appear With Linux 5.15

Written by Michael Larabel in Linux Kernel on 23 July 2021 at 05:25 AM EDT. 4 Comments
LINUX KERNEL
The latest BPF functionality set to appear with Linux 5.15 this autumn is timers support.

BPF timers support has been worked on for the better part of the past decade and this week finally reached the milestone of being queued into net-next ahead of the Linux 5.15 merge window opening up around the start of September.

BPF timers has been pursued for opening up new (e)BPF use-cases. As summed up nicely by the pull into net-next:
The first request to support timers in bpf was made in 2013 before sys_bpf syscall was added. That use case was periodic sampling. It was address with attaching bpf programs to perf_events. Then during XDP development the timers were requested to do garbage collection and health checks. They were worked around by implementing timers in user space and triggering progs with BPF_PROG_RUN command. The user space timers and perf_event+bpf timers are not armed by the bpf program. They're done asynchronously vs program execution. The XDP program cannot send a packet and arm the timer at the same time. The tracing prog cannot record an event and arm the timer right away. This large class of use cases remained unaddressed. The jiffy based and hrtimer based timers are essential part of the kernel development and with this patch set the hrtimer based timers will be available to bpf programs.

TLDR: bpf timers is a wrapper of hrtimers with all the extra safety added to make sure bpf progs cannot crash the kernel.

After seven rounds of revising the BPF timers patches, this functionality appears to be ready for mainline.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week