|
Revision tags: v6.15, v6.15-rc7 |
|
| #
63166b81 |
| 12-May-2025 |
hexue <[email protected]> |
io_uring/uring_cmd: fix hybrid polling initialization issue
Modify the check for whether the timer is initialized during IO transfer when passthrough is used with hybrid polling, to ensure that it's
io_uring/uring_cmd: fix hybrid polling initialization issue
Modify the check for whether the timer is initialized during IO transfer when passthrough is used with hybrid polling, to ensure that it's always setup correctly.
Cc: [email protected] Fixes: 01ee194d1aba ("io_uring: add support for hybrid IOPOLL") Signed-off-by: hexue <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
|
Revision tags: v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1 |
|
| #
ed344511 |
| 31-Mar-2025 |
Pavel Begunkov <[email protected]> |
io_uring: cleanup {g,s]etsockopt sqe reading
Add a local variable for the sqe pointer to avoid repetition.
Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/8db
io_uring: cleanup {g,s]etsockopt sqe reading
Add a local variable for the sqe pointer to avoid repetition.
Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/8dbac0f9acda2d3842534eeb7ce10d9276b021ae.1743357108.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
296e1696 |
| 31-Mar-2025 |
Pavel Begunkov <[email protected]> |
io_uring: hide caches sqes from drivers
There is now an io_uring private part of cmd async_data, move saved sqe into it. Drivers are accessing it via struct io_uring_cmd::cmd.
Signed-off-by: Pavel
io_uring: hide caches sqes from drivers
There is now an io_uring private part of cmd async_data, move saved sqe into it. Drivers are accessing it via struct io_uring_cmd::cmd.
Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/ecbe078dd57acefdbc4366d083327086c0879378.1743357121.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
|
Revision tags: v6.14 |
|
| #
ef490275 |
| 21-Mar-2025 |
Pavel Begunkov <[email protected]> |
io_uring/cmd: introduce io_uring_cmd_import_fixed_vec
io_uring_cmd_import_fixed_vec() is a cmd helper around vectored registered buffer import functions, which caches the memory under the hood. The
io_uring/cmd: introduce io_uring_cmd_import_fixed_vec
io_uring_cmd_import_fixed_vec() is a cmd helper around vectored registered buffer import functions, which caches the memory under the hood. The lifetime of the vectore and hence the iterator is bound to the request. Furthermore, the user is not allowed to call it multiple times for a single request.
Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/97487a80dec3fb8cf8aeedf1f9026ef6d503fe4b.1742579999.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
3a4689ac |
| 21-Mar-2025 |
Pavel Begunkov <[email protected]> |
io_uring/cmd: add iovec cache for commands
Add iou_vec to commands and wire caching for it, but don't expose it to users just yet. We need the vec cleared on initial alloc, but since we can't place
io_uring/cmd: add iovec cache for commands
Add iou_vec to commands and wire caching for it, but don't expose it to users just yet. We need the vec cleared on initial alloc, but since we can't place it at the beginning at the moment, zero the entire async_data. It's cached, and the performance effects only the initial allocation, and it might be not a bad idea since we're exposing those bits to outside drivers.
Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/c0f2145b75791bc6106eb4e72add2cf6a2c72a7a.1742579999.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
5f14404b |
| 19-Mar-2025 |
Pavel Begunkov <[email protected]> |
io_uring/cmd: don't expose entire cmd async data
io_uring needs private bits in cmd's ->async_data, and they should never be exposed to drivers as it'd certainly be abused. Leave struct io_uring_cmd
io_uring/cmd: don't expose entire cmd async data
io_uring needs private bits in cmd's ->async_data, and they should never be exposed to drivers as it'd certainly be abused. Leave struct io_uring_cmd_data for the drivers but wrap it into a structure. It's a prep patch and doesn't do anything useful yet.
Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
575e7b06 |
| 19-Mar-2025 |
Pavel Begunkov <[email protected]> |
io_uring: rename the data cmd cache
Pick a more descriptive name for the cmd async data cache.
Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/20250319061251.
io_uring: rename the data cmd cache
Pick a more descriptive name for the cmd async data cache.
Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc7, v6.14-rc6, v6.14-rc5 |
|
| #
0c542a69 |
| 28-Feb-2025 |
Caleb Sander Mateos <[email protected]> |
io_uring/uring_cmd: specify io_uring_cmd_import_fixed() pointer type
io_uring_cmd_import_fixed() takes a struct io_uring_cmd *, but the type of the ioucmd parameter is void *. Make the pointer type
io_uring/uring_cmd: specify io_uring_cmd_import_fixed() pointer type
io_uring_cmd_import_fixed() takes a struct io_uring_cmd *, but the type of the ioucmd parameter is void *. Make the pointer type explicit so the compiler can type check it.
Signed-off-by: Caleb Sander Mateos <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
5d309914 |
| 24-Feb-2025 |
Pavel Begunkov <[email protected]> |
io_uring: combine buffer lookup and import
Registered buffer are currently imported in two steps, first we lookup a rsrc node and then use it to set up the iterator. The first part is usually done a
io_uring: combine buffer lookup and import
Registered buffer are currently imported in two steps, first we lookup a rsrc node and then use it to set up the iterator. The first part is usually done at the prep stage, and import happens whenever it's needed. As we want to defer binding to a node so that it works with linked requests, combine both steps into a single helper.
Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Pavel Begunkov <[email protected]> Reviewed-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
69d483d5 |
| 24-Feb-2025 |
Pavel Begunkov <[email protected]> |
io_uring/nvme: pass issue_flags to io_uring_cmd_import_fixed()
io_uring_cmd_import_fixed() will need to know the io_uring execution state in following commits, for now just pass issue_flags into it
io_uring/nvme: pass issue_flags to io_uring_cmd_import_fixed()
io_uring_cmd_import_fixed() will need to know the io_uring execution state in following commits, for now just pass issue_flags into it without actually using.
Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Pavel Begunkov <[email protected]> Reviewed-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
0bba6fcc |
| 24-Feb-2025 |
Pavel Begunkov <[email protected]> |
io_uring/cmd: optimise !CONFIG_COMPAT flags setting
Use io_is_compat() to avoid extra overhead in io_uring_cmd() for flag setting when compat is compiled out.
Signed-off-by: Pavel Begunkov <asml.si
io_uring/cmd: optimise !CONFIG_COMPAT flags setting
Use io_is_compat() to avoid extra overhead in io_uring_cmd() for flag setting when compat is compiled out.
Signed-off-by: Pavel Begunkov <[email protected]> Reviewed-by: Anuj Gupta <[email protected]> Link: https://lore.kernel.org/r/f4d74c62d7cbddc386c0a9138ecd2b2ed6d3f146.1740400452.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc4 |
|
| #
bcf8a029 |
| 17-Feb-2025 |
Caleb Sander Mateos <[email protected]> |
io_uring: introduce type alias for io_tw_state
In preparation for changing how io_tw_state is passed, introduce a type alias io_tw_token_t for struct io_tw_state *. This allows for changing the repr
io_uring: introduce type alias for io_tw_state
In preparation for changing how io_tw_state is passed, introduce a type alias io_tw_token_t for struct io_tw_state *. This allows for changing the representation in one place, without having to update the many functions that just forward their struct io_tw_state * argument.
Also add a comment to struct io_tw_state to explain its purpose.
Signed-off-by: Caleb Sander Mateos <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc3 |
|
| #
d6211ebb |
| 13-Feb-2025 |
Jens Axboe <[email protected]> |
io_uring/uring_cmd: unconditionally copy SQEs at prep time
This isn't generally necessary, but conditions have been observed where SQE data is accessed from the original SQE after prep has been done
io_uring/uring_cmd: unconditionally copy SQEs at prep time
This isn't generally necessary, but conditions have been observed where SQE data is accessed from the original SQE after prep has been done and outside of the initial issue. Opcode prep handlers must ensure that any SQE related data is stable beyond the prep phase, but uring_cmd is a bit special in how it handles the SQE which makes it susceptible to reading stale data. If the application has reused the SQE before the original completes, then that can lead to data corruption.
Down the line we can relax this again once uring_cmd has been sanitized a bit, and avoid unnecessarily copying the SQE.
Fixes: 5eff57fa9f3a ("io_uring/uring_cmd: defer SQE copying until it's needed") Reported-by: Caleb Sander Mateos <[email protected]> Reviewed-by: Caleb Sander Mateos <[email protected]> Reviewed-by: Li Zetao <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
0edf1283 |
| 12-Feb-2025 |
Jens Axboe <[email protected]> |
io_uring/uring_cmd: remove dead req_has_async_data() check
Any uring_cmd always has async data allocated now, there's no reason to check and clear a cached copy of the SQE.
Fixes: d10f19dff56e ("io
io_uring/uring_cmd: remove dead req_has_async_data() check
Any uring_cmd always has async data allocated now, there's no reason to check and clear a cached copy of the SQE.
Fixes: d10f19dff56e ("io_uring/uring_cmd: switch to always allocating async data") Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
e663da62 |
| 12-Feb-2025 |
Caleb Sander Mateos <[email protected]> |
io_uring/uring_cmd: switch sqe to async_data on EAGAIN
5eff57fa9f3a ("io_uring/uring_cmd: defer SQE copying until it's needed") moved the unconditional memcpy() of the uring_cmd SQE to async_data to
io_uring/uring_cmd: switch sqe to async_data on EAGAIN
5eff57fa9f3a ("io_uring/uring_cmd: defer SQE copying until it's needed") moved the unconditional memcpy() of the uring_cmd SQE to async_data to 2 cases when the request goes async: - If REQ_F_FORCE_ASYNC is set to force the initial issue to go async - If ->uring_cmd() returns -EAGAIN in the initial non-blocking issue
Unlike the REQ_F_FORCE_ASYNC case, in the EAGAIN case, io_uring_cmd() copies the SQE to async_data but neglects to update the io_uring_cmd's sqe field to point to async_data. As a result, sqe still points to the slot in the userspace-mapped SQ. At the end of io_submit_sqes(), the kernel advances the SQ head index, allowing userspace to reuse the slot for a new SQE. If userspace reuses the slot before the io_uring worker reissues the original SQE, the io_uring_cmd's SQE will be corrupted.
Introduce a helper io_uring_cmd_cache_sqes() to copy the original SQE to the io_uring_cmd's async_data and point sqe there. Use it for both the REQ_F_FORCE_ASYNC and EAGAIN cases. This ensures the uring_cmd doesn't read from the SQ slot after it has been returned to userspace.
Signed-off-by: Caleb Sander Mateos <[email protected]> Fixes: 5eff57fa9f3a ("io_uring/uring_cmd: defer SQE copying until it's needed") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
34cae912 |
| 12-Feb-2025 |
Caleb Sander Mateos <[email protected]> |
io_uring/uring_cmd: don't assume io_uring_cmd_data layout
eaf72f7b414f ("io_uring/uring_cmd: cleanup struct io_uring_cmd_data layout") removed most of the places assuming struct io_uring_cmd_data ha
io_uring/uring_cmd: don't assume io_uring_cmd_data layout
eaf72f7b414f ("io_uring/uring_cmd: cleanup struct io_uring_cmd_data layout") removed most of the places assuming struct io_uring_cmd_data has sqes as its first field. However, the EAGAIN case in io_uring_cmd() still compares ioucmd->sqe to the struct io_uring_cmd_data pointer using a void * cast. Since fa3595523d72 ("io_uring: get rid of alloc cache init_once handling"), sqes is no longer io_uring_cmd_data's first field. As a result, the pointers will always compare unequal and memcpy() may be called with the same source and destination.
Replace the incorrect void * cast with the address of the sqes field.
Signed-off-by: Caleb Sander Mateos <[email protected]> Fixes: eaf72f7b414f ("io_uring/uring_cmd: cleanup struct io_uring_cmd_data layout") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
|
Revision tags: v6.14-rc2, v6.14-rc1 |
|
| #
fa359552 |
| 23-Jan-2025 |
Jens Axboe <[email protected]> |
io_uring: get rid of alloc cache init_once handling
init_once is called when an object doesn't come from the cache, and hence needs initial clearing of certain members. While the whole struct could
io_uring: get rid of alloc cache init_once handling
init_once is called when an object doesn't come from the cache, and hence needs initial clearing of certain members. While the whole struct could get cleared by memset() in that case, a few of the cache members are large enough that this may cause unnecessary overhead if the caches used aren't large enough to satisfy the workload. For those cases, some churn of kmalloc+kfree is to be expected.
Ensure that the 3 users that need clearing put the members they need cleared at the start of the struct, and wrap the rest of the struct in a struct group so the offset is known.
While at it, improve the interaction with KASAN such that when/if KASAN writes to members inside the struct that should be retained over caching, it won't trip over itself. For rw and net, the retaining of the iovec over caching is disabled if KASAN is enabled. A helper will free and clear those members in that case.
Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
eaf72f7b |
| 23-Jan-2025 |
Jens Axboe <[email protected]> |
io_uring/uring_cmd: cleanup struct io_uring_cmd_data layout
A few spots in uring_cmd assume that the SQEs copied are always at the start of the structure, and hence mix req->async_data and the struc
io_uring/uring_cmd: cleanup struct io_uring_cmd_data layout
A few spots in uring_cmd assume that the SQEs copied are always at the start of the structure, and hence mix req->async_data and the struct itself.
Clean that up and use the proper indices.
Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
| #
d58d82bd |
| 23-Jan-2025 |
Jens Axboe <[email protected]> |
io_uring/uring_cmd: use cached cmd_op in io_uring_cmd_sock()
io_uring_cmd_sock() does a normal read of cmd->sqe->cmd_op, where it really should be using a READ_ONCE() as ->sqe may still be pointing
io_uring/uring_cmd: use cached cmd_op in io_uring_cmd_sock()
io_uring_cmd_sock() does a normal read of cmd->sqe->cmd_op, where it really should be using a READ_ONCE() as ->sqe may still be pointing to the original SQE. Since the prep side already does this READ_ONCE() and stores it locally, use that value rather than re-read it.
Fixes: 8e9fad0e70b7b ("io_uring: Add io_uring command support for sockets") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
|
Revision tags: v6.13 |
|
| #
bab4b2cc |
| 15-Jan-2025 |
Pavel Begunkov <[email protected]> |
io_uring: reuse io_should_terminate_tw() for cmds
io_uring_cmd_work() rolled a hard coded version of io_should_terminate_tw() to avoid conflicts, but now it's time to converge them.
Signed-off-by:
io_uring: reuse io_should_terminate_tw() for cmds
io_uring_cmd_work() rolled a hard coded version of io_should_terminate_tw() to avoid conflicts, but now it's time to converge them.
Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/8a88dd6e4ed8e6c00c6552af0c20c9de02e458de.1736955455.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
|
Revision tags: v6.13-rc7, v6.13-rc6 |
|
| #
3347fa65 |
| 03-Jan-2025 |
Jens Axboe <[email protected]> |
io_uring/cmd: add per-op data to struct io_uring_cmd_data
In case an op handler for ->uring_cmd() needs stable storage for user data, it can allocate io_uring_cmd_data->op_data and use it for the du
io_uring/cmd: add per-op data to struct io_uring_cmd_data
In case an op handler for ->uring_cmd() needs stable storage for user data, it can allocate io_uring_cmd_data->op_data and use it for the duration of the request. When the request gets cleaned up, uring_cmd will free it automatically.
Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: David Sterba <[email protected]>
show more ...
|
| #
dadf03cf |
| 03-Jan-2025 |
Jens Axboe <[email protected]> |
io_uring/cmd: rename struct uring_cache to io_uring_cmd_data
In preparation for making this more generically available for ->uring_cmd() usage that needs stable command data, rename it and move it t
io_uring/cmd: rename struct uring_cache to io_uring_cmd_data
In preparation for making this more generically available for ->uring_cmd() usage that needs stable command data, rename it and move it to io_uring/cmd.h instead.
Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: David Sterba <[email protected]>
show more ...
|
|
Revision tags: v6.13-rc5, v6.13-rc4 |
|
| #
e9447dc0 |
| 16-Dec-2024 |
Gabriel Krisman Bertazi <[email protected]> |
io_uring/uring_cmd: Allocate async data through generic helper
This abstracts away the cache details and simplify the code.
Signed-off-by: Gabriel Krisman Bertazi <[email protected]> Link: https://lo
io_uring/uring_cmd: Allocate async data through generic helper
This abstracts away the cache details and simplify the code.
Signed-off-by: Gabriel Krisman Bertazi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
|
Revision tags: v6.13-rc3, v6.13-rc2 |
|
| #
a07d2d79 |
| 03-Dec-2024 |
Bernd Schubert <[email protected]> |
io_uring: Change res2 parameter type in io_uring_cmd_done
Change the type of the res2 parameter in io_uring_cmd_done from ssize_t to u64. This aligns the parameter type with io_req_set_cqe32_extra,
io_uring: Change res2 parameter type in io_uring_cmd_done
Change the type of the res2 parameter in io_uring_cmd_done from ssize_t to u64. This aligns the parameter type with io_req_set_cqe32_extra, which expects u64 arguments. The change eliminates potential issues on 32-bit architectures where ssize_t might be 32-bit.
Only user of passing res2 is drivers/nvme/host/ioctl.c and it actually passes u64.
Fixes: ee692a21e9bf ("fs,io_uring: add infrastructure for uring-cmd") Cc: [email protected] Reviewed-by: Kanchan Joshi <[email protected]> Tested-by: Li Zetao <[email protected]> Reviewed-by: Li Zetao <[email protected]> Signed-off-by: Bernd Schubert <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|
|
Revision tags: v6.13-rc1, v6.12 |
|
| #
a43e236f |
| 11-Nov-2024 |
Ming Lei <[email protected]> |
io_uring/uring_cmd: fix buffer index retrieval
Add back buffer index retrieval for IORING_URING_CMD_FIXED.
Reported-by: Guangwu Zhang <[email protected]> Cc: Jeff Moyer <[email protected]> Fixes:
io_uring/uring_cmd: fix buffer index retrieval
Add back buffer index retrieval for IORING_URING_CMD_FIXED.
Reported-by: Guangwu Zhang <[email protected]> Cc: Jeff Moyer <[email protected]> Fixes: b54a14041ee6 ("io_uring/rsrc: add io_rsrc_node_lookup() helper") Signed-off-by: Ming Lei <[email protected]> Reviewed-by: Kanchan Joshi <[email protected]> Reviewed-by: Anuj Gupta <[email protected]> Tested-by: Guangwu Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
show more ...
|