2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-05-15 10:19:09 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-09-04 11:08:58 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-06-13 07:07:23 -06:00
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
2022-07-12 21:52:46 +01:00
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-07 14:06:15 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-04 20:29:48 -06:00
|
|
|
|
2023-03-20 11:13:49 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2024-06-14 12:30:46 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-14 12:30:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
2022-09-08 13:20:33 +01:00
|
|
|
|
2022-07-25 10:52:06 +01:00
|
|
|
|
2024-01-29 12:00:58 -07:00
|
|
|
|
2022-09-08 13:20:33 +01:00
|
|
|
|
2022-09-21 12:17:51 +01:00
|
|
|
|
2023-01-22 10:02:55 -07:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
2025-07-07 19:38:45 -06:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
|
|
|
|
|
2023-06-12 13:51:36 -06:00
|
|
|
|
2022-09-21 12:17:51 +01:00
|
|
|
|
2022-09-01 11:54:04 +01:00
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
|
|
|
|
|
2025-07-07 16:54:12 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-26 12:17:48 -06:00
|
|
|
|
2025-07-07 16:54:12 -06:00
|
|
|
|
|
|
|
|
|
2025-07-07 19:38:45 -06:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
|
|
|
|
|
2025-07-07 16:54:12 -06:00
|
|
|
|
|
|
|
|
|
2025-07-07 19:38:45 -06:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
2025-06-26 12:17:48 -06:00
|
|
|
|
|
|
|
|
|
2024-01-29 12:00:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-23 20:13:18 -08:00
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-28 23:10:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-01-27 05:52:25 -08:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-01-27 05:52:25 -08:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 14:48:33 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:35 +00:00
|
|
|
|
|
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
|
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:35 +00:00
|
|
|
|
2025-03-07 16:00:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-22 08:19:56 -06:00
|
|
|
|
|
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|
|
|
|
|
|
2024-03-18 10:07:37 -06:00
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|
|
|
|
|
|
2022-09-26 14:35:09 +01:00
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|
2025-01-22 20:00:57 -07:00
|
|
|
|
2024-12-16 15:46:12 -05:00
|
|
|
|
|
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|
2024-12-16 15:46:12 -05:00
|
|
|
|
2025-03-07 16:00:35 +00:00
|
|
|
|
2024-12-16 15:46:12 -05:00
|
|
|
|
|
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|
|
|
|
|
|
2024-02-25 12:52:39 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-07 16:54:12 -06:00
|
|
|
|
2025-07-07 19:38:45 -06:00
|
|
|
|
2024-02-25 12:52:39 -07:00
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:21 +00:00
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
2025-02-26 11:41:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-28 23:10:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:18 +00:00
|
|
|
|
|
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:21 +00:00
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
2025-02-26 11:41:19 +00:00
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
2025-02-26 11:41:16 +00:00
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:34 +00:00
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:17 +00:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-10-22 15:43:15 +01:00
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
2024-10-22 15:43:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
2025-02-26 11:41:18 +00:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2024-10-22 15:43:15 +01:00
|
|
|
|
2025-02-26 11:41:21 +00:00
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
2025-03-07 16:00:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
2024-02-26 16:43:01 -07:00
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
2025-02-26 11:41:19 +00:00
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
2025-02-26 11:41:17 +00:00
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
2025-01-28 20:56:13 +00:00
|
|
|
|
2025-02-26 11:41:19 +00:00
|
|
|
|
2025-01-28 20:56:13 +00:00
|
|
|
|
2025-02-26 11:41:19 +00:00
|
|
|
|
2025-02-26 11:41:17 +00:00
|
|
|
|
2025-02-26 11:41:19 +00:00
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:34 +00:00
|
|
|
|
2024-02-19 14:16:47 -07:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2024-10-22 15:43:13 +01:00
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-22 15:43:13 +01:00
|
|
|
|
|
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
|
|
|
|
|
2024-10-22 15:43:14 +01:00
|
|
|
|
|
|
|
|
|
2024-10-22 15:43:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-22 15:43:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-22 15:43:13 +01:00
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
2025-03-31 17:18:00 +01:00
|
|
|
|
2026-03-03 12:32:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring/net: add provided buffer support for IORING_OP_SEND
It's pretty trivial to wire up provided buffer support for the send
side, just like how it's done the receive side. This enables setting up
a buffer ring that an application can use to push pending sends to,
and then have a send pick a buffer from that ring.
One of the challenges with async IO and networking sends is that you
can get into reordering conditions if you have more than one inflight
at the same time. Consider the following scenario where everything is
fine:
1) App queues sendA for socket1
2) App queues sendB for socket1
3) App does io_uring_submit()
4) sendA is issued, completes successfully, posts CQE
5) sendB is issued, completes successfully, posts CQE
All is fine. Requests are always issued in-order, and both complete
inline as most sends do.
However, if we're flooding socket1 with sends, the following could
also result from the same sequence:
1) App queues sendA for socket1
2) App queues sendB for socket1
3) App does io_uring_submit()
4) sendA is issued, socket1 is full, poll is armed for retry
5) Space frees up in socket1, this triggers sendA retry via task_work
6) sendB is issued, completes successfully, posts CQE
7) sendA is retried, completes successfully, posts CQE
Now we've sent sendB before sendA, which can make things unhappy. If
both sendA and sendB had been using provided buffers, then it would look
as follows instead:
1) App queues dataA for sendA, queues sendA for socket1
2) App queues dataB for sendB queues sendB for socket1
3) App does io_uring_submit()
4) sendA is issued, socket1 is full, poll is armed for retry
5) Space frees up in socket1, this triggers sendA retry via task_work
6) sendB is issued, picks first buffer (dataA), completes successfully,
posts CQE (which says "I sent dataA")
7) sendA is retried, picks first buffer (dataB), completes successfully,
posts CQE (which says "I sent dataB")
Now we've sent the data in order, and everybody is happy.
It's worth noting that this also opens the door for supporting multishot
sends, as provided buffers would be a prerequisite for that. Those can
trigger either when new buffers are added to the outgoing ring, or (if
stalled due to lack of space) when space frees up in the socket.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-02-19 10:46:44 -07:00
|
|
|
|
2025-03-31 17:17:59 +01:00
|
|
|
|
|
|
|
|
|
2025-07-28 20:59:53 -10:00
|
|
|
|
|
|
|
|
|
2025-10-21 22:59:30 +05:30
|
|
|
|
2025-07-28 20:59:53 -10:00
|
|
|
|
2025-03-31 17:17:59 +01:00
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
|
|
|
|
|
2024-10-22 15:43:14 +01:00
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
2024-10-22 15:43:14 +01:00
|
|
|
|
2024-10-22 15:43:12 +01:00
|
|
|
|
2025-03-28 23:10:54 +00:00
|
|
|
|
|
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
2026-03-03 12:32:19 +00:00
|
|
|
|
2024-10-22 15:43:14 +01:00
|
|
|
|
2025-03-28 23:10:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-22 15:43:14 +01:00
|
|
|
|
2025-03-28 23:10:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-28 23:10:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
|
|
|
|
|
io_uring/net: support registered buffer for plain send and recv
So far IORING_RECVSEND_FIXED_BUF is only honoured on the SEND_ZC path,
even though the import wiring is already present for plain send and
completely absent for recv. Targets such as ublk's NBD backend want to
push/pull I/O data directly to/from an io_uring registered buffer over a
plain send/recv on a TCP socket.
Wire IORING_RECVSEND_FIXED_BUF into the plain IORING_OP_SEND and
IORING_OP_RECV paths:
- Accept the flag in SENDMSG_FLAGS / RECVMSG_FLAGS and, at prep time,
restrict it to the non-vectorized IORING_OP_SEND / IORING_OP_RECV
opcodes. It is mutually exclusive with buffer select, bundles and
(for recv) multishot, and records sqe->buf_index.
- For recv, set REQ_F_IMPORT_BUFFER in setup so the registered buffer
is imported lazily at issue time, mirroring the send path.
- In io_send()/io_recv(), import the registered buffer via
io_import_reg_buf() (ITER_SOURCE for send, ITER_DEST for recv) and
clear REQ_F_IMPORT_BUFFER. The resulting bvec iter persists in
async_data, so MSG_WAITALL partial send/recv retries resume at the
right offset.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260608142511.659240-2-ming.lei@redhat.com
[axboe: combine flags checks]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-06-08 09:25:10 -05:00
|
|
|
|
|
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-03-07 12:43:22 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2026-03-29 23:39:09 +08:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
io_uring/net: support registered buffer for plain send and recv
So far IORING_RECVSEND_FIXED_BUF is only honoured on the SEND_ZC path,
even though the import wiring is already present for plain send and
completely absent for recv. Targets such as ublk's NBD backend want to
push/pull I/O data directly to/from an io_uring registered buffer over a
plain send/recv on a TCP socket.
Wire IORING_RECVSEND_FIXED_BUF into the plain IORING_OP_SEND and
IORING_OP_RECV paths:
- Accept the flag in SENDMSG_FLAGS / RECVMSG_FLAGS and, at prep time,
restrict it to the non-vectorized IORING_OP_SEND / IORING_OP_RECV
opcodes. It is mutually exclusive with buffer select, bundles and
(for recv) multishot, and records sqe->buf_index.
- For recv, set REQ_F_IMPORT_BUFFER in setup so the registered buffer
is imported lazily at issue time, mirroring the send path.
- In io_send()/io_recv(), import the registered buffer via
io_import_reg_buf() (ITER_SOURCE for send, ITER_DEST for recv) and
clear REQ_F_IMPORT_BUFFER. The resulting bvec iter persists in
async_data, so MSG_WAITALL partial send/recv retries resume at the
right offset.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260608142511.659240-2-ming.lei@redhat.com
[axboe: combine flags checks]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-06-08 09:25:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-31 17:18:01 +01:00
|
|
|
|
|
|
|
|
|
2026-07-26 08:12:38 -06:00
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-27 09:57:27 +00:00
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2025-02-24 12:42:24 +00:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2025-02-24 12:42:24 +00:00
|
|
|
|
2024-10-22 15:43:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-22 15:43:13 +01:00
|
|
|
|
2025-03-28 23:10:58 +00:00
|
|
|
|
|
|
|
|
|
2024-10-22 15:43:14 +01:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2024-03-06 07:57:57 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:35 +00:00
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:33 -06:00
|
|
|
|
2025-08-12 08:30:11 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:33 -06:00
|
|
|
|
2025-08-12 08:30:11 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:38 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:38 -06:00
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
2026-01-27 21:01:41 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:38 -06:00
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:38 -06:00
|
|
|
|
|
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring/net: always setup an io_async_msghdr
Rather than use an on-stack one and then need to allocate and copy if
async execution is required, always grab one upfront. This should be
very cheap, and potentially even have cache hotness benefits for
back-to-back send/recv requests.
For any recv type of request, this is probably a good choice in general,
as it's expected that no data is available initially. For send this is
not necessarily the case, as space in the socket buffer is expected to
be available. However, getting a cached io_async_msghdr is very cheap,
and as it should be cache hot, probably the difference here is neglible,
if any.
A nice side benefit is that io_setup_async_msg can get killed
completely, which has some nasty iovec manipulation code.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-03-16 17:26:09 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-12 12:39:54 -06:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring/net: always setup an io_async_msghdr
Rather than use an on-stack one and then need to allocate and copy if
async execution is required, always grab one upfront. This should be
very cheap, and potentially even have cache hotness benefits for
back-to-back send/recv requests.
For any recv type of request, this is probably a good choice in general,
as it's expected that no data is available initially. For send this is
not necessarily the case, as space in the socket buffer is expected to
be available. However, getting a cached io_async_msghdr is very cheap,
and as it should be cache hot, probably the difference here is neglible,
if any.
A nice side benefit is that io_setup_async_msg can get killed
completely, which has some nasty iovec manipulation code.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-03-16 17:26:09 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2023-06-19 09:35:34 -06:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2025-08-20 20:03:31 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-09-08 13:20:29 +01:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2024-03-18 13:52:42 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 14:48:33 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2025-01-28 20:56:14 +00:00
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
2025-01-28 20:56:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-31 17:18:02 +01:00
|
|
|
|
2025-01-28 20:56:14 +00:00
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
2025-01-28 20:56:14 +00:00
|
|
|
|
2025-03-07 16:00:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-28 20:56:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
2025-01-28 20:56:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-28 20:56:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
io_uring/net: support registered buffer for plain send and recv
So far IORING_RECVSEND_FIXED_BUF is only honoured on the SEND_ZC path,
even though the import wiring is already present for plain send and
completely absent for recv. Targets such as ublk's NBD backend want to
push/pull I/O data directly to/from an io_uring registered buffer over a
plain send/recv on a TCP socket.
Wire IORING_RECVSEND_FIXED_BUF into the plain IORING_OP_SEND and
IORING_OP_RECV paths:
- Accept the flag in SENDMSG_FLAGS / RECVMSG_FLAGS and, at prep time,
restrict it to the non-vectorized IORING_OP_SEND / IORING_OP_RECV
opcodes. It is mutually exclusive with buffer select, bundles and
(for recv) multishot, and records sqe->buf_index.
- For recv, set REQ_F_IMPORT_BUFFER in setup so the registered buffer
is imported lazily at issue time, mirroring the send path.
- In io_send()/io_recv(), import the registered buffer via
io_import_reg_buf() (ITER_SOURCE for send, ITER_DEST for recv) and
clear REQ_F_IMPORT_BUFFER. The resulting bvec iter persists in
async_data, so MSG_WAITALL partial send/recv retries resume at the
right offset.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260608142511.659240-2-ming.lei@redhat.com
[axboe: combine flags checks]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-06-08 09:25:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
2025-01-28 20:56:14 +00:00
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-05 09:34:21 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2023-05-22 13:11:10 +01:00
|
|
|
|
2024-03-05 09:34:21 -07:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
io_uring/net: always setup an io_async_msghdr
Rather than use an on-stack one and then need to allocate and copy if
async execution is required, always grab one upfront. This should be
very cheap, and potentially even have cache hotness benefits for
back-to-back send/recv requests.
For any recv type of request, this is probably a good choice in general,
as it's expected that no data is available initially. For send this is
not necessarily the case, as space in the socket buffer is expected to
be available. However, getting a cached io_async_msghdr is very cheap,
and as it should be cache hot, probably the difference here is neglible,
if any.
A nice side benefit is that io_setup_async_msg can get killed
completely, which has some nasty iovec manipulation code.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-03-16 17:26:09 -06:00
|
|
|
|
2022-09-21 12:17:51 +01:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-09-08 13:20:29 +01:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
2025-08-20 20:03:38 -06:00
|
|
|
|
|
|
|
|
|
2024-03-05 13:10:04 -07:00
|
|
|
|
|
|
|
|
|
2024-03-18 13:52:42 -06:00
|
|
|
|
2025-08-20 20:03:38 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
|
|
|
|
|
2024-03-01 19:43:48 +05:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
|
|
|
|
|
2024-03-01 18:29:39 +03:00
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
|
|
|
|
|
2024-03-01 18:29:39 +03:00
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:33 +00:00
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-27 11:09:20 -07:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2024-03-18 07:36:03 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-03-15 16:36:23 -06:00
|
|
|
|
2024-03-18 07:36:03 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-03-18 10:07:37 -06:00
|
|
|
|
2024-03-18 07:36:03 -06:00
|
|
|
|
2022-09-08 13:20:30 +01:00
|
|
|
|
2024-03-18 07:36:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-02 16:32:51 -07:00
|
|
|
|
2024-03-18 07:36:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-31 17:17:59 +01:00
|
|
|
|
|
|
|
|
|
io_uring/net: support registered buffer for plain send and recv
So far IORING_RECVSEND_FIXED_BUF is only honoured on the SEND_ZC path,
even though the import wiring is already present for plain send and
completely absent for recv. Targets such as ublk's NBD backend want to
push/pull I/O data directly to/from an io_uring registered buffer over a
plain send/recv on a TCP socket.
Wire IORING_RECVSEND_FIXED_BUF into the plain IORING_OP_SEND and
IORING_OP_RECV paths:
- Accept the flag in SENDMSG_FLAGS / RECVMSG_FLAGS and, at prep time,
restrict it to the non-vectorized IORING_OP_SEND / IORING_OP_RECV
opcodes. It is mutually exclusive with buffer select, bundles and
(for recv) multishot, and records sqe->buf_index.
- For recv, set REQ_F_IMPORT_BUFFER in setup so the registered buffer
is imported lazily at issue time, mirroring the send path.
- In io_send()/io_recv(), import the registered buffer via
io_import_reg_buf() (ITER_SOURCE for send, ITER_DEST for recv) and
clear REQ_F_IMPORT_BUFFER. The resulting bvec iter persists in
async_data, so MSG_WAITALL partial send/recv retries resume at the
right offset.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260608142511.659240-2-ming.lei@redhat.com
[axboe: combine flags checks]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-06-08 09:25:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-31 17:17:59 +01:00
|
|
|
|
|
|
|
|
|
2024-03-18 07:36:03 -06:00
|
|
|
|
|
|
|
|
|
2025-02-26 11:41:15 +00:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
io_uring/net: support registered buffer for plain send and recv
So far IORING_RECVSEND_FIXED_BUF is only honoured on the SEND_ZC path,
even though the import wiring is already present for plain send and
completely absent for recv. Targets such as ublk's NBD backend want to
push/pull I/O data directly to/from an io_uring registered buffer over a
plain send/recv on a TCP socket.
Wire IORING_RECVSEND_FIXED_BUF into the plain IORING_OP_SEND and
IORING_OP_RECV paths:
- Accept the flag in SENDMSG_FLAGS / RECVMSG_FLAGS and, at prep time,
restrict it to the non-vectorized IORING_OP_SEND / IORING_OP_RECV
opcodes. It is mutually exclusive with buffer select, bundles and
(for recv) multishot, and records sqe->buf_index.
- For recv, set REQ_F_IMPORT_BUFFER in setup so the registered buffer
is imported lazily at issue time, mirroring the send path.
- In io_send()/io_recv(), import the registered buffer via
io_import_reg_buf() (ITER_SOURCE for send, ITER_DEST for recv) and
clear REQ_F_IMPORT_BUFFER. The resulting bvec iter persists in
async_data, so MSG_WAITALL partial send/recv retries resume at the
right offset.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260608142511.659240-2-ming.lei@redhat.com
[axboe: combine flags checks]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-06-08 09:25:10 -05:00
|
|
|
|
2022-06-30 02:12:29 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-03-07 12:43:22 -07:00
|
|
|
|
|
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-29 23:39:09 +08:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
io_uring/net: support registered buffer for plain send and recv
So far IORING_RECVSEND_FIXED_BUF is only honoured on the SEND_ZC path,
even though the import wiring is already present for plain send and
completely absent for recv. Targets such as ublk's NBD backend want to
push/pull I/O data directly to/from an io_uring registered buffer over a
plain send/recv on a TCP socket.
Wire IORING_RECVSEND_FIXED_BUF into the plain IORING_OP_SEND and
IORING_OP_RECV paths:
- Accept the flag in SENDMSG_FLAGS / RECVMSG_FLAGS and, at prep time,
restrict it to the non-vectorized IORING_OP_SEND / IORING_OP_RECV
opcodes. It is mutually exclusive with buffer select, bundles and
(for recv) multishot, and records sqe->buf_index.
- For recv, set REQ_F_IMPORT_BUFFER in setup so the registered buffer
is imported lazily at issue time, mirroring the send path.
- In io_send()/io_recv(), import the registered buffer via
io_import_reg_buf() (ITER_SOURCE for send, ITER_DEST for recv) and
clear REQ_F_IMPORT_BUFFER. The resulting bvec iter persists in
async_data, so MSG_WAITALL partial send/recv retries resume at the
right offset.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260608142511.659240-2-ming.lei@redhat.com
[axboe: combine flags checks]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-06-08 09:25:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-02-24 16:01:24 +01:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2023-01-22 10:02:55 -07:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
2025-07-07 19:38:45 -06:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
|
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-30 02:12:29 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2025-02-24 12:42:24 +00:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2025-02-24 12:42:24 +00:00
|
|
|
|
2024-01-29 12:00:58 -07:00
|
|
|
|
2024-03-18 07:36:03 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
io_uring/net: improve recv bundles
Current recv bundles are only supported for multishot receives, and
additionally they also always post at least 2 CQEs if more data is
available than what a buffer will hold. This happens because the initial
bundle recv will do a single buffer, and then do the rest of what is in
the socket as a followup receive. As shown in a test program, if 1k
buffers are available and 32k is available to receive in the socket,
you'd get the following completions:
bundle=1, mshot=0
cqe res 1024
cqe res 1024
[...]
cqe res 1024
bundle=1, mshot=1
cqe res 1024
cqe res 31744
where bundle=1 && mshot=0 will post 32 1k completions, and bundle=1 &&
mshot=1 will post a 1k completion and then a 31k completion.
To support bundle recv without multishot, it's possible to simply retry
the recv immediately and post a single completion, rather than split it
into two completions. With the below patch, the same test looks as
follows:
bundle=1, mshot=0
cqe res 32768
bundle=1, mshot=1
cqe res 32768
where mshot=0 works fine for bundles, and both of them post just a
single 32k completion rather than split it into separate completions.
Posting fewer completions is always a nice win, and not needing
multishot for proper bundle efficiency is nice for cases that can't
necessarily use multishot.
Reported-by: Norman Maurer <norman_maurer@apple.com>
Link: https://lore.kernel.org/r/184f9f92-a682-4205-a15d-89e18f664502@kernel.dk
Fixes: 2f9c9515bdfd ("io_uring/net: support bundles for recv")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-02-08 10:50:34 -07:00
|
|
|
|
2026-06-04 09:07:13 -07:00
|
|
|
|
|
|
|
|
|
io_uring/net: improve recv bundles
Current recv bundles are only supported for multishot receives, and
additionally they also always post at least 2 CQEs if more data is
available than what a buffer will hold. This happens because the initial
bundle recv will do a single buffer, and then do the rest of what is in
the socket as a followup receive. As shown in a test program, if 1k
buffers are available and 32k is available to receive in the socket,
you'd get the following completions:
bundle=1, mshot=0
cqe res 1024
cqe res 1024
[...]
cqe res 1024
bundle=1, mshot=1
cqe res 1024
cqe res 31744
where bundle=1 && mshot=0 will post 32 1k completions, and bundle=1 &&
mshot=1 will post a 1k completion and then a 31k completion.
To support bundle recv without multishot, it's possible to simply retry
the recv immediately and post a single completion, rather than split it
into two completions. With the below patch, the same test looks as
follows:
bundle=1, mshot=0
cqe res 32768
bundle=1, mshot=1
cqe res 32768
where mshot=0 works fine for bundles, and both of them post just a
single 32k completion rather than split it into separate completions.
Posting fewer completions is always a nice win, and not needing
multishot for proper bundle efficiency is nice for cases that can't
necessarily use multishot.
Reported-by: Norman Maurer <norman_maurer@apple.com>
Link: https://lore.kernel.org/r/184f9f92-a682-4205-a15d-89e18f664502@kernel.dk
Fixes: 2f9c9515bdfd ("io_uring/net: support bundles for recv")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-02-08 10:50:34 -07:00
|
|
|
|
2022-06-30 02:12:29 -07:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
2022-06-30 02:12:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
2024-03-05 15:39:16 -07:00
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
|
|
|
|
|
2022-06-30 02:12:29 -07:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2024-07-02 09:16:46 -06:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2024-03-05 15:39:16 -07:00
|
|
|
|
2023-05-17 12:20:44 -06:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-02 09:16:46 -06:00
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
2025-05-21 18:51:49 -06:00
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2025-07-07 16:54:12 -06:00
|
|
|
|
io_uring/net: improve recv bundles
Current recv bundles are only supported for multishot receives, and
additionally they also always post at least 2 CQEs if more data is
available than what a buffer will hold. This happens because the initial
bundle recv will do a single buffer, and then do the rest of what is in
the socket as a followup receive. As shown in a test program, if 1k
buffers are available and 32k is available to receive in the socket,
you'd get the following completions:
bundle=1, mshot=0
cqe res 1024
cqe res 1024
[...]
cqe res 1024
bundle=1, mshot=1
cqe res 1024
cqe res 31744
where bundle=1 && mshot=0 will post 32 1k completions, and bundle=1 &&
mshot=1 will post a 1k completion and then a 31k completion.
To support bundle recv without multishot, it's possible to simply retry
the recv immediately and post a single completion, rather than split it
into two completions. With the below patch, the same test looks as
follows:
bundle=1, mshot=0
cqe res 32768
bundle=1, mshot=1
cqe res 32768
where mshot=0 works fine for bundles, and both of them post just a
single 32k completion rather than split it into separate completions.
Posting fewer completions is always a nice win, and not needing
multishot for proper bundle efficiency is nice for cases that can't
necessarily use multishot.
Reported-by: Norman Maurer <norman_maurer@apple.com>
Link: https://lore.kernel.org/r/184f9f92-a682-4205-a15d-89e18f664502@kernel.dk
Fixes: 2f9c9515bdfd ("io_uring/net: support bundles for recv")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-02-08 10:50:34 -07:00
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
2025-07-07 19:38:45 -06:00
|
|
|
|
2024-07-02 09:16:46 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-21 18:51:49 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-07 16:54:12 -06:00
|
|
|
|
|
|
|
|
|
2025-05-21 18:51:49 -06:00
|
|
|
|
io_uring/net: improve recv bundles
Current recv bundles are only supported for multishot receives, and
additionally they also always post at least 2 CQEs if more data is
available than what a buffer will hold. This happens because the initial
bundle recv will do a single buffer, and then do the rest of what is in
the socket as a followup receive. As shown in a test program, if 1k
buffers are available and 32k is available to receive in the socket,
you'd get the following completions:
bundle=1, mshot=0
cqe res 1024
cqe res 1024
[...]
cqe res 1024
bundle=1, mshot=1
cqe res 1024
cqe res 31744
where bundle=1 && mshot=0 will post 32 1k completions, and bundle=1 &&
mshot=1 will post a 1k completion and then a 31k completion.
To support bundle recv without multishot, it's possible to simply retry
the recv immediately and post a single completion, rather than split it
into two completions. With the below patch, the same test looks as
follows:
bundle=1, mshot=0
cqe res 32768
bundle=1, mshot=1
cqe res 32768
where mshot=0 works fine for bundles, and both of them post just a
single 32k completion rather than split it into separate completions.
Posting fewer completions is always a nice win, and not needing
multishot for proper bundle efficiency is nice for cases that can't
necessarily use multishot.
Reported-by: Norman Maurer <norman_maurer@apple.com>
Link: https://lore.kernel.org/r/184f9f92-a682-4205-a15d-89e18f664502@kernel.dk
Fixes: 2f9c9515bdfd ("io_uring/net: support bundles for recv")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-02-08 10:50:34 -07:00
|
|
|
|
|
|
|
|
|
2025-05-21 18:51:49 -06:00
|
|
|
|
2025-07-07 16:54:12 -06:00
|
|
|
|
io_uring/net: improve recv bundles
Current recv bundles are only supported for multishot receives, and
additionally they also always post at least 2 CQEs if more data is
available than what a buffer will hold. This happens because the initial
bundle recv will do a single buffer, and then do the rest of what is in
the socket as a followup receive. As shown in a test program, if 1k
buffers are available and 32k is available to receive in the socket,
you'd get the following completions:
bundle=1, mshot=0
cqe res 1024
cqe res 1024
[...]
cqe res 1024
bundle=1, mshot=1
cqe res 1024
cqe res 31744
where bundle=1 && mshot=0 will post 32 1k completions, and bundle=1 &&
mshot=1 will post a 1k completion and then a 31k completion.
To support bundle recv without multishot, it's possible to simply retry
the recv immediately and post a single completion, rather than split it
into two completions. With the below patch, the same test looks as
follows:
bundle=1, mshot=0
cqe res 32768
bundle=1, mshot=1
cqe res 32768
where mshot=0 works fine for bundles, and both of them post just a
single 32k completion rather than split it into separate completions.
Posting fewer completions is always a nice win, and not needing
multishot for proper bundle efficiency is nice for cases that can't
necessarily use multishot.
Reported-by: Norman Maurer <norman_maurer@apple.com>
Link: https://lore.kernel.org/r/184f9f92-a682-4205-a15d-89e18f664502@kernel.dk
Fixes: 2f9c9515bdfd ("io_uring/net: support bundles for recv")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-02-08 10:50:34 -07:00
|
|
|
|
|
|
|
|
|
2024-07-02 09:16:46 -06:00
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2024-07-02 09:16:46 -06:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2024-01-29 11:54:18 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-08 13:55:58 +00:00
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
|
|
|
|
|
2024-02-25 12:52:39 -07:00
|
|
|
|
2024-01-29 11:54:18 -07:00
|
|
|
|
2024-03-05 15:39:16 -07:00
|
|
|
|
2025-07-07 19:38:45 -06:00
|
|
|
|
|
|
|
|
|
2024-01-29 12:00:58 -07:00
|
|
|
|
2025-07-07 19:38:45 -06:00
|
|
|
|
2024-01-29 12:00:58 -07:00
|
|
|
|
|
|
|
|
|
2025-07-07 19:38:45 -06:00
|
|
|
|
2025-03-08 17:19:32 +00:00
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
2024-01-29 12:00:58 -07:00
|
|
|
|
2024-01-29 11:54:18 -07:00
|
|
|
|
|
|
|
|
|
2024-03-08 13:55:58 +00:00
|
|
|
|
|
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
|
|
|
|
|
2024-03-18 13:52:42 -06:00
|
|
|
|
2022-06-30 02:12:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-05 04:54:50 -07:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-05 04:54:50 -07:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2024-03-18 07:36:03 -06:00
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring/net: always setup an io_async_msghdr
Rather than use an on-stack one and then need to allocate and copy if
async execution is required, always grab one upfront. This should be
very cheap, and potentially even have cache hotness benefits for
back-to-back send/recv requests.
For any recv type of request, this is probably a good choice in general,
as it's expected that no data is available initially. For send this is
not necessarily the case, as space in the socket buffer is expected to
be available. However, getting a cached io_async_msghdr is very cheap,
and as it should be cache hot, probably the difference here is neglible,
if any.
A nice side benefit is that io_setup_async_msg can get killed
completely, which has some nasty iovec manipulation code.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-03-16 17:26:09 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-02-25 12:59:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-12-07 03:53:31 +00:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-06-27 12:05:01 -06:00
|
|
|
|
2023-06-19 09:41:05 -06:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
|
|
|
|
|
2023-06-19 09:41:05 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
|
|
|
|
|
2023-06-19 09:41:05 -06:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2025-03-08 17:19:32 +00:00
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-09-08 13:20:29 +01:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-30 02:12:23 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-30 02:12:23 -07:00
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2022-06-30 02:12:23 -07:00
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
|
|
|
|
|
2022-07-14 04:02:58 -07:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-31 17:18:02 +01:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
|
|
|
|
|
2025-07-07 19:38:45 -06:00
|
|
|
|
2025-09-02 05:19:42 -06:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2025-07-15 16:02:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-25 10:17:06 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-26 12:17:48 -06:00
|
|
|
|
2025-07-07 16:54:12 -06:00
|
|
|
|
2025-06-25 10:17:06 -06:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
|
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
|
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2024-03-18 07:36:03 -06:00
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-26 07:08:10 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-05-29 20:03:47 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-25 12:59:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring/net: support registered buffer for plain send and recv
So far IORING_RECVSEND_FIXED_BUF is only honoured on the SEND_ZC path,
even though the import wiring is already present for plain send and
completely absent for recv. Targets such as ublk's NBD backend want to
push/pull I/O data directly to/from an io_uring registered buffer over a
plain send/recv on a TCP socket.
Wire IORING_RECVSEND_FIXED_BUF into the plain IORING_OP_SEND and
IORING_OP_RECV paths:
- Accept the flag in SENDMSG_FLAGS / RECVMSG_FLAGS and, at prep time,
restrict it to the non-vectorized IORING_OP_SEND / IORING_OP_RECV
opcodes. It is mutually exclusive with buffer select, bundles and
(for recv) multishot, and records sqe->buf_index.
- For recv, set REQ_F_IMPORT_BUFFER in setup so the registered buffer
is imported lazily at issue time, mirroring the send path.
- In io_send()/io_recv(), import the registered buffer via
io_import_reg_buf() (ITER_SOURCE for send, ITER_DEST for recv) and
clear REQ_F_IMPORT_BUFFER. The resulting bvec iter persists in
async_data, so MSG_WAITALL partial send/recv retries resume at the
right offset.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260608142511.659240-2-ming.lei@redhat.com
[axboe: combine flags checks]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-06-08 09:25:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-30 02:12:29 -07:00
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2025-08-20 20:03:36 -06:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:32 -06:00
|
|
|
|
2024-07-02 09:37:30 -06:00
|
|
|
|
2024-03-05 15:39:16 -07:00
|
|
|
|
2024-07-02 09:37:30 -06:00
|
|
|
|
2024-03-05 16:22:04 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2024-07-02 09:37:30 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-03-05 15:39:16 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-03-05 15:39:16 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-06-30 02:12:29 -07:00
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2025-03-08 17:19:32 +00:00
|
|
|
|
2022-06-30 02:12:29 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-09-08 13:20:29 +01:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-03-05 15:39:16 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-26 07:08:10 -06:00
|
|
|
|
2022-06-30 02:12:23 -07:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-30 02:12:23 -07:00
|
|
|
|
io_uring/kbuf: switch to storing struct io_buffer_list locally
Currently the buffer list is stored in struct io_kiocb. The buffer list
can be of two types:
1) Classic/legacy buffer list. These don't need to get referenced after
a buffer pick, and hence storing them in struct io_kiocb is perfectly
fine.
2) Ring provided buffer lists. These DO need to be referenced after the
initial buffer pick, as they need to get consumed later on. This can
be either just incrementing the head of the ring, or it can be
consuming parts of a buffer if incremental buffer consumptions has
been configured.
For case 2, io_uring needs to be careful not to access the buffer list
after the initial pick-and-execute context. The core does recycling of
these, but it's easy to make a mistake, because it's stored in the
io_kiocb which does persist across multiple execution contexts. Either
because it's a multishot request, or simply because it needed some kind
of async trigger (eg poll) for retry purposes.
Add a struct io_buffer_list to struct io_br_sel, which is always on
stack for the various users of it. This prevents the buffer list from
leaking outside of that execution context, and additionally it enables
kbuf to not even pass back the struct io_buffer_list if the given
context isn't appropriately locked already.
This doesn't fix any bugs, it's simply a defensive measure to prevent
any issues with reuse of a buffer list.
Link: https://lore.kernel.org/r/20250821020750.598432-12-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-08-20 20:03:39 -06:00
|
|
|
|
2022-06-30 02:12:23 -07:00
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
|
|
|
|
|
2022-06-30 02:12:29 -07:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:37 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-20 10:31:17 +01:00
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-20 10:31:20 +01:00
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
|
|
|
|
|
2025-04-20 10:31:20 +01:00
|
|
|
|
2025-02-23 20:13:18 -08:00
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
2025-11-13 10:46:11 +00:00
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-23 20:13:18 -08:00
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-05-29 20:03:47 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-23 20:13:18 -08:00
|
|
|
|
2025-11-13 10:46:11 +00:00
|
|
|
|
2025-02-23 20:13:18 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-08 17:19:33 +00:00
|
|
|
|
2025-02-23 20:13:18 -08:00
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-14 16:09:43 -08:00
|
|
|
|
|
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-08 17:19:33 +00:00
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
2025-03-08 17:19:32 +00:00
|
|
|
|
2025-02-14 16:09:41 -08:00
|
|
|
|
|
|
|
|
|
2022-09-21 12:17:52 +01:00
|
|
|
|
2022-09-01 11:54:04 +01:00
|
|
|
|
2022-09-08 13:20:34 +01:00
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
2022-09-01 11:54:04 +01:00
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
|
|
|
|
|
2022-09-23 16:23:34 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-01 11:54:04 +01:00
|
|
|
|
|
|
|
|
|
2022-11-04 10:59:45 +00:00
|
|
|
|
2025-07-28 20:59:53 -10:00
|
|
|
|
|
|
|
|
|
2022-11-04 10:59:45 +00:00
|
|
|
|
2022-09-21 12:17:52 +01:00
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
2022-09-08 13:20:34 +01:00
|
|
|
|
2022-07-12 21:52:46 +01:00
|
|
|
|
2025-03-28 23:10:59 +00:00
|
|
|
|
2022-09-01 11:54:04 +01:00
|
|
|
|
2026-02-16 11:48:52 +00:00
|
|
|
|
2025-03-27 15:02:20 +00:00
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
2024-03-07 12:43:22 -07:00
|
|
|
|
|
|
|
|
|
2026-02-16 11:48:52 +00:00
|
|
|
|
2022-09-01 11:54:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
|
|
|
|
|
2022-09-01 11:54:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-16 11:48:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-01 11:54:04 +01:00
|
|
|
|
|
|
|
|
|
2025-03-28 23:10:56 +00:00
|
|
|
|
2022-11-04 10:59:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-08 00:54:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-04 10:59:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
2024-04-08 00:54:57 +01:00
|
|
|
|
2025-02-24 13:31:08 -08:00
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
|
|
|
|
|
2022-07-12 21:52:45 +01:00
|
|
|
|
2026-03-17 14:18:04 -06:00
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
2025-02-24 12:42:24 +00:00
|
|
|
|
2025-03-28 23:10:59 +00:00
|
|
|
|
|
|
|
|
|
2024-10-22 15:43:12 +01:00
|
|
|
|
2025-03-28 23:10:59 +00:00
|
|
|
|
2025-03-25 08:39:42 -06:00
|
|
|
|
2025-03-28 23:11:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-25 08:39:42 -06:00
|
|
|
|
2025-03-27 15:02:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-28 23:11:00 +00:00
|
|
|
|
|
|
|
|
|
2025-03-27 15:02:20 +00:00
|
|
|
|
2025-03-28 23:11:00 +00:00
|
|
|
|
|
|
|
|
|
2025-03-27 15:02:20 +00:00
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
|
|
|
|
|
2024-06-27 13:59:44 +01:00
|
|
|
|
2022-09-08 13:20:32 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-27 13:59:44 +01:00
|
|
|
|
2022-09-08 13:20:32 +01:00
|
|
|
|
|
|
|
|
|
2024-06-27 13:59:44 +01:00
|
|
|
|
2022-07-12 21:52:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-08 13:20:32 +01:00
|
|
|
|
2022-07-12 21:52:50 +01:00
|
|
|
|
2022-09-08 13:20:32 +01:00
|
|
|
|
2024-06-27 13:59:44 +01:00
|
|
|
|
2022-07-12 21:52:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-26 17:15:47 +01:00
|
|
|
|
2022-07-12 21:52:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-16 11:45:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-05 09:34:21 -07:00
|
|
|
|
|
|
|
|
|
2026-02-16 11:45:54 +00:00
|
|
|
|
|
|
|
|
|
2024-03-05 09:34:21 -07:00
|
|
|
|
2025-03-28 23:11:00 +00:00
|
|
|
|
2024-03-05 09:34:21 -07:00
|
|
|
|
2026-02-16 11:45:54 +00:00
|
|
|
|
|
|
|
|
|
2026-03-03 12:32:19 +00:00
|
|
|
|
2026-02-16 11:45:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-05 09:34:21 -07:00
|
|
|
|
|
|
|
|
|
2022-09-21 12:17:54 +01:00
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
2022-09-21 12:17:54 +01:00
|
|
|
|
2024-03-18 08:09:47 -06:00
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
2022-09-28 00:51:49 +01:00
|
|
|
|
2022-07-12 21:52:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-21 11:16:40 +01:00
|
|
|
|
|
|
|
|
|
2022-09-21 12:17:54 +01:00
|
|
|
|
|
|
|
|
|
io_uring/net: always setup an io_async_msghdr
Rather than use an on-stack one and then need to allocate and copy if
async execution is required, always grab one upfront. This should be
very cheap, and potentially even have cache hotness benefits for
back-to-back send/recv requests.
For any recv type of request, this is probably a good choice in general,
as it's expected that no data is available initially. For send this is
not necessarily the case, as space in the socket buffer is expected to
be available. However, getting a cached io_async_msghdr is very cheap,
and as it should be cache hot, probably the difference here is neglible,
if any.
A nice side benefit is that io_setup_async_msg can get killed
completely, which has some nasty iovec manipulation code.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-03-16 17:26:09 -06:00
|
|
|
|
2022-09-21 12:17:54 +01:00
|
|
|
|
2026-02-16 11:45:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-16 11:45:53 +00:00
|
|
|
|
2022-09-21 12:17:54 +01:00
|
|
|
|
2026-02-16 11:45:53 +00:00
|
|
|
|
|
|
|
|
|
2022-09-21 12:17:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-16 11:45:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-21 12:17:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring/net: always setup an io_async_msghdr
Rather than use an on-stack one and then need to allocate and copy if
async execution is required, always grab one upfront. This should be
very cheap, and potentially even have cache hotness benefits for
back-to-back send/recv requests.
For any recv type of request, this is probably a good choice in general,
as it's expected that no data is available initially. For send this is
not necessarily the case, as space in the socket buffer is expected to
be available. However, getting a cached io_async_msghdr is very cheap,
and as it should be cache hot, probably the difference here is neglible,
if any.
A nice side benefit is that io_setup_async_msg can get killed
completely, which has some nasty iovec manipulation code.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-03-16 17:26:09 -06:00
|
|
|
|
2022-09-21 12:17:54 +01:00
|
|
|
|
2026-02-16 11:45:55 +00:00
|
|
|
|
2022-09-21 12:17:54 +01:00
|
|
|
|
2025-08-20 20:03:31 -06:00
|
|
|
|
2022-09-21 12:17:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-29 22:23:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-22 11:47:27 +00:00
|
|
|
|
2024-03-18 13:52:42 -06:00
|
|
|
|
2022-09-29 22:23:19 +01:00
|
|
|
|
2022-09-28 00:51:49 +01:00
|
|
|
|
2025-05-08 14:48:33 -06:00
|
|
|
|
2022-09-21 12:17:54 +01:00
|
|
|
|
|
|
|
|
|
2022-09-21 12:17:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-07 12:43:22 -07:00
|
|
|
|
2022-09-28 00:51:49 +01:00
|
|
|
|
|
|
|
|
|
2022-09-21 12:17:53 +01:00
|
|
|
|
2022-09-28 00:51:49 +01:00
|
|
|
|
|
|
|
|
|
2022-09-21 12:17:49 +01:00
|
|
|
|
|
|
|
|
|
2024-05-08 08:17:50 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-07 14:06:15 -06:00
|
|
|
|
2024-05-08 08:17:50 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-07 14:06:15 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-07 14:06:15 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-05-07 14:06:15 -06:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2024-05-09 09:31:05 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2024-05-09 09:41:10 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2024-05-08 08:17:50 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-09 09:41:10 -06:00
|
|
|
|
|
|
|
|
|
2024-05-09 09:31:05 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-07 14:06:15 -06:00
|
|
|
|
2025-03-08 17:19:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-09 09:41:10 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-23 17:22:30 +00:00
|
|
|
|
|
|
|
|
|
2024-05-09 09:41:10 -06:00
|
|
|
|
|
|
|
|
|
2025-03-08 17:19:32 +00:00
|
|
|
|
2024-05-09 09:41:10 -06:00
|
|
|
|
2022-06-30 02:12:28 -07:00
|
|
|
|
2024-05-09 09:41:10 -06:00
|
|
|
|
2025-02-23 17:22:30 +00:00
|
|
|
|
|
|
|
|
|
2025-03-08 17:19:33 +00:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2026-01-16 14:50:05 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-05-12 16:32:42 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-02 17:53:24 -04:00
|
|
|
|
2026-05-12 16:32:42 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 14:48:33 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2026-06-02 17:53:24 -04:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-20 11:13:49 -06:00
|
|
|
|
2024-03-18 20:37:22 -06:00
|
|
|
|
2026-06-02 17:53:24 -04:00
|
|
|
|
|
|
|
|
|
2024-03-18 20:37:22 -06:00
|
|
|
|
|
|
|
|
|
2026-06-02 17:53:24 -04:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2026-06-02 17:53:24 -04:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-16 17:20:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-30 08:40:29 -07:00
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
2026-06-02 17:53:24 -04:00
|
|
|
|
2023-03-20 11:13:49 -06:00
|
|
|
|
|
|
|
|
|
2022-10-04 20:29:48 -06:00
|
|
|
|
|
|
|
|
|
io_uring/net: ensure socket is marked connected on connect retry
io_uring does non-blocking connection attempts, which can yield some
unexpected results if a connect request is re-attempted by an an
application. This is equivalent to the following sync syscall sequence:
sock = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP);
connect(sock, &addr, sizeof(addr);
ret == -1 and errno == EINPROGRESS expected here. Now poll for POLLOUT
on sock, and when that returns, we expect the socket to be connected.
But if we follow that procedure with:
connect(sock, &addr, sizeof(addr));
you'd expect ret == -1 and errno == EISCONN here, but you actually get
ret == 0. If we attempt the connection one more time, then we get EISCON
as expected.
io_uring used to do this, but turns out that bluetooth fails with EBADFD
if you attempt to re-connect. Also looks like EISCONN _could_ occur with
this sequence.
Retain the ->in_progress logic, but work-around a potential EISCONN or
EBADFD error and only in those cases look at the sock_error(). This
should work in general and avoid the odd sequence of a repeated connect
request returning success when the socket is already connected.
This is all a side effect of the socket state being in a CONNECTING
state when we get EINPROGRESS, and only a re-connect or other related
operation will turn that into CONNECTED.
Cc: stable@vger.kernel.org
Fixes: 3fb1bd688172 ("io_uring/net: handle -EINPROGRESS correct for IORING_OP_CONNECT")
Link: https://github.com/axboe/liburing/issues/980
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2023-11-03 10:35:40 -06:00
|
|
|
|
2023-03-20 11:13:49 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
io_uring/net: ensure socket is marked connected on connect retry
io_uring does non-blocking connection attempts, which can yield some
unexpected results if a connect request is re-attempted by an an
application. This is equivalent to the following sync syscall sequence:
sock = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP);
connect(sock, &addr, sizeof(addr);
ret == -1 and errno == EINPROGRESS expected here. Now poll for POLLOUT
on sock, and when that returns, we expect the socket to be connected.
But if we follow that procedure with:
connect(sock, &addr, sizeof(addr));
you'd expect ret == -1 and errno == EISCONN here, but you actually get
ret == 0. If we attempt the connection one more time, then we get EISCON
as expected.
io_uring used to do this, but turns out that bluetooth fails with EBADFD
if you attempt to re-connect. Also looks like EISCONN _could_ occur with
this sequence.
Retain the ->in_progress logic, but work-around a potential EISCONN or
EBADFD error and only in those cases look at the sock_error(). This
should work in general and avoid the odd sequence of a repeated connect
request returning success when the socket is already connected.
This is all a side effect of the socket state being in a CONNECTING
state when we get EINPROGRESS, and only a re-connect or other related
operation will turn that into CONNECTED.
Cc: stable@vger.kernel.org
Fixes: 3fb1bd688172 ("io_uring/net: handle -EINPROGRESS correct for IORING_OP_CONNECT")
Link: https://github.com/axboe/liburing/issues/980
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2023-11-03 10:35:40 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-16 17:20:17 +01:00
|
|
|
|
|
|
|
|
|
io_uring/net: ensure socket is marked connected on connect retry
io_uring does non-blocking connection attempts, which can yield some
unexpected results if a connect request is re-attempted by an an
application. This is equivalent to the following sync syscall sequence:
sock = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP);
connect(sock, &addr, sizeof(addr);
ret == -1 and errno == EINPROGRESS expected here. Now poll for POLLOUT
on sock, and when that returns, we expect the socket to be connected.
But if we follow that procedure with:
connect(sock, &addr, sizeof(addr));
you'd expect ret == -1 and errno == EISCONN here, but you actually get
ret == 0. If we attempt the connection one more time, then we get EISCON
as expected.
io_uring used to do this, but turns out that bluetooth fails with EBADFD
if you attempt to re-connect. Also looks like EISCONN _could_ occur with
this sequence.
Retain the ->in_progress logic, but work-around a potential EISCONN or
EBADFD error and only in those cases look at the sock_error(). This
should work in general and avoid the odd sequence of a repeated connect
request returning success when the socket is already connected.
This is all a side effect of the socket state being in a CONNECTING
state when we get EINPROGRESS, and only a re-connect or other related
operation will turn that into CONNECTED.
Cc: stable@vger.kernel.org
Fixes: 3fb1bd688172 ("io_uring/net: handle -EINPROGRESS correct for IORING_OP_CONNECT")
Link: https://github.com/axboe/liburing/issues/980
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2023-11-03 10:35:40 -06:00
|
|
|
|
2025-07-16 17:20:17 +01:00
|
|
|
|
io_uring/net: ensure socket is marked connected on connect retry
io_uring does non-blocking connection attempts, which can yield some
unexpected results if a connect request is re-attempted by an an
application. This is equivalent to the following sync syscall sequence:
sock = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP);
connect(sock, &addr, sizeof(addr);
ret == -1 and errno == EINPROGRESS expected here. Now poll for POLLOUT
on sock, and when that returns, we expect the socket to be connected.
But if we follow that procedure with:
connect(sock, &addr, sizeof(addr));
you'd expect ret == -1 and errno == EISCONN here, but you actually get
ret == 0. If we attempt the connection one more time, then we get EISCON
as expected.
io_uring used to do this, but turns out that bluetooth fails with EBADFD
if you attempt to re-connect. Also looks like EISCONN _could_ occur with
this sequence.
Retain the ->in_progress logic, but work-around a potential EISCONN or
EBADFD error and only in those cases look at the sock_error(). This
should work in general and avoid the odd sequence of a repeated connect
request returning success when the socket is already connected.
This is all a side effect of the socket state being in a CONNECTING
state when we get EINPROGRESS, and only a re-connect or other related
operation will turn that into CONNECTED.
Cc: stable@vger.kernel.org
Fixes: 3fb1bd688172 ("io_uring/net: handle -EINPROGRESS correct for IORING_OP_CONNECT")
Link: https://github.com/axboe/liburing/issues/980
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2023-11-03 10:35:40 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 14:48:33 -06:00
|
|
|
|
2022-05-25 06:25:13 -06:00
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|
2026-05-15 10:19:09 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for-7.2/io_uring-20260615
-----BEGIN PGP SIGNATURE-----
iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmowCCYQHGF4Ym9lQGtl
cm5lbC5kawAKCRD301j7KXHgprbuEACf4MxZZvzd1Be5Fneo4ghy0IjJ0s8j67yo
hERtfO0TPCFPvFi+cWmSQo/YTIhi62Z1nFro3Cr9opTF38NypbN2kB642KOaQPse
f1LVQDg1p5MIj2bMGgBQsYeLlGipRwm/vLN7qX+Dfv6jL4Yq7KuIEtxkBr2UJefY
FUEhW5xm45DgRriyZSn+Gn39yLB4XGL8pEntqrSMlrTw3fI8ZzyIw5w6e8Kgn/ES
upVo8oxnrUSlPrGrfH2Eu42sFixWko9QULwASNgXsIT3yBRZbYYyBjXmWAQGER6k
D3Nn5Zt/UogyMg6BLb/S2dgCnFn2VPKPD8l//4IPQrAAhPdtWpxaTjQUXq0c2w4M
IaGD1EQDYw/VBc6jjRPAuqwEmKZmTXZirfXamvF4Y2MtSz0b84LulaeqqwGvmtUT
Z2pOaIZBffJ1E//B4FpiG1xuwHpchc3F6esP7FyhyRlWGP93WR3ADo2em7/jKxEi
IOFjXHAOO70C1wpdOgAxToRggc4GV16RAx+v4/GFRUI1m6okuxiwTxle6Ig+H4eR
zFXBvroz7PDDaiqbyGk5kIQfOVhwmPnp9EZUUJIf4h9lIPgwJAjb4yLwcF8ySXyg
x8C+Vp4DP1r0xccZLkkElIzOmmeR4bUaBeyFY33pT83WchnU1NxusBpEVpRL1FPf
YR8Icz8F1A==
=pkmg
-----END PGP SIGNATURE-----
Merge tag 'for-7.2/io_uring-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull io_uring updates from Jens Axboe:
- Rework the task_work infrastructure.
Both the local (DEFER_TASKRUN) and the normal (tctx) task_work lists
were llist based, which is LIFO ordered, and hence each run had to do
an O(n) list reversal pass first to restore queue order.
Additionally, to cap the amount of task_work run, each method needed
a retry list as well.
Add a lockless MPCS FIFO queue (based on Dmitry Vyukov's intrusive
MPSC algorithm) and switch both task_work lists to it. It performs
better than llists and we can then also ditch the retry lists as well
as entries are popped one-at-the-time.
On top of those changes, run the tctx fallback task_work directly and
remove the now-unused per-ctx fallback machinery entirely.
- zcrx user notifications.
Add a mechanism for zcrx to communicate conditions back to userspace
via a dedicated CQE, with the initial users being notification on
running out of buffers and on a frag copy fallback, plus
shared-memory notification statistics.
Alongside that, a series of zcrx reliability and cleanup fixes: more
reliable scrubbing, poisoning pointers on unregistration, dropping an
extra ifq close, adding a ctx back-pointer, reordering fd allocation
in the export path, and killing a dead 'sock' member.
- Allow using io_uring registered buffers for plain SEND and RECV, not
just for the zero-copy send path.
This enables targets like ublk's NBD backend to push/pull IO data
directly to/from a registered buffer over a plain send/recv on a TCP
socket.
- Registered buffer improvements: account huge pages correctly, bump
the io_mapped_ubuf length field to size_t, and raise the previous 1GB
registered buffer size limit.
- Restrict the ctx access exposed to io_uring BPF struct_ops programs
by handing them an opaque type rather than the full io_ring_ctx, and
add a separate MAINTAINERS entry for the bpf-ops code.
- Allow opcode filtering on IORING_OP_CONNECT.
- Validate ring-provided buffer addresses with access_ok(), and align
the legacy buffer add limit with MAX_BIDS_PER_BGID.
- Various other cleanups and minor fixes, including avoiding msghdr
async data on connect/bind, dropping async_size for OP_LISTEN, making
the POLL_FIRST receive side checks consistent, re-checking
IO_WQ_BIT_EXIT for each linked work item, and using
trace_call__##name() at guarded tracepoint call sites.
* tag 'for-7.2/io_uring-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (31 commits)
io_uring/bpf-ops: add a separate maintainer entry
io_uring/net: make POLL_FIRST receive side checks consistent
io_uring: remove the per-ctx fallback task_work machinery
io_uring: run the tctx task_work fallback directly
io_uring: switch normal task_work to a mpscq
io_uring: switch local task_work to a mpscq
io_uring/mpscq: add lockless multi-producer, single-consumer FIFO queue
io_uring: grab RCU read lock marking task run
io_uring/zcrx: kill dead 'sock' member in struct io_zcrx_args
io_uring/kbuf: validate ring provided buffer addresses with access_ok()
io_uring/net: support registered buffer for plain send and recv
io_uring/nop: Drop a wrong comment in struct io_nop
io_uring/net: Remove async_size for OP_LISTEN
io_uring/net: Avoid msghdr on op_connect/op_bind async data
io_uring/bpf-ops: restrict ctx access to BPF
io_uring/io-wq: re-check IO_WQ_BIT_EXIT for each linked work item
io_uring/kbuf: align legacy buffer add limit with MAX_BIDS_PER_BGID
io_uring/zcrx: add shared-memory notification statistics
io_uring/zcrx: notify user on frag copy fallback
io_uring/zcrx: notify user when out of buffers
...
2026-06-16 12:53:59 +05:30
|
|
|
|
2026-05-15 10:19:09 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for-7.2/io_uring-20260615
-----BEGIN PGP SIGNATURE-----
iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmowCCYQHGF4Ym9lQGtl
cm5lbC5kawAKCRD301j7KXHgprbuEACf4MxZZvzd1Be5Fneo4ghy0IjJ0s8j67yo
hERtfO0TPCFPvFi+cWmSQo/YTIhi62Z1nFro3Cr9opTF38NypbN2kB642KOaQPse
f1LVQDg1p5MIj2bMGgBQsYeLlGipRwm/vLN7qX+Dfv6jL4Yq7KuIEtxkBr2UJefY
FUEhW5xm45DgRriyZSn+Gn39yLB4XGL8pEntqrSMlrTw3fI8ZzyIw5w6e8Kgn/ES
upVo8oxnrUSlPrGrfH2Eu42sFixWko9QULwASNgXsIT3yBRZbYYyBjXmWAQGER6k
D3Nn5Zt/UogyMg6BLb/S2dgCnFn2VPKPD8l//4IPQrAAhPdtWpxaTjQUXq0c2w4M
IaGD1EQDYw/VBc6jjRPAuqwEmKZmTXZirfXamvF4Y2MtSz0b84LulaeqqwGvmtUT
Z2pOaIZBffJ1E//B4FpiG1xuwHpchc3F6esP7FyhyRlWGP93WR3ADo2em7/jKxEi
IOFjXHAOO70C1wpdOgAxToRggc4GV16RAx+v4/GFRUI1m6okuxiwTxle6Ig+H4eR
zFXBvroz7PDDaiqbyGk5kIQfOVhwmPnp9EZUUJIf4h9lIPgwJAjb4yLwcF8ySXyg
x8C+Vp4DP1r0xccZLkkElIzOmmeR4bUaBeyFY33pT83WchnU1NxusBpEVpRL1FPf
YR8Icz8F1A==
=pkmg
-----END PGP SIGNATURE-----
Merge tag 'for-7.2/io_uring-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull io_uring updates from Jens Axboe:
- Rework the task_work infrastructure.
Both the local (DEFER_TASKRUN) and the normal (tctx) task_work lists
were llist based, which is LIFO ordered, and hence each run had to do
an O(n) list reversal pass first to restore queue order.
Additionally, to cap the amount of task_work run, each method needed
a retry list as well.
Add a lockless MPCS FIFO queue (based on Dmitry Vyukov's intrusive
MPSC algorithm) and switch both task_work lists to it. It performs
better than llists and we can then also ditch the retry lists as well
as entries are popped one-at-the-time.
On top of those changes, run the tctx fallback task_work directly and
remove the now-unused per-ctx fallback machinery entirely.
- zcrx user notifications.
Add a mechanism for zcrx to communicate conditions back to userspace
via a dedicated CQE, with the initial users being notification on
running out of buffers and on a frag copy fallback, plus
shared-memory notification statistics.
Alongside that, a series of zcrx reliability and cleanup fixes: more
reliable scrubbing, poisoning pointers on unregistration, dropping an
extra ifq close, adding a ctx back-pointer, reordering fd allocation
in the export path, and killing a dead 'sock' member.
- Allow using io_uring registered buffers for plain SEND and RECV, not
just for the zero-copy send path.
This enables targets like ublk's NBD backend to push/pull IO data
directly to/from a registered buffer over a plain send/recv on a TCP
socket.
- Registered buffer improvements: account huge pages correctly, bump
the io_mapped_ubuf length field to size_t, and raise the previous 1GB
registered buffer size limit.
- Restrict the ctx access exposed to io_uring BPF struct_ops programs
by handing them an opaque type rather than the full io_ring_ctx, and
add a separate MAINTAINERS entry for the bpf-ops code.
- Allow opcode filtering on IORING_OP_CONNECT.
- Validate ring-provided buffer addresses with access_ok(), and align
the legacy buffer add limit with MAX_BIDS_PER_BGID.
- Various other cleanups and minor fixes, including avoiding msghdr
async data on connect/bind, dropping async_size for OP_LISTEN, making
the POLL_FIRST receive side checks consistent, re-checking
IO_WQ_BIT_EXIT for each linked work item, and using
trace_call__##name() at guarded tracepoint call sites.
* tag 'for-7.2/io_uring-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (31 commits)
io_uring/bpf-ops: add a separate maintainer entry
io_uring/net: make POLL_FIRST receive side checks consistent
io_uring: remove the per-ctx fallback task_work machinery
io_uring: run the tctx task_work fallback directly
io_uring: switch normal task_work to a mpscq
io_uring: switch local task_work to a mpscq
io_uring/mpscq: add lockless multi-producer, single-consumer FIFO queue
io_uring: grab RCU read lock marking task run
io_uring/zcrx: kill dead 'sock' member in struct io_zcrx_args
io_uring/kbuf: validate ring provided buffer addresses with access_ok()
io_uring/net: support registered buffer for plain send and recv
io_uring/nop: Drop a wrong comment in struct io_nop
io_uring/net: Remove async_size for OP_LISTEN
io_uring/net: Avoid msghdr on op_connect/op_bind async data
io_uring/bpf-ops: restrict ctx access to BPF
io_uring/io-wq: re-check IO_WQ_BIT_EXIT for each linked work item
io_uring/kbuf: align legacy buffer add limit with MAX_BIDS_PER_BGID
io_uring/zcrx: add shared-memory notification statistics
io_uring/zcrx: notify user on frag copy fallback
io_uring/zcrx: notify user when out of buffers
...
2026-06-16 12:53:59 +05:30
|
|
|
|
2026-05-15 10:19:09 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for-7.2/io_uring-20260615
-----BEGIN PGP SIGNATURE-----
iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmowCCYQHGF4Ym9lQGtl
cm5lbC5kawAKCRD301j7KXHgprbuEACf4MxZZvzd1Be5Fneo4ghy0IjJ0s8j67yo
hERtfO0TPCFPvFi+cWmSQo/YTIhi62Z1nFro3Cr9opTF38NypbN2kB642KOaQPse
f1LVQDg1p5MIj2bMGgBQsYeLlGipRwm/vLN7qX+Dfv6jL4Yq7KuIEtxkBr2UJefY
FUEhW5xm45DgRriyZSn+Gn39yLB4XGL8pEntqrSMlrTw3fI8ZzyIw5w6e8Kgn/ES
upVo8oxnrUSlPrGrfH2Eu42sFixWko9QULwASNgXsIT3yBRZbYYyBjXmWAQGER6k
D3Nn5Zt/UogyMg6BLb/S2dgCnFn2VPKPD8l//4IPQrAAhPdtWpxaTjQUXq0c2w4M
IaGD1EQDYw/VBc6jjRPAuqwEmKZmTXZirfXamvF4Y2MtSz0b84LulaeqqwGvmtUT
Z2pOaIZBffJ1E//B4FpiG1xuwHpchc3F6esP7FyhyRlWGP93WR3ADo2em7/jKxEi
IOFjXHAOO70C1wpdOgAxToRggc4GV16RAx+v4/GFRUI1m6okuxiwTxle6Ig+H4eR
zFXBvroz7PDDaiqbyGk5kIQfOVhwmPnp9EZUUJIf4h9lIPgwJAjb4yLwcF8ySXyg
x8C+Vp4DP1r0xccZLkkElIzOmmeR4bUaBeyFY33pT83WchnU1NxusBpEVpRL1FPf
YR8Icz8F1A==
=pkmg
-----END PGP SIGNATURE-----
Merge tag 'for-7.2/io_uring-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull io_uring updates from Jens Axboe:
- Rework the task_work infrastructure.
Both the local (DEFER_TASKRUN) and the normal (tctx) task_work lists
were llist based, which is LIFO ordered, and hence each run had to do
an O(n) list reversal pass first to restore queue order.
Additionally, to cap the amount of task_work run, each method needed
a retry list as well.
Add a lockless MPCS FIFO queue (based on Dmitry Vyukov's intrusive
MPSC algorithm) and switch both task_work lists to it. It performs
better than llists and we can then also ditch the retry lists as well
as entries are popped one-at-the-time.
On top of those changes, run the tctx fallback task_work directly and
remove the now-unused per-ctx fallback machinery entirely.
- zcrx user notifications.
Add a mechanism for zcrx to communicate conditions back to userspace
via a dedicated CQE, with the initial users being notification on
running out of buffers and on a frag copy fallback, plus
shared-memory notification statistics.
Alongside that, a series of zcrx reliability and cleanup fixes: more
reliable scrubbing, poisoning pointers on unregistration, dropping an
extra ifq close, adding a ctx back-pointer, reordering fd allocation
in the export path, and killing a dead 'sock' member.
- Allow using io_uring registered buffers for plain SEND and RECV, not
just for the zero-copy send path.
This enables targets like ublk's NBD backend to push/pull IO data
directly to/from a registered buffer over a plain send/recv on a TCP
socket.
- Registered buffer improvements: account huge pages correctly, bump
the io_mapped_ubuf length field to size_t, and raise the previous 1GB
registered buffer size limit.
- Restrict the ctx access exposed to io_uring BPF struct_ops programs
by handing them an opaque type rather than the full io_ring_ctx, and
add a separate MAINTAINERS entry for the bpf-ops code.
- Allow opcode filtering on IORING_OP_CONNECT.
- Validate ring-provided buffer addresses with access_ok(), and align
the legacy buffer add limit with MAX_BIDS_PER_BGID.
- Various other cleanups and minor fixes, including avoiding msghdr
async data on connect/bind, dropping async_size for OP_LISTEN, making
the POLL_FIRST receive side checks consistent, re-checking
IO_WQ_BIT_EXIT for each linked work item, and using
trace_call__##name() at guarded tracepoint call sites.
* tag 'for-7.2/io_uring-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (31 commits)
io_uring/bpf-ops: add a separate maintainer entry
io_uring/net: make POLL_FIRST receive side checks consistent
io_uring: remove the per-ctx fallback task_work machinery
io_uring: run the tctx task_work fallback directly
io_uring: switch normal task_work to a mpscq
io_uring: switch local task_work to a mpscq
io_uring/mpscq: add lockless multi-producer, single-consumer FIFO queue
io_uring: grab RCU read lock marking task run
io_uring/zcrx: kill dead 'sock' member in struct io_zcrx_args
io_uring/kbuf: validate ring provided buffer addresses with access_ok()
io_uring/net: support registered buffer for plain send and recv
io_uring/nop: Drop a wrong comment in struct io_nop
io_uring/net: Remove async_size for OP_LISTEN
io_uring/net: Avoid msghdr on op_connect/op_bind async data
io_uring/bpf-ops: restrict ctx access to BPF
io_uring/io-wq: re-check IO_WQ_BIT_EXIT for each linked work item
io_uring/kbuf: align legacy buffer add limit with MAX_BIDS_PER_BGID
io_uring/zcrx: add shared-memory notification statistics
io_uring/zcrx: notify user on frag copy fallback
io_uring/zcrx: notify user when out of buffers
...
2026-06-16 12:53:59 +05:30
|
|
|
|
2026-05-15 10:19:09 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-14 12:30:46 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-02 17:53:24 -04:00
|
|
|
|
2026-05-15 10:19:09 -06:00
|
|
|
|
2024-06-14 12:30:46 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-02 17:53:24 -04:00
|
|
|
|
|
|
|
|
|
2024-06-14 12:30:46 -04:00
|
|
|
|
for-7.2/io_uring-20260615
-----BEGIN PGP SIGNATURE-----
iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmowCCYQHGF4Ym9lQGtl
cm5lbC5kawAKCRD301j7KXHgprbuEACf4MxZZvzd1Be5Fneo4ghy0IjJ0s8j67yo
hERtfO0TPCFPvFi+cWmSQo/YTIhi62Z1nFro3Cr9opTF38NypbN2kB642KOaQPse
f1LVQDg1p5MIj2bMGgBQsYeLlGipRwm/vLN7qX+Dfv6jL4Yq7KuIEtxkBr2UJefY
FUEhW5xm45DgRriyZSn+Gn39yLB4XGL8pEntqrSMlrTw3fI8ZzyIw5w6e8Kgn/ES
upVo8oxnrUSlPrGrfH2Eu42sFixWko9QULwASNgXsIT3yBRZbYYyBjXmWAQGER6k
D3Nn5Zt/UogyMg6BLb/S2dgCnFn2VPKPD8l//4IPQrAAhPdtWpxaTjQUXq0c2w4M
IaGD1EQDYw/VBc6jjRPAuqwEmKZmTXZirfXamvF4Y2MtSz0b84LulaeqqwGvmtUT
Z2pOaIZBffJ1E//B4FpiG1xuwHpchc3F6esP7FyhyRlWGP93WR3ADo2em7/jKxEi
IOFjXHAOO70C1wpdOgAxToRggc4GV16RAx+v4/GFRUI1m6okuxiwTxle6Ig+H4eR
zFXBvroz7PDDaiqbyGk5kIQfOVhwmPnp9EZUUJIf4h9lIPgwJAjb4yLwcF8ySXyg
x8C+Vp4DP1r0xccZLkkElIzOmmeR4bUaBeyFY33pT83WchnU1NxusBpEVpRL1FPf
YR8Icz8F1A==
=pkmg
-----END PGP SIGNATURE-----
Merge tag 'for-7.2/io_uring-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull io_uring updates from Jens Axboe:
- Rework the task_work infrastructure.
Both the local (DEFER_TASKRUN) and the normal (tctx) task_work lists
were llist based, which is LIFO ordered, and hence each run had to do
an O(n) list reversal pass first to restore queue order.
Additionally, to cap the amount of task_work run, each method needed
a retry list as well.
Add a lockless MPCS FIFO queue (based on Dmitry Vyukov's intrusive
MPSC algorithm) and switch both task_work lists to it. It performs
better than llists and we can then also ditch the retry lists as well
as entries are popped one-at-the-time.
On top of those changes, run the tctx fallback task_work directly and
remove the now-unused per-ctx fallback machinery entirely.
- zcrx user notifications.
Add a mechanism for zcrx to communicate conditions back to userspace
via a dedicated CQE, with the initial users being notification on
running out of buffers and on a frag copy fallback, plus
shared-memory notification statistics.
Alongside that, a series of zcrx reliability and cleanup fixes: more
reliable scrubbing, poisoning pointers on unregistration, dropping an
extra ifq close, adding a ctx back-pointer, reordering fd allocation
in the export path, and killing a dead 'sock' member.
- Allow using io_uring registered buffers for plain SEND and RECV, not
just for the zero-copy send path.
This enables targets like ublk's NBD backend to push/pull IO data
directly to/from a registered buffer over a plain send/recv on a TCP
socket.
- Registered buffer improvements: account huge pages correctly, bump
the io_mapped_ubuf length field to size_t, and raise the previous 1GB
registered buffer size limit.
- Restrict the ctx access exposed to io_uring BPF struct_ops programs
by handing them an opaque type rather than the full io_ring_ctx, and
add a separate MAINTAINERS entry for the bpf-ops code.
- Allow opcode filtering on IORING_OP_CONNECT.
- Validate ring-provided buffer addresses with access_ok(), and align
the legacy buffer add limit with MAX_BIDS_PER_BGID.
- Various other cleanups and minor fixes, including avoiding msghdr
async data on connect/bind, dropping async_size for OP_LISTEN, making
the POLL_FIRST receive side checks consistent, re-checking
IO_WQ_BIT_EXIT for each linked work item, and using
trace_call__##name() at guarded tracepoint call sites.
* tag 'for-7.2/io_uring-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (31 commits)
io_uring/bpf-ops: add a separate maintainer entry
io_uring/net: make POLL_FIRST receive side checks consistent
io_uring: remove the per-ctx fallback task_work machinery
io_uring: run the tctx task_work fallback directly
io_uring: switch normal task_work to a mpscq
io_uring: switch local task_work to a mpscq
io_uring/mpscq: add lockless multi-producer, single-consumer FIFO queue
io_uring: grab RCU read lock marking task run
io_uring/zcrx: kill dead 'sock' member in struct io_zcrx_args
io_uring/kbuf: validate ring provided buffer addresses with access_ok()
io_uring/net: support registered buffer for plain send and recv
io_uring/nop: Drop a wrong comment in struct io_nop
io_uring/net: Remove async_size for OP_LISTEN
io_uring/net: Avoid msghdr on op_connect/op_bind async data
io_uring/bpf-ops: restrict ctx access to BPF
io_uring/io-wq: re-check IO_WQ_BIT_EXIT for each linked work item
io_uring/kbuf: align legacy buffer add limit with MAX_BIDS_PER_BGID
io_uring/zcrx: add shared-memory notification statistics
io_uring/zcrx: notify user on frag copy fallback
io_uring/zcrx: notify user when out of buffers
...
2026-06-16 12:53:59 +05:30
|
|
|
|
2026-05-15 10:19:09 -06:00
|
|
|
|
|
|
|
|
|
for-7.2/io_uring-20260615
-----BEGIN PGP SIGNATURE-----
iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmowCCYQHGF4Ym9lQGtl
cm5lbC5kawAKCRD301j7KXHgprbuEACf4MxZZvzd1Be5Fneo4ghy0IjJ0s8j67yo
hERtfO0TPCFPvFi+cWmSQo/YTIhi62Z1nFro3Cr9opTF38NypbN2kB642KOaQPse
f1LVQDg1p5MIj2bMGgBQsYeLlGipRwm/vLN7qX+Dfv6jL4Yq7KuIEtxkBr2UJefY
FUEhW5xm45DgRriyZSn+Gn39yLB4XGL8pEntqrSMlrTw3fI8ZzyIw5w6e8Kgn/ES
upVo8oxnrUSlPrGrfH2Eu42sFixWko9QULwASNgXsIT3yBRZbYYyBjXmWAQGER6k
D3Nn5Zt/UogyMg6BLb/S2dgCnFn2VPKPD8l//4IPQrAAhPdtWpxaTjQUXq0c2w4M
IaGD1EQDYw/VBc6jjRPAuqwEmKZmTXZirfXamvF4Y2MtSz0b84LulaeqqwGvmtUT
Z2pOaIZBffJ1E//B4FpiG1xuwHpchc3F6esP7FyhyRlWGP93WR3ADo2em7/jKxEi
IOFjXHAOO70C1wpdOgAxToRggc4GV16RAx+v4/GFRUI1m6okuxiwTxle6Ig+H4eR
zFXBvroz7PDDaiqbyGk5kIQfOVhwmPnp9EZUUJIf4h9lIPgwJAjb4yLwcF8ySXyg
x8C+Vp4DP1r0xccZLkkElIzOmmeR4bUaBeyFY33pT83WchnU1NxusBpEVpRL1FPf
YR8Icz8F1A==
=pkmg
-----END PGP SIGNATURE-----
Merge tag 'for-7.2/io_uring-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull io_uring updates from Jens Axboe:
- Rework the task_work infrastructure.
Both the local (DEFER_TASKRUN) and the normal (tctx) task_work lists
were llist based, which is LIFO ordered, and hence each run had to do
an O(n) list reversal pass first to restore queue order.
Additionally, to cap the amount of task_work run, each method needed
a retry list as well.
Add a lockless MPCS FIFO queue (based on Dmitry Vyukov's intrusive
MPSC algorithm) and switch both task_work lists to it. It performs
better than llists and we can then also ditch the retry lists as well
as entries are popped one-at-the-time.
On top of those changes, run the tctx fallback task_work directly and
remove the now-unused per-ctx fallback machinery entirely.
- zcrx user notifications.
Add a mechanism for zcrx to communicate conditions back to userspace
via a dedicated CQE, with the initial users being notification on
running out of buffers and on a frag copy fallback, plus
shared-memory notification statistics.
Alongside that, a series of zcrx reliability and cleanup fixes: more
reliable scrubbing, poisoning pointers on unregistration, dropping an
extra ifq close, adding a ctx back-pointer, reordering fd allocation
in the export path, and killing a dead 'sock' member.
- Allow using io_uring registered buffers for plain SEND and RECV, not
just for the zero-copy send path.
This enables targets like ublk's NBD backend to push/pull IO data
directly to/from a registered buffer over a plain send/recv on a TCP
socket.
- Registered buffer improvements: account huge pages correctly, bump
the io_mapped_ubuf length field to size_t, and raise the previous 1GB
registered buffer size limit.
- Restrict the ctx access exposed to io_uring BPF struct_ops programs
by handing them an opaque type rather than the full io_ring_ctx, and
add a separate MAINTAINERS entry for the bpf-ops code.
- Allow opcode filtering on IORING_OP_CONNECT.
- Validate ring-provided buffer addresses with access_ok(), and align
the legacy buffer add limit with MAX_BIDS_PER_BGID.
- Various other cleanups and minor fixes, including avoiding msghdr
async data on connect/bind, dropping async_size for OP_LISTEN, making
the POLL_FIRST receive side checks consistent, re-checking
IO_WQ_BIT_EXIT for each linked work item, and using
trace_call__##name() at guarded tracepoint call sites.
* tag 'for-7.2/io_uring-20260615' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (31 commits)
io_uring/bpf-ops: add a separate maintainer entry
io_uring/net: make POLL_FIRST receive side checks consistent
io_uring: remove the per-ctx fallback task_work machinery
io_uring: run the tctx task_work fallback directly
io_uring: switch normal task_work to a mpscq
io_uring: switch local task_work to a mpscq
io_uring/mpscq: add lockless multi-producer, single-consumer FIFO queue
io_uring: grab RCU read lock marking task run
io_uring/zcrx: kill dead 'sock' member in struct io_zcrx_args
io_uring/kbuf: validate ring provided buffer addresses with access_ok()
io_uring/net: support registered buffer for plain send and recv
io_uring/nop: Drop a wrong comment in struct io_nop
io_uring/net: Remove async_size for OP_LISTEN
io_uring/net: Avoid msghdr on op_connect/op_bind async data
io_uring/bpf-ops: restrict ctx access to BPF
io_uring/io-wq: re-check IO_WQ_BIT_EXIT for each linked work item
io_uring/kbuf: align legacy buffer add limit with MAX_BIDS_PER_BGID
io_uring/zcrx: add shared-memory notification statistics
io_uring/zcrx: notify user on frag copy fallback
io_uring/zcrx: notify user when out of buffers
...
2026-06-16 12:53:59 +05:30
|
|
|
|
2026-05-15 10:19:09 -06:00
|
|
|
|
|
|
|
|
|
2024-06-14 12:30:46 -04:00
|
|
|
|
|
|
|
|
|
2026-06-02 17:53:24 -04:00
|
|
|
|
2024-06-14 12:30:46 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-02 17:53:24 -04:00
|
|
|
|
2024-07-13 19:05:02 +09:00
|
|
|
|
2024-06-14 12:30:46 -04:00
|
|
|
|
|
|
|
|
|
2024-07-13 19:05:02 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-02 17:53:24 -04:00
|
|
|
|
2024-06-14 12:30:46 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-14 12:30:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-07-13 19:05:02 +09:00
|
|
|
|
2024-06-14 12:30:47 -04:00
|
|
|
|
|
|
|
|
|
2024-07-13 19:05:02 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-06-14 12:30:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-20 15:19:44 -06:00
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|
2024-03-20 15:19:44 -06:00
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
2025-03-07 16:00:35 +00:00
|
|
|
|
2024-03-16 15:33:53 -06:00
|
|
|
|
2022-07-07 14:30:09 -06:00
|
|
|
|