Hacker News new | past | comments | ask | show | jobs | submit login

Maybe I just missed this but can anyone tell me what kernel versions support io_uring. I ran the following test program on 4.19.0 and it is not supported:

    #include <stdio.h>
    #include <stdlib.h>
    #include <sys/utsname.h>
    #include <liburing.h>
    #include <liburing/io_uring.h>


    static const char *op_strs[] = {
      "IORING_OP_NOP",
      "IORING_OP_READV",
      "IORING_OP_WRITEV",
      "IORING_OP_FSYNC",
      "IORING_OP_READ_FIXED",
      "IORING_OP_WRITE_FIXED",
      "IORING_OP_POLL_ADD",
      "IORING_OP_POLL_REMOVE",
      "IORING_OP_SYNC_FILE_RANGE",
      "IORING_OP_SENDMSG",
      "IORING_OP_RECVMSG",
      "IORING_OP_TIMEOUT",
      "IORING_OP_TIMEOUT_REMOVE",
      "IORING_OP_ACCEPT",
      "IORING_OP_ASYNC_CANCEL",
      "IORING_OP_LINK_TIMEOUT",
      "IORING_OP_CONNECT",
      "IORING_OP_FALLOCATE",
      "IORING_OP_OPENAT",
      "IORING_OP_CLOSE",
      "IORING_OP_FILES_UPDATE",
      "IORING_OP_STATX",
      "IORING_OP_READ",
      "IORING_OP_WRITE",
      "IORING_OP_FADVISE",
      "IORING_OP_MADVISE",
      "IORING_OP_SEND",
      "IORING_OP_RECV",
      "IORING_OP_OPENAT2",
      "IORING_OP_EPOLL_CTL",
      "IORING_OP_SPLICE",
      "IORING_OP_PROVIDE_BUFFERS",
      "IORING_OP_REMOVE_BUFFERS",
    };


    int main() {
      struct utsname u;
      uname(&u);

      struct io_uring_probe *probe = io_uring_get_probe();
      if (!probe) {
        printf("Kernel %s does not support io_uring.\n", u.release);
        return 0;
      }

      printf("List of kernel %s's supported io_uring operations:\n", u.release);

      for (int i = 0; i < IORING_OP_LAST; i++ ) {
        const char *answer = io_uring_opcode_supported(probe, i) ? "yes" : "no";
        printf("%s: %s\n", op_strs[i], answer);
      }

      free(probe);
      return 0;
    }



If you have a clone of the Linux kernel source tree, you just have to look at the history of the include/uapi/linux/io_uring.h file. From a quick look here: everything up to IORING_OP_POLL_REMOVE came with Linux 5.1; IORING_OP_SYNC_FILE_RANGE was added in Linux 5.2; IORING_OP_SENDMSG and IORING_OP_RECVMSG came with Linux 5.3; IORING_OP_TIMEOUT with Linux 5.4; everything up to IORING_OP_CONNECT is in Linux 5.5; everything up to IORING_OP_EPOLL_CTL is in Linux 5.6; and the last three are going to be in Linux 5.7.


This article concurs. https://lwn.net/Articles/810414/ io_uring was first added to the mainline Linux kernel in 5.1.


It is documented in the liburing man pages.

Furthermore, recent variants of io_uring have a probe-function that allows checking for capabilities.

Generally speaking though, you will need more recent kernels than 4.x


io_uring_get_probe() needs v5.6 at least.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: