Commit Graph

733 Commits

Author SHA1 Message Date
Stefano Garzarella a02a8d036e io_uring.h: use an enumeration for io_uring_register(2) opcodes
The enumeration allows us to keep track of the last
io_uring_register(2) opcode available.

Behaviour and opcodes names don't change.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2020-08-27 15:35:41 +02:00
Jens Axboe abce98153b Add a test case for closed pipe terminating properly
This is fixed by upstream commit:

commit 68faa4727c0e2d7d255d9b97e754f2cda748f141
Author: Jens Axboe <axboe@kernel.dk>
Date:   Tue Aug 25 12:27:50 2020 -0600

    io_uring: don't use poll handler if file can't be nonblocking read/written

We're testing whether we first get some data, then a zero return on the
next one when it's closed. The buggy behavior was to arm a poll handler,
which isn't notified when the pipe is closed.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-25 17:23:14 -06:00
Jens Axboe fac6b9fc59 io_uring_prep_splice(): fix type (again)
Guillem Jover correctly points out that this did used to be loff_t,
but was changed since it wasn't available everywhere.

Let's just use an int64_t, it's the same size and signed. Hopefully
this is it...

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-24 07:25:38 -06:00
Jens Axboe 5aecdbe26d Use the right type for io_uring_prep_splice()
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-24 03:22:49 -06:00
Jens Axboe 2e5274fe62 Merge branch 'refactor_header_file_deps' of https://github.com/gfx/liburing into master
* 'refactor_header_file_deps' of https://github.com/gfx/liburing:
  syscall: make syscall.h independently includeable
2020-08-22 20:12:48 -06:00
Goro Fuji 0b9394fec8 syscall: make syscall.h independently includeable
syscall.h is mising the forward declaration for struct io_uring_params, and sigset_t. Include the necessary
system header to make it independent.

Signed-off-by: Goro Fuji <g.psy.va@gmail.com>
2020-08-23 01:09:49 +00:00
Jens Axboe 5de5b6a042 test/iopoll: only SQPOLL requires root, IOPOLL does not
We can test IOPOLL just fine as a regular user, so just skip the SQPOLL
specific tests.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-21 15:45:47 -06:00
Jens Axboe 895101b8b8 test/iopoll: coding style fixups
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-21 08:40:24 -06:00
Jens Axboe bc2adeb7bb Merge branch 'iopoll-enters-test' of https://github.com/glommer/liburing into master
* 'iopoll-enters-test' of https://github.com/glommer/liburing:
  iopoll: test that we always enter the ring
2020-08-21 08:36:31 -06:00
Glauber Costa 3a745bc3dd iopoll: test that we always enter the ring
If the ring is configured to operate in poll mode we need to always
enter the kernel to fetch new events. This behavior was introduced
in  bf3aeb3dbb but recently broken.

Break me once, shame on you. Break me twice, shame on me:
  - Add a unit test.

The unit test submits sqes manually through the system call, which
guarantees that IORING_ENTER_GETEVENTS will not be present in the flag
set during the initial submission.

The only way we can ever fetch new I/O events is if io_uring_submit
indeed will enter the ring despite not having new sqes to submit.

This test passes with 8e8cb865cd but fails before it due to the
aforementioned regression.

Signed-off-by: Glauber Costa <glauber@datadoghq.com>
2020-08-21 09:34:49 -04:00
Jens Axboe 8e8cb865cd sq_ring_needs_enter: revert change to only enter if submit != 0
This reverts commit c415b39d67.

Glauber reports a regressions for his polled setup with this change.
As it's purely speculative, just revert it.

Reported-by: Glauber Costa <glauber.costa@datadoghq.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-20 21:40:16 -06:00
Jens Axboe 53b4f9af81 examples/io_uring-test: don't error on shorter files
The example currently assumes the file is at least 4*4096 bytes,
and errors when we get 0 reads on EOF. Fix this up.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-20 05:48:24 -06:00
Jens Axboe 7124bfa7e2 test/a4c0b3decb33-test: limit to 5000 iterations
We currently rely on this test being killed by runtests.sh, and
the test expects this and exits nicely when that happens. But let's
give it a finite runtime in general, so that running it independently
will have it exit nicely on its own as well.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-20 05:38:50 -06:00
Jens Axboe 81d63a87cb test/lfs-openat: add linked files test case
From Pavel, added a version that sets IOSQE_ASYNC as well.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-16 08:36:17 -07:00
Jens Axboe a1c610c48f test/double-poll-crash: ignore arguments
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-15 11:53:38 -07:00
Jens Axboe 85bdbaa147 Add test case for double poll crash
This is the generated syzkaller reproducer. Should be fixed by this
mainline commit:

commit d4e7cd36a90e38e0276d6ce0c20f5ccef17ec38c (HEAD -> io_uring-5.9, origin/io_uring-5.9)
Author: Jens Axboe <axboe@kernel.dk>
Date:   Sat Aug 15 11:44:50 2020 -0700

    io_uring: sanitize double poll handling

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-15 11:51:29 -07:00
Jens Axboe 8d5397ec28 test/submit-reuse: accept test argument
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-15 08:49:10 -07:00
Jens Axboe 025fa064c4 test/timeout-overflow: don't run on newer kernels
It's known to fail with the batched completions, just disable it
on newer kernels.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-13 18:00:06 -06:00
Jens Axboe be9a28a0fc test: add missing SPDX identifiers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-13 17:46:01 -06:00
Jens Axboe e6f41a5461 Add test cases for file table exit hang
This should be fixed by the kernel commit:

