On 24-07-2023 11:42, Kevin Brodsky wrote:
On 03/07/2023 19:46, Tudor Cretu wrote:
This series makes it possible for purecap apps to use the aio_ring shared memory region to bypass the io_getevents syscall's overhead. This functionality is also used in libaio.
With these patches, all io_* LTP tests pass in both Purecap and plain AArch64 modes. Note that the LTP tests only address the basic functionality of the aio system and a significant portion of the functionality is untested in LTP.
For a more comprehensive testing, libaio has been updated with the new uAPI and ported. All the tests in libaio pass accordingly, in both Purecap and plain AArch64 modes.
v4..v3:
- Restore flush_dcache_page in all places with the exception of one where is replaced with flush_kernel_vmap_range
- Use ifdef instead of IS_ENABLED in a few places
- Improve formatting
v3..v2:
- Improve the commit messages
- Revert a few unrelated changes
- Change compat_aio_context_t to compat_uptr_t
- Remove io_events_compat union member
- Improve code formatting
- Add copy_to_user_with_ptr in copy_io_events_to_user
- Split copy_from_user_with_ptr for struct __aio_sigset into a different patch
v2..v1:
- Add Patch 1 that fixes a parameter type for the compat handler
- Split the change the types to user pointers into two patches: one for aio_context_t, and the other for io_event struct fields.
- vmap all the ring pages at the beginning and cache them in the ctx
- Don't remap the pages while allowing tag access to the shared memory. Setting the VM flags is enough.
- Change aio_context_t to a void __user *.
- Improve commit messages.
- Refactor some of the functions for compat handling.
- Create valid user pointers ctx_id when received from a compat task
Gitlab issue: https://git.morello-project.org/morello/kernel/linux/-/issues/49
Review branch: https://git.morello-project.org/tudcre01/linux/-/commits/morello/aio_v4
Tudor Cretu (7): aio: Fix type of nr parameter in compat handler of io_submit aio: Use copy_from_user_with_ptr for struct __aio_sigset aio: vmap entire aio_ring instead of kmapping each page aio: Implement compat handling for the io_event struct aio: Allow capability tag access on the shared memory aio: Change aio_context_t to a user pointer aio: Use user pointer type in the io_event struct
Now applied on next, thanks!
Along the way I removed some leftover empty lines in aio_read_events_ring() (patch 3) and the io_destroy handler (patch 6).
Many thanks for the improvements!
I had some hesitation around the use of flush_kernel_vmap_range() vs flush_dcache_page() in patch 3. No firm conclusion has been reached on whether the current approach is correct in general, but what is clear is that it does not matter for arm64 as only the coherence between D-cache and I-cache is a concern there, and these pages are never executed. Since we have no easy way to verify the correctness of that patch w.r.t. the cache flushes, it doesn't seem worth spending more time investigating.
For the 6.4 branch, I updated patch 5 to use vm_flags_set() (like the corresponding io_uring patch).
I knew about this, but somehow I forgot about it. Many thanks for taking care of this as well, greatly appreciate it!
Tudor
Kevin
fs/aio.c | 283 ++++++++++++++++++++++------------- include/asm-generic/compat.h | 4 +- include/uapi/linux/aio_abi.h | 12 +- 3 files changed, 186 insertions(+), 113 deletions(-)