Io uring and xdp enter 2024: Difference between revisions

 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
'''[[Dankblog|dankblog!]] 2024-02-15, 1452 EST, at [[Viewpoint|the danktower]]'''
'''[[Dankblog|dankblog!]] 2024-02-15, 1452 EST, at [[Viewpoint|the danktower]]'''


Last year (2023), I spent significant time writing code using [[XDP]] and [[io_uring]]. The latter was delightful, the former less so. My summary of io_uring through liburing 2.3 hit #1 on HackerNews (twice!) and the great [https://lwn.net/Articles/932568/ LWN], which pleased me--it's nice to know people are reading this. Work on these technologies has progressed, and it seems time for an update.
Last year (2023), I spent significant time writing code using [[XDP]] and [[io_uring]]. The latter was delightful, the former less so. Work on these technologies has progressed, and it seems time for an update.


==XDP==
==XDP==
Line 17: Line 17:
Also new is <tt>IORING_OP_WAITID</tt> for working with process state changes (though I would recommend use of [[pidfd|pidfds]] for this kind of thing in new code).
Also new is <tt>IORING_OP_WAITID</tt> for working with process state changes (though I would recommend use of [[pidfd|pidfds]] for this kind of thing in new code).


[https://git.kernel.dk/cgit/linux/commit/?h=io_uring-send-queue&id=060845d3788f20b427631b64a6dbdbd249a0309b Kernel 6.8] introduces <tt>IORING_SEND_MULTISHOT</tt>, bringing the multishot pattern to the TX (<tt>send</tt> and <tt>sendmsg</tt>) side.
[https://git.kernel.dk/cgit/linux/commit/?h=io_uring-send-queue&id=060845d3788f20b427631b64a6dbdbd249a0309b Kernel 6.8] introduces <tt>IORING_SEND_MULTISHOT</tt>, bringing the multishot pattern to the TX (<tt>send</tt> and <tt>sendmsg</tt>) side. See Axboe's "[https://lore.kernel.org/io-uring/20240308235045.1014125-1-axboe@kernel.dk/ Send and receive bundles]" post for further optimization using "bundles" (these require registered buffers).


<tt>IORING_SETUP_REGISTERED_FD_ONLY</tt> registers the ring fd for use with <tt>IORING_REGISTER_USE_REGISTERED_RING</tt>.
<tt>IORING_SETUP_REGISTERED_FD_ONLY</tt> registers the ring fd for use with <tt>IORING_REGISTER_USE_REGISTERED_RING</tt>.