Ringing in a new asynchronous I/O API
Ringing in a new asynchronous I/O API
Posted Jan 17, 2019 3:12 UTC (Thu) by samroberts (subscriber, #46749)In reply to: Ringing in a new asynchronous I/O API by axboe
Parent article: Ringing in a new asynchronous I/O API
The point stands: io_uring should be easily useable with poll/select/epoll so it can be integrated with existing event loop based code, networking code in particular are heavy users of these calls. Specifically, this fd
> The return value from io_uring_setup() is a file descriptor that can then be passed to mmap() to map the buffer into the process's address space.
should be epoll()able.
Posted Jan 17, 2019 3:28 UTC (Thu)
by axboe (subscriber, #904)
[Link] (9 responses)
If the ring_fd should be pollable, in terms of epoll, absolutely. That would be trivial to add. It would NOT work for IORING_SETUP_IOPOLL for obvious reasons, as you can't sleep for those kinds of completions. But for "normal", IRQ driven IO, adding epoll() support for the CQ side of the ring_fd is straight forward. On the SQ ring side, there's nothing to epoll for. The application knows if the ring is writeable (eg can hold new entries) without entering the kernel.
Outside of that, my IOCB_CMD_POLL reference has to do with this:
https://lwn.net/Articles/743714/
and adding IORING_OP_POLL for similar functionality on the io_uring side.
Posted Jan 17, 2019 16:26 UTC (Thu)
by axboe (subscriber, #904)
[Link] (8 responses)
I believe this caters to both of your needs.
Posted Jan 17, 2019 23:16 UTC (Thu)
by nix (subscriber, #2304)
[Link] (7 responses)
(yes, I help maintain one of those monsters, making heavy use of ioctl() passing intricate structures into and out of the kernel, and the massive use of ioctl() is one thing I at least am hoping to get rid of in the process of getting it ready for upstreaming.)
Posted Jan 17, 2019 23:34 UTC (Thu)
by axboe (subscriber, #904)
[Link] (6 responses)
With liburing, it should be _very_ easy for applications to use. If you go native, yes, you need to be a bit more careful, and it's more hairy. But even with the basic support liburing has now, you just do:
{
io_uring_queue_init(queue_depth, &ring, 0);
sqe = io_uring_get_sqe(&ring);
io_uring_submit(&ring);
io_uring_wait_completion(&ring, &cqe);
as a very basic example.
Posted Jan 18, 2019 4:21 UTC (Fri)
by axboe (subscriber, #904)
[Link] (1 responses)
Posted Jan 19, 2019 18:57 UTC (Sat)
by nix (subscriber, #2304)
[Link]
Posted Jan 19, 2019 19:00 UTC (Sat)
by nix (subscriber, #2304)
[Link] (2 responses)
Posted Jan 19, 2019 20:27 UTC (Sat)
by zdzichu (subscriber, #17118)
[Link] (1 responses)
Posted Jan 20, 2019 10:20 UTC (Sun)
by nix (subscriber, #2304)
[Link]
Posted Jan 24, 2019 12:35 UTC (Thu)
by joib (subscriber, #8541)
[Link]
Ringing in a new asynchronous I/O API
Ringing in a new asynchronous I/O API
Ringing in a new asynchronous I/O API
Ringing in a new asynchronous I/O API
struct io_uring ring;
struct io_uring_sqe *sqe;
struct io_uring_cqe *cqe;
sqe->opcode = IORING_OP_READV;
sqe->fd = fd;
[...]
}
Ringing in a new asynchronous I/O API
Ringing in a new asynchronous I/O API
Ringing in a new asynchronous I/O API
Ringing in a new asynchronous I/O API
Ringing in a new asynchronous I/O API
Ringing in a new asynchronous I/O API
