High-Level Interface with C++20 Coroutines for Asynchronous I/O using io_uring and eBPF

High-Level Interface with C++20 Coroutines for Asynchronous I/O using io_uring and eBPF

In today's operating systems, mode switches between user- and kernel mode due to system calls account for non-negligible run-time overheads [4, 9]. Combined with expensive mitigations against Meltdown and Spectre, system calls can be slowed down by a factor of five [3, 5, 7]. For reducing overheads, multi-system-call interfaces allow to batch successive system calls and submit them with a single mode switch to the kernel [6].

Previous work [8] shows that io_uring [1] can be used as an asynchronous multi-system-call interface in Linux for common userland applications. To reduce mode switches further, io_uring can be combined with eBPF [2] to execute system-call dependent logic inside the kernel. The implementation of both approaches requires us to port existing programs to new programming models, which is a time-consuming effort [10].

To ease the usage of multi-system-calls (e.g., user-level machine code and in-kernel eBPF), this research project will work on a high-level programming interface to abstract from the current event-based programming model that io_uring already provides for eBPF programs. Based on C++20 co-routines, which offer an easy way to express asynchronous event-dependencies as seemingly synchronous code, this research project will provide the means to push parts of waiting functions into the kernelspace. Within Clang/LLVM's existing co-routines support, this thesis will provide an alternative lowering path that extracts code sections between co-routine--suspension points as eBPF functions. Futhermore, the student will propose an interface for choosing betwen execution modes and compare the results against non-io_uring/eBPF and manually-written io_uring/eBPF programs.