Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

std: add io_uring library #6356

Merged
merged 50 commits into from
Oct 29, 2020
Merged

std: add io_uring library #6356

merged 50 commits into from
Oct 29, 2020

Commits on Sep 16, 2020

  1. std: add io_uring library

    This brings io_uring helper methods to Zig for kernels >= 5.4.
    
    We follow liburing's design decisions so that anyone who is comfortable with
    liburing (https://unixism.net/loti/ref-liburing/index.html) will feel at home.
    
    Thanks to @daurnimator for the first draft.
    
    Refs: #3083
    Signed-off-by: Joran Dirk Greef <joran@coil.com>
    jorangreef committed Sep 16, 2020
    Configuration menu
    Copy the full SHA
    b340bbf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6f09796 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    491a434 View commit details
    Browse the repository at this point in the history

Commits on Sep 17, 2020

  1. Configuration menu
    Copy the full SHA
    ac1d9f7 View commit details
    Browse the repository at this point in the history
  2. Remove comment

    jorangreef committed Sep 17, 2020
    Configuration menu
    Copy the full SHA
    21c8136 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d966fe6 View commit details
    Browse the repository at this point in the history
  4. Use std.builtin

    jorangreef committed Sep 17, 2020
    Configuration menu
    Copy the full SHA
    e33c466 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8b030a6 View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2020

  1. Configuration menu
    Copy the full SHA
    ee59319 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5df0d28 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b2a54b9 View commit details
    Browse the repository at this point in the history
  4. Fix std @import

    jorangreef committed Sep 19, 2020
    Configuration menu
    Copy the full SHA
    09f2f4a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    873d1c8 View commit details
    Browse the repository at this point in the history
  6. Move to std/os/linux

    jorangreef committed Sep 19, 2020
    Configuration menu
    Copy the full SHA
    31533eb View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    cb59128 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    0d8c6a9 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    9fabae2 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    c1f9d10 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    64ae9a6 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    f4df2f0 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    e7ae6f2 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    ba18420 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    92407bf View commit details
    Browse the repository at this point in the history
  16. Fix io_uring_sqe to use the names of the first member of each union

    Now we're really future-proof... no more `opflags` creeping in.
    
    When anonymous unions land, we can start using `accept_flags` etc.
    
    Until then, code using this struct won't break when the kernel adds features.
    
    Refs: #6349
    Refs: #985
    jorangreef committed Sep 19, 2020
    Configuration menu
    Copy the full SHA
    4bc1b7a View commit details
    Browse the repository at this point in the history

Commits on Sep 20, 2020

  1. Configuration menu
    Copy the full SHA
    abebacd View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b672dc7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f22eea8 View commit details
    Browse the repository at this point in the history
  4. Add safety checks

    jorangreef committed Sep 20, 2020
    Configuration menu
    Copy the full SHA
    40293a0 View commit details
    Browse the repository at this point in the history
  5. Make enter(), flush_sq(), sq_ring_needs_enter(), cq_ring_needs_flush(…

    …) public
    
    These will also be needed by any custom helpers
    jorangreef committed Sep 20, 2020
    Configuration menu
    Copy the full SHA
    e51728a View commit details
    Browse the repository at this point in the history
  6. Test structs and offsets

    jorangreef committed Sep 20, 2020
    Configuration menu
    Copy the full SHA
    77903f8 View commit details
    Browse the repository at this point in the history
  7. Add IORING_FEAT_FAST_POLL

    jorangreef committed Sep 20, 2020
    Configuration menu
    Copy the full SHA
    a853f00 View commit details
    Browse the repository at this point in the history

Commits on Sep 21, 2020

  1. Add io_uring syscalls to os.bits.linux.mips.SYS

    As per lib/libc/musl/arch/mips/bits/syscall.h.in:
    
    ```c
    ```
    jorangreef committed Sep 21, 2020
    Configuration menu
    Copy the full SHA
    843c104 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    575ed94 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    57603fd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7719abb View commit details
    Browse the repository at this point in the history
  5. Use @intcast instead of @truncate

    jorangreef committed Sep 21, 2020
    Configuration menu
    Copy the full SHA
    2d8df2b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    5f99d2c View commit details
    Browse the repository at this point in the history

Commits on Oct 3, 2020

  1. Configuration menu
    Copy the full SHA
    95def89 View commit details
    Browse the repository at this point in the history
  2. Use load acquire semantics when reading the SQPOLL wakeup flag

    Ensures that the wakeup flag is read after the tail pointer has been
    written. It's important to use memory load acquire semantics for the
    flags read, otherwise the application and the kernel might not agree on
    the consistency of the wakeup flag, leading to I/O starvation.
    
    Refs: axboe/liburing@6768ddc
    Refs: axboe/liburing#219
    jorangreef committed Oct 3, 2020
    Configuration menu
    Copy the full SHA
    a9b1070 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c5b4fca View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2020

  1. Configuration menu
    Copy the full SHA
    61ec6cb View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e32c7d0 View commit details
    Browse the repository at this point in the history
  3. Allow for advanced non-sequential SQE allocation schemes

    Decouples SQE queueing and SQE prepping methods to allow for non-sequential
    SQE allocation schemes as suggested by @daurnimator.
    
    Adds essential SQE prepping methods from liburing to reduce boilerplate.
    
    Removes non-essential .link_with_next_sqe() and .use_registered_fd().
    jorangreef committed Oct 4, 2020
    Configuration menu
    Copy the full SHA
    69a55fc View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    3d2de6c View commit details
    Browse the repository at this point in the history
  5. Add openat(), close(), connect(), send(), recv(), as well as tests

    Removes non-essential .hardlink_with_next_sqe() and .drain_previous_sqes().
    jorangreef committed Oct 4, 2020
    Configuration menu
    Copy the full SHA
    6a53f4b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    9091fcb View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    72bdfa5 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    958ff08 View commit details
    Browse the repository at this point in the history
  9. Split openat/close test into two separate tests

    If an older kernel fails the `openat` test because of `AT_FDCWD`
    then we don't want to skip the `close` test.
    jorangreef committed Oct 4, 2020
    Configuration menu
    Copy the full SHA
    9be2941 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2020

  1. Configuration menu
    Copy the full SHA
    e9ba12f View commit details
    Browse the repository at this point in the history