Re: Resizing io_uring SQ/CQ?

Ming Lei
2023-03-10T01:39:22Z

On Thu, Mar 09, 2023 at 08:48:08AM -0500, Stefan Hajnoczi wrote:
> Hi,
> For block I/O an application can queue excess SQEs in userspace when the
> SQ ring becomes full. For network and IPC operations that is not
> possible because deadlocks can occur when socket, pipe, and eventfd SQEs
> cannot be submitted.

Can you explain a bit the deadlock in case of network application? io_uring
does support to queue many network SQEs via IOSQE_IO_LINK, at least for
send.

>
> Sometimes the application does not know how many SQEs/CQEs are needed upfront
> and that's when we face this challenge.

When running out of SQEs, the application can call io_uring_enter() to submit
queued SQEs immediately without waiting for get events, then once
io_uring_enter() returns, you get free SQEs for moving one.

>
> A simple solution is to call io_uring_setup(2) with a higher entries
> value than you'll ever need. However, if that value is exceeded then
> we're back to the deadlock scenario and that worries me.

Can you please explain the deadlock scenario?

Thanks,
Ming