Internships/IOUringEventLoop: Difference between revisions

From QEMU
(Created page with "=== io_uring event loop === '''Summary:''' Add a new Linux io_uring event loop that supports userspace polling. QEMU has an event-driven architecture where an event loop m...")
 
(No difference)

Latest revision as of 14:23, 26 January 2020

io_uring event loop

Summary: Add a new Linux io_uring event loop that supports userspace polling.

QEMU has an event-driven architecture where an event loop monitors file descriptors for activity. The event loop waits until a file descriptor becomes ready (e.g. because data has arrived on a socket or a timer has expired). This is currently implemented with epoll(7)/ppoll(2). The goal of the project is to add a Linux io_uring event loop as an alternative.

Linux io_uring is a new asynchronous I/O system call interface that allows userspace applications to perform file reads/writes, timer, socket, and other operations. The IORING_OP_POLL_ADD and IORING_OP_TIMEOUT operations can be used to reimplement QEMU's event loop using io_uring. The advantage of io_uring is that QEMU can peek at the "completion queue" to avoid making system calls and descheduling (this technique is called busy waiting or "polling", but be careful not to confuse it with the poll(2) family of system calls or the IORING_OP_POLL_ADD operation).

The new io_uring event loop will allow QEMU's userspace polling to work even with socket file descriptors. This will finally allow QEMU's main loop thread to enable userspace polling. In addition, overall event loop performance will be different and hopefully faster than QEMU's epoll(7)/ppoll(7) implementation.

This project will expose you to event-driven architecture and how event loops are implemented. The event loop is a core component of QEMU whose correctness and performance is critical. Everything in QEMU depends on it to some extent and therefore this project will require understanding and carefully extending the current code - a challenging but also rewarding task.

Links:

Details:

  • Skill level: advanced
  • Language: C
  • Mentor: Stefan Hajnoczi <stefanha@gmail.com> ("stefanha" on IRC)