commit f254ac04c8744cf7bfed012717eac34eacc65dfb
Author: Jens Axboe <axboe@kernel.dk>
Date:   Wed Aug 12 17:33:30 2020 -0600

    io_uring: enable lookup of links holding inflight files

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-13 17:44:15 -06:00
Jens Axboe 29342582bd .gitignore: add test/wakeup-hang
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-13 09:56:21 -06:00
Jens Axboe 8a87557966 test/wakeup-hang: ignore argument
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-13 09:55:52 -06:00
Jens Axboe c5060b31ae Add test case for task_work related wakeup hang
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-08-07 16:46:56 -06:00
Jens Axboe c4299cd841 test/eeed8b54e0df-test: allow 4096 as valid return too
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-30 10:44:10 -06:00
Stefano Garzarella 4f0901f2a4 .gitignore: add test/nop-all-sizes
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-28 10:07:41 -06:00
Jens Axboe a4684b96ee man/io_uring_setup.2: document IORING_SETUP_ATTACH_WQ
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-24 09:48:48 -06:00
Jens Axboe a597d46be2 Merge branch 'master-debian' of https://github.com/metze-samba/liburing
* 'master-debian' of https://github.com/metze-samba/liburing:
  update debian/changelog
  update debian/liburing1.symbols
  debian/rules: pass down relativelibdir in order to get an absolute path
2020-07-22 16:58:45 -06:00
Stefan Metzmacher 9408c8b45e update debian/changelog
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2020-07-23 00:53:13 +02:00
Stefan Metzmacher de6bb79f0b update debian/liburing1.symbols
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2020-07-23 00:53:13 +02:00
Stefan Metzmacher 89661f688c debian/rules: pass down relativelibdir in order to get an absolute path
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2020-07-23 00:52:32 +02:00
Jens Axboe a82eb88c7a Merge branch 'man_newdoc' of https://github.com/xuanyi-fu/liburing
* 'man_newdoc' of https://github.com/xuanyi-fu/liburing:
  man/io_uring_setup.2: document IORING_SETUP_CLAMP
2020-07-18 08:38:04 -06:00
xuanyi-fu 01b52000bb man/io_uring_setup.2: document IORING_SETUP_CLAMP
Signed-off-by: Xuanyi Fu <xfu11@jhu.edu>
2020-07-18 15:41:40 +08:00
Jens Axboe 7fceb7d5df Merge branch 'man_fix' of https://github.com/necipfazil/liburing
* 'man_fix' of https://github.com/necipfazil/liburing:
  man/io_uring_enter: fix openat sqe doc
2020-07-16 09:01:14 -06:00
Necip Fazil Yildiran 248415a329 man/io_uring_enter: fix openat sqe doc 2020-07-16 07:33:43 +00:00
Jens Axboe 649f9969b9 test/nop-all-sizes: exit ring for each loop
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-11 10:08:45 -06:00
Jens Axboe a930a04f80 Add test case for testing full fill of SQ and CQ ring
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-11 09:49:45 -06:00
Jens Axboe 31e6ef3227 .gitignore: add test/cq-overflow-peek
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-10 08:29:37 -06:00
Tobias Klauser d07544c2f5 test/statx: test for ENOSYS in statx_syscall_supported
errno will be ENOSYS, not EOPNOTSUPP if the syscall is not there. This
also matches what errno is set to in do_statx if __NR_statx is not
defined.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-10 08:27:44 -06:00
Jens Axboe e6018d9e59 io_uring.h: sync with kernel
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-10 08:26:36 -06:00
Jens Axboe 478555bf27 test/statx: be safe and check if __NR_statx is there
Probably don't need this, but it's right before release and I'd hate
for a test to cause compilation failure.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-10 07:54:49 -06:00
Tobias Klauser 6d2ea702bc test/statx: verify against statx(2) on all archs
Use __NR_statx in do_statx and unconditionally use it to check the
result on all architectures, not just x86_64. This relies on the
fact that __NR_statx should be defined if struct statx and STATX_ALL are
available as well.

Don't fail the test if the statx syscall returns EOPNOTSUPP though.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-10 07:52:57 -06:00
Xiaoguang Wang e71d39d699 io_uring_peek_batch_cqe should also check cq ring overflow
In io_uring_peek_batch_cqe(), if the first peek could not find any
cqes, we check cq ring overflow, and if cq ring has been overflowed,
enter kernel to flush cqes, and do the second peek.

Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-09 07:59:47 -06:00
Jens Axboe 000a67651c test/cq-overflow-peek
Add test case for missing CQ flush when using peek.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-08 19:30:05 -06:00
Xiaoguang Wang 0f0b915fbe Check cq ring overflow status
If cq ring has been overflowed, need to enter kernel to flush cqes.

Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-08 19:18:08 -06:00
Tobias Klauser 328c529997 configure: fix typos in help/error messages
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-08 15:27:57 -06:00
Tobias Klauser 4b98a9df9a .gitignore: add new test binaries
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-08 15:19:00 -06:00
Jens Axboe ebbaf26d95 test/cq-full: correct error condition
We only care about if we get less than 8, it's perfectly valid to
get the full 12. In fact, once we modify peek to ensure we flush
kernel side overflows, we will get more.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-08 09:42:30 -06:00
Jens Axboe 2553ed5d7f test/cq-overflow: correct error condition
We only care about if we get less than 8, it's perfectly valid to
get the full 16. In fact, once we modify peek to ensure we flush
kernel side overflows, we will get more.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-08 09:36:17 -06:00
Jens Axboe 75e651a3d0 src/setup: clarify that we always return -errno on error
Fixes: https://github.com/axboe/liburing/issues/155
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-07 09:23:19 -06:00
Alex Nash 304fdf13d2 man/io_uring_enter.2: updated io_uring_sqe and fixed incorrect flag references.
Signed-off-by: Alex Nash <nash@vailsys.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-07-06 11:27:51 -06:00