summary refs log tree commit diff
path: root/io_uring
Commit message (Collapse)AuthorAge
* io_uring: update for mmap api changeDylan Reid2020-06-12
| | | | | | | | | | | | | A recent change to sys_util moved the definition of 'as_ptr' for an mmap to a new trait, include that trait here. Change-Id: Ib48113738fdace50e2dc7f72a5107dd95db867f9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2241590 Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org> Tested-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Dylan Reid <dgreid@chromium.org>
* io_uring: Take Vecs or iterators of iovecsDylan Reid2020-06-05
| | | | | | | | | | | | | | | | | | | | The pointer passed to the kernel for the iovecs must remain valid until the operation completes. This is true even if the kernel copies the sqe containing the pointer, that isn't a deep copy. If the iovecs are freed before the kernel actually processes the op, it will fail with a bad address error. Move the responsibility for maintaining the list in memory from the caller to io_uring itself. This mean io_uring must allocate. Taking iterators for IoSlice/IoSliceMut, means that the caller doesn't need to allocate as well if there isn't a Vec already allocated. Change-Id: I63a009d8ab543c8bac4132809fb851536d4ad82c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2227082 Reviewed-by: Dylan Reid <dgreid@chromium.org> Tested-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Dylan Reid <dgreid@chromium.org>
* io_uring: allocate iovecs based on returned count from the kernelDylan Reid2020-04-10
| | | | | | | | | | | | | | | | | | | The kernel is allowed to not only limit the number of requested entries, but also provide more than is requested. If a non-power-of-2 is requested, it will be rounded up to the next power of 2. Ensure that there are enough iovecs by allocating them based on the number returned from io_uring_setup instead of the number of entries requested. TEST=cargo test read_parallel Change-Id: If92e0a31858d1af53b99af8415002a4f26b48230 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2140915 Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org>
* io_uring: add reading and writing iovecsDylan Reid2020-04-10
| | | | | | | | | | | | | | | Let the user of the io_uring interface specify a slice of iovecs to read from or write to when queueing an operation to the ring. These ops can be used by block that has a Vec of iovecs from the descriptor chain already. Change-Id: Ia91e03e441cdae03e4fdba33bb601de006ef53ef Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2140914 Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org>
* io_uring: operation results are unsignedDylan Reid2020-04-10
| | | | | | | | | | | | | | | Switch from returning an i32 to a u32. This will make handling the number easier for users, as they can assume it is >= 0. Any value < 0 would not be returned as Ok(value) anyways as ret < 0 is used for error conditions. Change-Id: I609ce55d3c6be6e28f4d7aadf7148b2ac3b18878 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2140913 Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Dylan Reid <dgreid@chromium.org> Commit-Queue: Dylan Reid <dgreid@chromium.org>
* Add io_uring interfacesDylan Reid2020-04-05
Provide a low-level interface to operating the new io_uring interface. This is an unsafe interface with the basic operations of setting up the ring, adding to it, removing from it, and polling it. This will be followed by a safe interface layer on top of this code, then by additions to the asynchronous executor that allow for asynchronously doing multiple operations to files from one context. Change-Id: I71f7ffb04ce8cb4da470deda9aee768ab95d3d98 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2124009 Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Dylan Reid <dgreid@chromium.org>