2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-12-01 00:57:35 +00:00
|
|
|
|
2024-02-12 15:42:36 -08:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-09-04 11:08:58 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-20 15:19:44 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
io_uring/rw: ensure poll based multishot read retries appropriately
io_read_mshot() always relies on poll triggering retries, and this works
fine as long as we do a retry per size of the buffer being read. The
buffer size is given by the size of the buffer(s) in the given buffer
group ID.
But if we're reading less than what is available, then we don't always
get to read everything that is available. For example, if the buffers
available are 32 bytes and we have 64 bytes to read, then we'll
correctly read the first 32 bytes and then wait for another poll trigger
before we attempt the next read. This next poll trigger may never
happen, in which case we just sit forever and never make progress, or it
may trigger at some point in the future, and now we're just delivering
the available data much later than we should have.
io_read_mshot() could do retries itself, but that is wasteful as we'll
be going through all of __io_read() again, and most likely in vain.
Rather than do that, bump our poll reference count and have
io_poll_check_events() do one more loop and check with vfs_poll() if we
have more data to read. If we do, io_read_mshot() will get invoked again
directly and we'll read the next chunk.
io_poll_multishot_retry() must only get called from inside
io_poll_issue(), which is our multishot retry handler, as we know we
already "own" the request at this point.
Cc: stable@vger.kernel.org
Link: https://github.com/axboe/liburing/issues/1041
Fixes: fc68fcda0491 ("io_uring/rw: add support for IORING_OP_READ_MULTISHOT")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-01-27 13:44:58 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2025-02-19 01:33:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-06 10:40:36 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2024-10-06 10:40:36 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2022-09-07 09:51:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-08-12 20:40:20 -04:00
|
|
|
|
2022-09-07 09:51:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-08-12 20:40:20 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-07 09:51:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-24 19:45:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2025-02-24 19:45:05 +00:00
|
|
|
|
2024-03-18 16:31:44 -06:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2025-03-07 16:00:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:31:44 -06:00
|
|
|
|
|
|
|
|
|
2025-02-24 19:45:05 +00:00
|
|
|
|
2024-03-18 16:31:44 -06:00
|
|
|
|
2025-02-24 19:45:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:31:44 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:29 +00:00
|
|
|
|
2024-03-18 16:31:44 -06:00
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
2025-02-24 19:45:05 +00:00
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
|
|
|
|
|
2025-02-24 19:45:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2025-02-24 19:45:05 +00:00
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2025-02-24 19:45:05 +00:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
|
|
|
|
|
2025-02-24 19:45:05 +00:00
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2025-02-24 19:45:05 +00:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2025-02-24 19:45:05 +00:00
|
|
|
|
|
|
|
|
|
2025-02-24 19:45:04 +00:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2025-02-24 19:45:04 +00:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-18 19:48:01 -07:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-28 20:56:16 +00:00
|
|
|
|
2026-01-18 19:48:01 -07:00
|
|
|
|
2025-01-28 20:56:16 +00:00
|
|
|
|
2025-03-07 16:00:29 +00:00
|
|
|
|
2025-03-07 16:00:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-18 19:48:01 -07:00
|
|
|
|
2025-08-22 08:19:56 -06:00
|
|
|
|
2026-01-18 19:48:01 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-04 21:01:09 -08:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2025-01-07 10:59:35 -07:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2026-01-18 19:48:01 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-22 20:00:57 -07:00
|
|
|
|
2024-12-16 15:46:13 -05:00
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:29 +00:00
|
|
|
|
2024-12-16 15:46:13 -05:00
|
|
|
|
2024-12-27 09:49:32 -07:00
|
|
|
|
2024-12-16 15:46:13 -05:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-05-13 17:43:03 +08:00
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
2024-12-17 07:44:25 -07:00
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:11 -08:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2025-03-31 17:18:01 +01:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2025-02-24 19:45:03 +00:00
|
|
|
|
|
|
|
|
|
2025-03-31 17:18:01 +01:00
|
|
|
|
2025-02-24 19:45:03 +00:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-31 17:18:01 +01:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
2025-05-06 17:47:27 +05:30
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2025-02-19 01:33:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2025-07-07 16:46:30 -06:00
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-05-13 17:43:03 +08:00
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
2025-02-24 19:45:06 +00:00
|
|
|
|
2023-11-06 07:41:17 -07:00
|
|
|
|
2022-09-07 09:51:52 -07:00
|
|
|
|
2025-02-27 14:39:11 -08:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:11 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2025-02-27 14:39:11 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-06 07:41:17 -07:00
|
|
|
|
2022-09-07 09:51:52 -07:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2023-11-06 07:41:17 -07:00
|
|
|
|
2025-02-27 14:39:11 -08:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:11 -08:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-06 07:41:17 -07:00
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:11 -08:00
|
|
|
|
2023-11-06 07:41:17 -07:00
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:11 -08:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2023-11-06 07:41:17 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-04 21:01:09 -08:00
|
|
|
|
2022-09-07 09:51:52 -07:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2023-11-06 07:43:16 -07:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:12 -08:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:12 -08:00
|
|
|
|
2023-11-06 07:43:16 -07:00
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:12 -08:00
|
|
|
|
|
|
|
|
|
2023-11-06 07:43:16 -07:00
|
|
|
|
2025-02-27 14:39:12 -08:00
|
|
|
|
|
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:12 -08:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:12 -08:00
|
|
|
|
2023-11-06 07:43:16 -07:00
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-08 18:21:16 +00:00
|
|
|
|
2025-03-07 16:00:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-08 18:21:15 +00:00
|
|
|
|
2025-03-07 16:00:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:32 +00:00
|
|
|
|
2025-03-07 16:00:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:32 +00:00
|
|
|
|
2025-03-07 16:00:31 +00:00
|
|
|
|
|
|
|
|
|
2023-09-11 13:35:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-06 20:39:08 +00:00
|
|
|
|
2023-09-11 13:35:42 -06:00
|
|
|
|
|
|
|
|
|
2023-11-03 09:26:13 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:11 -08:00
|
|
|
|
2023-09-11 13:35:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-06 20:39:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-11 13:35:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2025-11-10 14:30:41 -07:00
|
|
|
|
|
|
|
|
|
2025-01-07 09:52:54 -07:00
|
|
|
|
2025-11-10 14:30:41 -07:00
|
|
|
|
2025-01-07 09:52:54 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-07 10:59:35 -07:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2025-01-07 10:59:35 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-02 10:29:10 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-07 10:59:35 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-07 10:59:35 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2023-08-17 17:13:31 +03:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2023-08-17 17:13:34 +03:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2023-08-17 17:13:34 +03:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-09-08 17:53:20 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-11 09:06:23 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-09-08 17:53:20 -06:00
|
|
|
|
2023-08-17 17:13:31 +03:00
|
|
|
|
2026-09-08 17:53:20 -06:00
|
|
|
|
2022-10-11 09:06:23 -06:00
|
|
|
|
|
|
|
|
|
2025-01-07 10:59:35 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2025-01-07 10:59:35 -07:00
|
|
|
|
|
|
|
|
|
2025-10-13 12:05:31 -06:00
|
|
|
|
2025-01-07 10:59:35 -07:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-13 13:21:23 +01:00
|
|
|
|
2022-09-09 12:11:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-31 14:34:29 -06:00
|
|
|
|
2022-09-29 10:57:05 -06:00
|
|
|
|
2025-10-31 14:34:29 -06:00
|
|
|
|
2023-07-08 10:03:52 -06:00
|
|
|
|
2026-09-08 17:53:20 -06:00
|
|
|
|
2022-11-04 10:59:40 +00:00
|
|
|
|
2024-03-18 22:00:30 +00:00
|
|
|
|
2026-04-20 13:16:19 -06:00
|
|
|
|
2022-11-04 10:59:40 +00:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2025-10-31 14:34:29 -06:00
|
|
|
|
2022-09-29 10:57:05 -06:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-09-08 17:53:20 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-13 18:06:26 +01:00
|
|
|
|
|
|
|
|
|
2022-09-29 10:57:05 -06:00
|
|
|
|
2023-04-06 14:20:12 +01:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-06-13 23:52:16 +01:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2023-08-17 17:13:31 +03:00
|
|
|
|
2026-06-13 23:52:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-07-22 20:45:51 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-19 01:33:38 +00:00
|
|
|
|
2024-01-10 10:05:32 -07:00
|
|
|
|
2025-02-19 01:33:38 +00:00
|
|
|
|
|
|
|
|
|
2024-01-10 10:05:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-07-22 20:45:51 +08:00
|
|
|
|
|
|
|
|
|
2024-01-10 10:05:32 -07:00
|
|
|
|
2026-03-02 10:29:10 -07:00
|
|
|
|
2025-02-19 01:33:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-10 10:05:32 -07:00
|
|
|
|
|
|
|
|
|
2022-06-16 10:21:57 +01: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-13 07:27:03 -06:00
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-09-09 12:11:49 +01:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2023-08-28 18:47:31 -04:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2026-03-02 10:29:10 -07:00
|
|
|
|
2025-10-15 13:38:53 -06:00
|
|
|
|
|
|
|
|
|
2025-01-07 10:59:35 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-15 13:38:53 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-07 10:59:35 -07:00
|
|
|
|
2025-05-08 14:48:33 -06:00
|
|
|
|
2022-06-16 10:21:57 +01:00
|
|
|
|
2025-02-19 01:33:38 +00:00
|
|
|
|
2022-06-16 10:21:57 +01:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2022-06-16 10:21:57 +01:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:14 -08:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-09 14:31:22 +00:00
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:14 -08:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-29 09:16:45 -06:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2023-01-05 11:07:32 -08:00
|
|
|
|
2023-03-29 09:16:45 -06:00
|
|
|
|
|
|
|
|
|
2023-01-05 11:07:32 -08:00
|
|
|
|
2023-03-29 09:16:45 -06:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2023-03-29 09:16:45 -06:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2023-03-29 09:16:45 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-29 09:16:45 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2024-12-17 07:44:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-28 13:27:24 +01:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-28 17:13:18 +02:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-16 14:22:18 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fs: Initial atomic write support
An atomic write is a write issued with torn-write protection, meaning
that for a power failure or any other hardware failure, all or none of the
data from the write will be stored, but never a mix of old and new data.
Userspace may add flag RWF_ATOMIC to pwritev2() to indicate that the
write is to be issued with torn-write prevention, according to special
alignment and length rules.
For any syscall interface utilizing struct iocb, add IOCB_ATOMIC for
iocb->ki_flags field to indicate the same.
A call to statx will give the relevant atomic write info for a file:
- atomic_write_unit_min
- atomic_write_unit_max
- atomic_write_segments_max
Both min and max values must be a power-of-2.
Applications can avail of atomic write feature by ensuring that the total
length of a write is a power-of-2 in size and also sized between
atomic_write_unit_min and atomic_write_unit_max, inclusive. Applications
must ensure that the write is at a naturally-aligned offset in the file
wrt the total write length. The value in atomic_write_segments_max
indicates the upper limit for IOV_ITER iovcnt.
Add file mode flag FMODE_CAN_ATOMIC_WRITE, so files which do not have the
flag set will have RWF_ATOMIC rejected and not just ignored.
Add a type argument to kiocb_set_rw_flags() to allows reads which have
RWF_ATOMIC set to be rejected.
Helper function generic_atomic_write_valid() can be used by FSes to verify
compliant writes. There we check for iov_iter type is for ubuf, which
implies iovcnt==1 for pwritev2(), which is an initial restriction for
atomic_write_segments_max. Initially the only user will be bdev file
operations write handler. We will rely on the block BIO submission path to
ensure write sizes are compliant for the bdev, so we don't need to check
atomic writes sizes yet.
Signed-off-by: Prasad Singamsetty <prasad.singamsetty@oracle.com>
jpg: merge into single patch and much rewrite
Acked-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20240620125359.2684798-4-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-06-20 12:53:52 +00:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-28 20:52:21 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2023-06-20 13:32:31 +02:00
|
|
|
|
2023-06-20 13:32:32 +02:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
iov_iter work, part 1 - isolated cleanups and optimizations.
One of the goals is to reduce the overhead of using ->read_iter()
and ->write_iter() instead of ->read()/->write(); new_sync_{read,write}()
has a surprising amount of overhead, in particular inside iocb_flags().
That's why the beginning of the series is in this pile; it's not directly
iov_iter-related, but it's a part of the same work...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQQqUNBr3gm4hGXdBJlZ7Krx/gZQ6wUCYurGOQAKCRBZ7Krx/gZQ
6ysyAP91lvBfMRepcxpd9kvtuzWkU8A3rfSziZZteEHANB9Q7QEAiPn2a2OjWkcZ
uAyUWfCkHCNx+dSMkEvUgR5okQ0exAM=
=9UCV
-----END PGP SIGNATURE-----
Merge tag 'pull-work.iov_iter-base' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs iov_iter updates from Al Viro:
"Part 1 - isolated cleanups and optimizations.
One of the goals is to reduce the overhead of using ->read_iter() and
->write_iter() instead of ->read()/->write().
new_sync_{read,write}() has a surprising amount of overhead, in
particular inside iocb_flags(). That's the explanation for the
beginning of the series is in this pile; it's not directly
iov_iter-related, but it's a part of the same work..."
* tag 'pull-work.iov_iter-base' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
first_iovec_segment(): just return address
iov_iter: massage calling conventions for first_{iovec,bvec}_segment()
iov_iter: first_{iovec,bvec}_segment() - simplify a bit
iov_iter: lift dealing with maxpages out of first_{iovec,bvec}_segment()
iov_iter_get_pages{,_alloc}(): cap the maxsize with MAX_RW_COUNT
iov_iter_bvec_advance(): don't bother with bvec_iter
copy_page_{to,from}_iter(): switch iovec variants to generic
keep iocb_flags() result cached in struct file
iocb: delay evaluation of IS_SYNC(...) until we want to check IOCB_DSYNC
struct file: use anonymous union member for rcuhead and llist
btrfs: use IOMAP_DIO_NOSYNC
teach iomap_dio_rw() to suppress dsync
No need of likely/unlikely on calls of check_copy_size()
2022-08-03 13:50:22 -07:00
|
|
|
|
fs: Initial atomic write support
An atomic write is a write issued with torn-write protection, meaning
that for a power failure or any other hardware failure, all or none of the
data from the write will be stored, but never a mix of old and new data.
Userspace may add flag RWF_ATOMIC to pwritev2() to indicate that the
write is to be issued with torn-write prevention, according to special
alignment and length rules.
For any syscall interface utilizing struct iocb, add IOCB_ATOMIC for
iocb->ki_flags field to indicate the same.
A call to statx will give the relevant atomic write info for a file:
- atomic_write_unit_min
- atomic_write_unit_max
- atomic_write_segments_max
Both min and max values must be a power-of-2.
Applications can avail of atomic write feature by ensuring that the total
length of a write is a power-of-2 in size and also sized between
atomic_write_unit_min and atomic_write_unit_max, inclusive. Applications
must ensure that the write is at a naturally-aligned offset in the file
wrt the total write length. The value in atomic_write_segments_max
indicates the upper limit for IOV_ITER iovcnt.
Add file mode flag FMODE_CAN_ATOMIC_WRITE, so files which do not have the
flag set will have RWF_ATOMIC rejected and not just ignored.
Add a type argument to kiocb_set_rw_flags() to allows reads which have
RWF_ATOMIC set to be rejected.
Helper function generic_atomic_write_valid() can be used by FSes to verify
compliant writes. There we check for iov_iter type is for ubuf, which
implies iovcnt==1 for pwritev2(), which is an initial restriction for
atomic_write_segments_max. Initially the only user will be bdev file
operations write handler. We will rely on the block BIO submission path to
ensure write sizes are compliant for the bdev, so we don't need to check
atomic writes sizes yet.
Signed-off-by: Prasad Singamsetty <prasad.singamsetty@oracle.com>
jpg: merge into single patch and much rewrite
Acked-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20240620125359.2684798-4-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-06-20 12:53:52 +00:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-06 10:40:36 -06:00
|
|
|
|
2024-10-19 09:16:51 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-02 10:29:10 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2022-11-02 15:18:24 +00:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2026-09-02 15:01:59 -06:00
|
|
|
|
2024-11-01 17:19:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-12-17 07:44:25 -07:00
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
|
|
|
|
|
2025-08-19 10:25:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-17 14:21:58 -06:00
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
2024-12-17 07:44:25 -07:00
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fs: Initial atomic write support
An atomic write is a write issued with torn-write protection, meaning
that for a power failure or any other hardware failure, all or none of the
data from the write will be stored, but never a mix of old and new data.
Userspace may add flag RWF_ATOMIC to pwritev2() to indicate that the
write is to be issued with torn-write prevention, according to special
alignment and length rules.
For any syscall interface utilizing struct iocb, add IOCB_ATOMIC for
iocb->ki_flags field to indicate the same.
A call to statx will give the relevant atomic write info for a file:
- atomic_write_unit_min
- atomic_write_unit_max
- atomic_write_segments_max
Both min and max values must be a power-of-2.
Applications can avail of atomic write feature by ensuring that the total
length of a write is a power-of-2 in size and also sized between
atomic_write_unit_min and atomic_write_unit_max, inclusive. Applications
must ensure that the write is at a naturally-aligned offset in the file
wrt the total write length. The value in atomic_write_segments_max
indicates the upper limit for IOV_ITER iovcnt.
Add file mode flag FMODE_CAN_ATOMIC_WRITE, so files which do not have the
flag set will have RWF_ATOMIC rejected and not just ignored.
Add a type argument to kiocb_set_rw_flags() to allows reads which have
RWF_ATOMIC set to be rejected.
Helper function generic_atomic_write_valid() can be used by FSes to verify
compliant writes. There we check for iov_iter type is for ubuf, which
implies iovcnt==1 for pwritev2(), which is an initial restriction for
atomic_write_segments_max. Initially the only user will be bdev file
operations write handler. We will rely on the block BIO submission path to
ensure write sizes are compliant for the bdev, so we don't need to check
atomic writes sizes yet.
Signed-off-by: Prasad Singamsetty <prasad.singamsetty@oracle.com>
jpg: merge into single patch and much rewrite
Acked-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20240620125359.2684798-4-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-06-20 12:53:52 +00:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-06 10:40:36 -06:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2025-02-19 01:33:40 +00:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2024-09-10 08:30:57 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-01-07 10:59:35 -07:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
2026-04-01 10:35:11 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2026-03-02 10:29:10 -07:00
|
|
|
|
2026-04-01 10:35:11 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2026-04-01 10:35:11 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2022-06-16 10:21:57 +01:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2025-02-19 01:33:37 +00:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2026-04-01 10:35:11 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2026-04-01 10:35:11 -07:00
|
|
|
|
2023-09-11 13:31:56 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2023-09-11 13:31:56 -06:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2023-09-11 13:31:56 -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-09-11 13:31:56 -06:00
|
|
|
|
2025-08-20 20:03:35 -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
|
|
|
|
2026-07-22 20:45:51 +08:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2023-09-11 13:35:42 -06:00
|
|
|
|
|
|
|
|
|
2023-11-06 20:39:09 +00:00
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2023-09-11 13:35:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-01-28 20:08:24 -07:00
|
|
|
|
2023-09-11 13:35:42 -06:00
|
|
|
|
|
|
|
|
|
2025-02-19 01:33:40 +00:00
|
|
|
|
|
|
|
|
|
2025-08-20 20:03:34 -06:00
|
|
|
|
2023-09-11 13:35:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-11-06 20:39:09 +00: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-11-06 20:39:09 +00:00
|
|
|
|
2025-03-08 17:19:32 +00:00
|
|
|
|
2024-10-05 19:06:50 -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
|
|
|
|
2026-07-22 20:45:51 +08:00
|
|
|
|
|
|
|
|
|
2024-10-05 19:06:50 -06:00
|
|
|
|
2026-07-22 20:45:51 +08:00
|
|
|
|
2024-12-28 17:44:52 +00: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-10-05 19:06:50 -06:00
|
|
|
|
2023-09-11 13:35:42 -06:00
|
|
|
|
2024-10-05 19:06:50 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-11 13:35:42 -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-11-06 20:39:09 +00:00
|
|
|
|
2023-09-11 13:35:42 -06:00
|
|
|
|
2024-03-18 22:00:31 +00:00
|
|
|
|
2025-03-08 17:19:32 +00:00
|
|
|
|
io_uring/rw: ensure poll based multishot read retries appropriately
io_read_mshot() always relies on poll triggering retries, and this works
fine as long as we do a retry per size of the buffer being read. The
buffer size is given by the size of the buffer(s) in the given buffer
group ID.
But if we're reading less than what is available, then we don't always
get to read everything that is available. For example, if the buffers
available are 32 bytes and we have 64 bytes to read, then we'll
correctly read the first 32 bytes and then wait for another poll trigger
before we attempt the next read. This next poll trigger may never
happen, in which case we just sit forever and never make progress, or it
may trigger at some point in the future, and now we're just delivering
the available data much later than we should have.
io_read_mshot() could do retries itself, but that is wasteful as we'll
be going through all of __io_read() again, and most likely in vain.
Rather than do that, bump our poll reference count and have
io_poll_check_events() do one more loop and check with vfs_poll() if we
have more data to read. If we do, io_read_mshot() will get invoked again
directly and we'll read the next chunk.
io_poll_multishot_retry() must only get called from inside
io_poll_issue(), which is our multishot retry handler, as we know we
already "own" the request at this point.
Cc: stable@vger.kernel.org
Link: https://github.com/axboe/liburing/issues/1041
Fixes: fc68fcda0491 ("io_uring/rw: add support for IORING_OP_READ_MULTISHOT")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-01-27 13:44:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-08 17:19:32 +00:00
|
|
|
|
|
|
|
|
|
2023-09-11 13:35:42 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2025-03-08 17:19:33 +00:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
io_uring/rw: fix missing NOWAIT check for O_DIRECT start write
When io_uring starts a write, it'll call kiocb_start_write() to bump the
super block rwsem, preventing any freezes from happening while that
write is in-flight. The freeze side will grab that rwsem for writing,
excluding any new writers from happening and waiting for existing writes
to finish. But io_uring unconditionally uses kiocb_start_write(), which
will block if someone is currently attempting to freeze the mount point.
This causes a deadlock where freeze is waiting for previous writes to
complete, but the previous writes cannot complete, as the task that is
supposed to complete them is blocked waiting on starting a new write.
This results in the following stuck trace showing that dependency with
the write blocked starting a new write:
task:fio state:D stack:0 pid:886 tgid:886 ppid:876
Call trace:
__switch_to+0x1d8/0x348
__schedule+0x8e8/0x2248
schedule+0x110/0x3f0
percpu_rwsem_wait+0x1e8/0x3f8
__percpu_down_read+0xe8/0x500
io_write+0xbb8/0xff8
io_issue_sqe+0x10c/0x1020
io_submit_sqes+0x614/0x2110
__arm64_sys_io_uring_enter+0x524/0x1038
invoke_syscall+0x74/0x268
el0_svc_common.constprop.0+0x160/0x238
do_el0_svc+0x44/0x60
el0_svc+0x44/0xb0
el0t_64_sync_handler+0x118/0x128
el0t_64_sync+0x168/0x170
INFO: task fsfreeze:7364 blocked for more than 15 seconds.
Not tainted 6.12.0-rc5-00063-g76aaf945701c #7963
with the attempting freezer stuck trying to grab the rwsem:
task:fsfreeze state:D stack:0 pid:7364 tgid:7364 ppid:995
Call trace:
__switch_to+0x1d8/0x348
__schedule+0x8e8/0x2248
schedule+0x110/0x3f0
percpu_down_write+0x2b0/0x680
freeze_super+0x248/0x8a8
do_vfs_ioctl+0x149c/0x1b18
__arm64_sys_ioctl+0xd0/0x1a0
invoke_syscall+0x74/0x268
el0_svc_common.constprop.0+0x160/0x238
do_el0_svc+0x44/0x60
el0_svc+0x44/0xb0
el0t_64_sync_handler+0x118/0x128
el0t_64_sync+0x168/0x170
Fix this by having the io_uring side honor IOCB_NOWAIT, and only attempt a
blocking grab of the super block rwsem if it isn't set. For normal issue
where IOCB_NOWAIT would always be set, this returns -EAGAIN which will
have io_uring core issue a blocking attempt of the write. That will in
turn also get completions run, ensuring forward progress.
Since freezing requires CAP_SYS_ADMIN in the first place, this isn't
something that can be triggered by a regular user.
Cc: stable@vger.kernel.org # 5.10+
Reported-by: Peter Mann <peter.mann@sh.cz>
Link: https://lore.kernel.org/io-uring/38c94aec-81c9-4f62-b44e-1d87f5597644@sh.cz
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-10-31 08:05:44 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-07 16:00:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fs: Initial atomic write support
An atomic write is a write issued with torn-write protection, meaning
that for a power failure or any other hardware failure, all or none of the
data from the write will be stored, but never a mix of old and new data.
Userspace may add flag RWF_ATOMIC to pwritev2() to indicate that the
write is to be issued with torn-write prevention, according to special
alignment and length rules.
For any syscall interface utilizing struct iocb, add IOCB_ATOMIC for
iocb->ki_flags field to indicate the same.
A call to statx will give the relevant atomic write info for a file:
- atomic_write_unit_min
- atomic_write_unit_max
- atomic_write_segments_max
Both min and max values must be a power-of-2.
Applications can avail of atomic write feature by ensuring that the total
length of a write is a power-of-2 in size and also sized between
atomic_write_unit_min and atomic_write_unit_max, inclusive. Applications
must ensure that the write is at a naturally-aligned offset in the file
wrt the total write length. The value in atomic_write_segments_max
indicates the upper limit for IOV_ITER iovcnt.
Add file mode flag FMODE_CAN_ATOMIC_WRITE, so files which do not have the
flag set will have RWF_ATOMIC rejected and not just ignored.
Add a type argument to kiocb_set_rw_flags() to allows reads which have
RWF_ATOMIC set to be rejected.
Helper function generic_atomic_write_valid() can be used by FSes to verify
compliant writes. There we check for iov_iter type is for ubuf, which
implies iovcnt==1 for pwritev2(), which is an initial restriction for
atomic_write_segments_max. Initially the only user will be bdev file
operations write handler. We will rely on the block BIO submission path to
ensure write sizes are compliant for the bdev, so we don't need to check
atomic writes sizes yet.
Signed-off-by: Prasad Singamsetty <prasad.singamsetty@oracle.com>
jpg: merge into single patch and much rewrite
Acked-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20240620125359.2684798-4-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-06-20 12:53:52 +00:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-06 10:40:36 -06:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2024-03-28 13:27:24 +01:00
|
|
|
|
2022-06-16 14:22:18 -07:00
|
|
|
|
2024-03-28 13:27:24 +01:00
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2022-06-16 10:21:57 +01:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
io_uring/rw: fix missing NOWAIT check for O_DIRECT start write
When io_uring starts a write, it'll call kiocb_start_write() to bump the
super block rwsem, preventing any freezes from happening while that
write is in-flight. The freeze side will grab that rwsem for writing,
excluding any new writers from happening and waiting for existing writes
to finish. But io_uring unconditionally uses kiocb_start_write(), which
will block if someone is currently attempting to freeze the mount point.
This causes a deadlock where freeze is waiting for previous writes to
complete, but the previous writes cannot complete, as the task that is
supposed to complete them is blocked waiting on starting a new write.
This results in the following stuck trace showing that dependency with
the write blocked starting a new write:
task:fio state:D stack:0 pid:886 tgid:886 ppid:876
Call trace:
__switch_to+0x1d8/0x348
__schedule+0x8e8/0x2248
schedule+0x110/0x3f0
percpu_rwsem_wait+0x1e8/0x3f8
__percpu_down_read+0xe8/0x500
io_write+0xbb8/0xff8
io_issue_sqe+0x10c/0x1020
io_submit_sqes+0x614/0x2110
__arm64_sys_io_uring_enter+0x524/0x1038
invoke_syscall+0x74/0x268
el0_svc_common.constprop.0+0x160/0x238
do_el0_svc+0x44/0x60
el0_svc+0x44/0xb0
el0t_64_sync_handler+0x118/0x128
el0t_64_sync+0x168/0x170
INFO: task fsfreeze:7364 blocked for more than 15 seconds.
Not tainted 6.12.0-rc5-00063-g76aaf945701c #7963
with the attempting freezer stuck trying to grab the rwsem:
task:fsfreeze state:D stack:0 pid:7364 tgid:7364 ppid:995
Call trace:
__switch_to+0x1d8/0x348
__schedule+0x8e8/0x2248
schedule+0x110/0x3f0
percpu_down_write+0x2b0/0x680
freeze_super+0x248/0x8a8
do_vfs_ioctl+0x149c/0x1b18
__arm64_sys_ioctl+0xd0/0x1a0
invoke_syscall+0x74/0x268
el0_svc_common.constprop.0+0x160/0x238
do_el0_svc+0x44/0x60
el0_svc+0x44/0xb0
el0t_64_sync_handler+0x118/0x128
el0t_64_sync+0x168/0x170
Fix this by having the io_uring side honor IOCB_NOWAIT, and only attempt a
blocking grab of the super block rwsem if it isn't set. For normal issue
where IOCB_NOWAIT would always be set, this returns -EAGAIN which will
have io_uring core issue a blocking attempt of the write. That will in
turn also get completions run, ensuring forward progress.
Since freezing requires CAP_SYS_ADMIN in the first place, this isn't
something that can be triggered by a regular user.
Cc: stable@vger.kernel.org # 5.10+
Reported-by: Peter Mann <peter.mann@sh.cz>
Link: https://lore.kernel.org/io-uring/38c94aec-81c9-4f62-b44e-1d87f5597644@sh.cz
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-10-31 08:05:44 -06:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-21 13:11:44 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-02 10:29:10 -07:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2022-06-16 14:22:18 -07:00
|
|
|
|
|
|
|
|
|
2022-06-16 14:22:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-16 14:22:18 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2022-06-16 14:22:18 -07:00
|
|
|
|
2022-06-24 10:24:45 -06:00
|
|
|
|
2023-08-17 17:13:31 +03:00
|
|
|
|
2022-06-24 10:24:45 -06:00
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -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-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
2024-03-18 16:25:58 -06:00
|
|
|
|
2024-11-28 16:52:36 +05:30
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-27 14:39:12 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-21 12:17:47 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-01 17:19:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-02-18 18:35:34 -07:00
|
|
|
|
2024-11-01 17:19:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A rather large update for timekeeping and timers:
- The final step to get rid of auto-rearming posix-timers
posix-timers are currently auto-rearmed by the kernel when the signal
of the timer is ignored so that the timer signal can be delivered once
the corresponding signal is unignored.
This requires to throttle the timer to prevent a DoS by small intervals
and keeps the system pointlessly out of low power states for no value.
This is a long standing non-trivial problem due to the lock order of
posix-timer lock and the sighand lock along with life time issues as
the timer and the sigqueue have different life time rules.
Cure this by:
* Embedding the sigqueue into the timer struct to have the same life
time rules. Aside of that this also avoids the lookup of the timer
in the signal delivery and rearm path as it's just a always valid
container_of() now.
* Queuing ignored timer signals onto a seperate ignored list.
* Moving queued timer signals onto the ignored list when the signal is
switched to SIG_IGN before it could be delivered.
* Walking the ignored list when SIG_IGN is lifted and requeue the
signals to the actual signal lists. This allows the signal delivery
code to rearm the timer.
This also required to consolidate the signal delivery rules so they are
consistent across all situations. With that all self test scenarios
finally succeed.
- Core infrastructure for VFS multigrain timestamping
This is required to allow the kernel to use coarse grained time stamps
by default and switch to fine grained time stamps when inode attributes
are actively observed via getattr().
These changes have been provided to the VFS tree as well, so that the
VFS specific infrastructure could be built on top.
- Cleanup and consolidation of the sleep() infrastructure
* Move all sleep and timeout functions into one file
* Rework udelay() and ndelay() into proper documented inline functions
and replace the hardcoded magic numbers by proper defines.
* Rework the fsleep() implementation to take the reality of the timer
wheel granularity on different HZ values into account. Right now the
boundaries are hard coded time ranges which fail to provide the
requested accuracy on different HZ settings.
* Update documentation for all sleep/timeout related functions and fix
up stale documentation links all over the place
* Fixup a few usage sites
- Rework of timekeeping and adjtimex(2) to prepare for multiple PTP clocks
A system can have multiple PTP clocks which are participating in
seperate and independent PTP clock domains. So far the kernel only
considers the PTP clock which is based on CLOCK TAI relevant as that's
the clock which drives the timekeeping adjustments via the various user
space daemons through adjtimex(2).
The non TAI based clock domains are accessible via the file descriptor
based posix clocks, but their usability is very limited. They can't be
accessed fast as they always go all the way out to the hardware and
they cannot be utilized in the kernel itself.
As Time Sensitive Networking (TSN) gains traction it is required to
provide fast user and kernel space access to these clocks.
The approach taken is to utilize the timekeeping and adjtimex(2)
infrastructure to provide this access in a similar way how the kernel
provides access to clock MONOTONIC, REALTIME etc.
Instead of creating a duplicated infrastructure this rework converts
timekeeping and adjtimex(2) into generic functionality which operates
on pointers to data structures instead of using static variables.
This allows to provide time accessors and adjtimex(2) functionality for
the independent PTP clocks in a subsequent step.
- Consolidate hrtimer initialization
hrtimers are set up by initializing the data structure and then
seperately setting the callback function for historical reasons.
That's an extra unnecessary step and makes Rust support less straight
forward than it should be.
Provide a new set of hrtimer_setup*() functions and convert the core
code and a few usage sites of the less frequently used interfaces over.
The bulk of the htimer_init() to hrtimer_setup() conversion is already
prepared and scheduled for the next merge window.
- Drivers:
* Ensure that the global timekeeping clocksource is utilizing the
cluster 0 timer on MIPS multi-cluster systems.
Otherwise CPUs on different clusters use their cluster specific
clocksource which is not guaranteed to be synchronized with other
clusters.
* Mostly boring cleanups, fixes, improvements and code movement
-----BEGIN PGP SIGNATURE-----
iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmc7kPITHHRnbHhAbGlu
dXRyb25peC5kZQAKCRCmGPVMDXSYoZKkD/9OUL6fOJrDUmOYBa4QVeMyfTef4EaL
tvwIMM/29XQFeiq3xxCIn+EMnHjXn2lvIhYGQ7GKsbKYwvJ7ZBDpQb+UMhZ2nKI9
6D6BP6WomZohKeH2fZbJQAdqOi3KRYdvQdIsVZUexkqiaVPphRvOH9wOr45gHtZM
EyMRSotPlQTDqcrbUejDMEO94GyjDCYXRsyATLxjmTzL/N4xD4NRIiotjM2vL/a9
8MuCgIhrKUEyYlFoOxxeokBsF3kk3/ez2jlG9b/N8VLH3SYIc2zgL58FBgWxlmgG
bY71nVG3nUgEjxBd2dcXAVVqvb+5widk8p6O7xxOAQKTLMcJ4H0tQDkMnzBtUzvB
DGAJDHAmAr0g+ja9O35Pkhunkh4HYFIbq0Il4d1HMKObhJV0JumcKuQVxrXycdm3
UZfq3seqHsZJQbPgCAhlFU0/2WWScocbee9bNebGT33KVwSp5FoVv89C/6Vjb+vV
Gusc3thqrQuMAZW5zV8g4UcBAA/xH4PB0I+vHib+9XPZ4UQ7/6xKl2jE0kd5hX7n
AAUeZvFNFqIsY+B6vz+Jx/yzyM7u5cuXq87pof5EHVFzv56lyTp4ToGcOGYRgKH5
JXeYV1OxGziSDrd5vbf9CzdWMzqMvTefXrHbWrjkjhNOe8E1A8O88RZ5uRKZhmSw
hZZ4hdM9+3T7cg==
=2VC6
-----END PGP SIGNATURE-----
Merge tag 'timers-core-2024-11-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer updates from Thomas Gleixner:
"A rather large update for timekeeping and timers:
- The final step to get rid of auto-rearming posix-timers
posix-timers are currently auto-rearmed by the kernel when the
signal of the timer is ignored so that the timer signal can be
delivered once the corresponding signal is unignored.
This requires to throttle the timer to prevent a DoS by small
intervals and keeps the system pointlessly out of low power states
for no value. This is a long standing non-trivial problem due to
the lock order of posix-timer lock and the sighand lock along with
life time issues as the timer and the sigqueue have different life
time rules.
Cure this by:
- Embedding the sigqueue into the timer struct to have the same
life time rules. Aside of that this also avoids the lookup of
the timer in the signal delivery and rearm path as it's just a
always valid container_of() now.
- Queuing ignored timer signals onto a seperate ignored list.
- Moving queued timer signals onto the ignored list when the
signal is switched to SIG_IGN before it could be delivered.
- Walking the ignored list when SIG_IGN is lifted and requeue the
signals to the actual signal lists. This allows the signal
delivery code to rearm the timer.
This also required to consolidate the signal delivery rules so they
are consistent across all situations. With that all self test
scenarios finally succeed.
- Core infrastructure for VFS multigrain timestamping
This is required to allow the kernel to use coarse grained time
stamps by default and switch to fine grained time stamps when inode
attributes are actively observed via getattr().
These changes have been provided to the VFS tree as well, so that
the VFS specific infrastructure could be built on top.
- Cleanup and consolidation of the sleep() infrastructure
- Move all sleep and timeout functions into one file
- Rework udelay() and ndelay() into proper documented inline
functions and replace the hardcoded magic numbers by proper
defines.
- Rework the fsleep() implementation to take the reality of the
timer wheel granularity on different HZ values into account.
Right now the boundaries are hard coded time ranges which fail
to provide the requested accuracy on different HZ settings.
- Update documentation for all sleep/timeout related functions
and fix up stale documentation links all over the place
- Fixup a few usage sites
- Rework of timekeeping and adjtimex(2) to prepare for multiple PTP
clocks
A system can have multiple PTP clocks which are participating in
seperate and independent PTP clock domains. So far the kernel only
considers the PTP clock which is based on CLOCK TAI relevant as
that's the clock which drives the timekeeping adjustments via the
various user space daemons through adjtimex(2).
The non TAI based clock domains are accessible via the file
descriptor based posix clocks, but their usability is very limited.
They can't be accessed fast as they always go all the way out to
the hardware and they cannot be utilized in the kernel itself.
As Time Sensitive Networking (TSN) gains traction it is required to
provide fast user and kernel space access to these clocks.
The approach taken is to utilize the timekeeping and adjtimex(2)
infrastructure to provide this access in a similar way how the
kernel provides access to clock MONOTONIC, REALTIME etc.
Instead of creating a duplicated infrastructure this rework
converts timekeeping and adjtimex(2) into generic functionality
which operates on pointers to data structures instead of using
static variables.
This allows to provide time accessors and adjtimex(2) functionality
for the independent PTP clocks in a subsequent step.
- Consolidate hrtimer initialization
hrtimers are set up by initializing the data structure and then
seperately setting the callback function for historical reasons.
That's an extra unnecessary step and makes Rust support less
straight forward than it should be.
Provide a new set of hrtimer_setup*() functions and convert the
core code and a few usage sites of the less frequently used
interfaces over.
The bulk of the htimer_init() to hrtimer_setup() conversion is
already prepared and scheduled for the next merge window.
- Drivers:
- Ensure that the global timekeeping clocksource is utilizing the
cluster 0 timer on MIPS multi-cluster systems.
Otherwise CPUs on different clusters use their cluster specific
clocksource which is not guaranteed to be synchronized with
other clusters.
- Mostly boring cleanups, fixes, improvements and code movement"
* tag 'timers-core-2024-11-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (140 commits)
posix-timers: Fix spurious warning on double enqueue versus do_exit()
clocksource/drivers/arm_arch_timer: Use of_property_present() for non-boolean properties
clocksource/drivers/gpx: Remove redundant casts
clocksource/drivers/timer-ti-dm: Fix child node refcount handling
dt-bindings: timer: actions,owl-timer: convert to YAML
clocksource/drivers/ralink: Add Ralink System Tick Counter driver
clocksource/drivers/mips-gic-timer: Always use cluster 0 counter as clocksource
clocksource/drivers/timer-ti-dm: Don't fail probe if int not found
clocksource/drivers:sp804: Make user selectable
clocksource/drivers/dw_apb: Remove unused dw_apb_clockevent functions
hrtimers: Delete hrtimer_init_on_stack()
alarmtimer: Switch to use hrtimer_setup() and hrtimer_setup_on_stack()
io_uring: Switch to use hrtimer_setup_on_stack()
sched/idle: Switch to use hrtimer_setup_on_stack()
hrtimers: Delete hrtimer_init_sleeper_on_stack()
wait: Switch to use hrtimer_setup_sleeper_on_stack()
timers: Switch to use hrtimer_setup_sleeper_on_stack()
net: pktgen: Switch to use hrtimer_setup_sleeper_on_stack()
futex: Switch to use hrtimer_setup_sleeper_on_stack()
fs/aio: Switch to use hrtimer_setup_sleeper_on_stack()
...
2024-11-19 16:35:06 -08:00
|
|
|
|
2024-11-01 17:19:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-14 07:59:08 -07:00
|
|
|
|
2024-11-01 17:19:57 +08:00
|
|
|
|
|
|
|
|
|
2026-01-14 07:59:08 -07:00
|
|
|
|
2024-11-01 17:19:57 +08:00
|
|
|
|
|
|
|
|
|
2026-01-14 07:59:08 -07:00
|
|
|
|
2024-11-01 17:19:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2023-03-20 12:49:26 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2025-12-11 03:25:41 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2026-01-16 15:46:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-12-11 03:25:41 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-01 17:19:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-23 21:44:41 +05:30
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-13 16:20:44 +01:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-13 16:20:44 +01:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2025-12-11 03:25:41 -07:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2025-12-11 03:25:41 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2026-09-02 15:01:59 -06:00
|
|
|
|
2026-02-18 18:35:34 -07:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
2025-12-11 03:25:41 -07:00
|
|
|
|
|
|
|
|
|
2022-06-13 07:27:03 -06:00
|
|
|
|
|
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2024-03-20 15:19:44 -06:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2024-03-20 15:19:44 -06:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
2025-03-07 16:00:29 +00:00
|
|
|
|
2024-03-18 16:13:01 -06:00
|
|
|
|
|
|
|
|
|