Commit Graph

76 Commits

Author SHA1 Message Date
Jens Axboe
26993e9872 Add SQ/CQ overflow tests
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-17 08:57:25 -06:00
Jens Axboe
8115820eb9 test/nop: add NOP test case
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-11 09:01:16 -06:00
Jens Axboe
093e902c28 test/fsync: error out if we submit less than we wanted
This failure is expected on kernels that don't support the DRAIN
primitive.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-11 09:00:47 -06:00
Jens Axboe
9864409788 test/fsync: update for IOSQE_IO_DRAIN approach
I generalized the barrier flag to be applicable to all commands, so
let's drop the fsync special flag.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-10 21:56:54 -06:00
Jens Axboe
0656d71c96 man/io_uring_setup.2: add EPERM case for IORING_SETUP_SQPOLL
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-10 08:41:42 -06:00
Jens Axboe
db11f116c7 Use io_uring_cqe_get_data() internally
Replace all cqe->user_data casts with io_uring_cqe_get_data().

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-07 18:36:43 -06:00
Zach Bjornson
1245d8320a Add io_uring_cqe_get_data()
Signed-off-by: Zach Bjornson <zbbjornson@gmail.com>

Add uintptr_t cast to avoid 32-bit warnings.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-07 18:35:30 -06:00
Jens Axboe
61c27f73f8 Add barrier fsync test case
Also changes the fsync prep helper to require passing in the actual
flag, not just a boolean for fsync vs fdatasync.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-04-06 21:50:15 -06:00
Jens Axboe
f8b12e48bf Remove IOCQE_FLAG_CACHEHIT
This cache hint has been removed from the io_uring series, as there's
some hesitation to leak this information to userspace. Remove it from
the header file and the man page. We can always re-introduce it later,
if we get some variant of this included.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-19 10:01:55 -06:00
Jens Axboe
a86522197d queue: ensure io_uring_submit() returns the system call value
A previous fix that ensured we pass back the right error messed
up the normal return, which is number of entries submitted.
This makes the poll test cases fail.

Fixes: 8260029608 ("queue: ensure io_uring_submit() returns the right error")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-13 08:48:45 -06:00
Jens Axboe
a231fdcaa1 test/io_uring-cp: add some comments
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-06 08:31:26 -07:00
Jens Axboe
5fefee2333 Add generated files to .gitignore
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-06 08:31:11 -07:00
Jens Axboe
f7dac56b4a test/io_uring-cp: make it more efficient
Clean it up, and just use a single io_uring for both the reads
and the writes.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-05 20:41:34 -07:00
Jens Axboe
8260029608 queue: ensure io_uring_submit() returns the right error
We weren't passing back -errno for the system call failure.
This meant any error got turned into EPERM as far as the
caller was concerned.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-05 20:12:48 -07:00
Jens Axboe
b080d0680c Makefile: add cscope target
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-05 16:19:59 -07:00
Jeff Moyer
765ba233c8 add syscall unit tests
Add tests for io_uring_setup, io_uring_register and io_uring_enter.
The test coverage is nowhere near complete and the reporting is not
uniform.  But, it's a start.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-03-04 15:37:40 -07:00
Jens Axboe
432fa1d3d1 Add read/write fixed prep support
Also unify the setup, all the read/write variants can use the same
helper.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-28 13:38:41 -07:00
Jens Axboe
5b5e6fe360 src/queue: kill bogus ktail_next == head check
This really wants to be a "will we over-fill the ring?" kind of
check, but the sqe_head/sqe_tail should not be that far apart. If they
are, that's a bug elsewhere. So just kill the check.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-15 10:43:03 -07:00
Jeff Moyer
10a57a0823 io_uring_enter.2: clarify min_complete
min_complete means slightly different things depending on how the ring
was setup.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-14 17:13:44 -07:00
Jens Axboe
1a3020e7b4 man/io_uring_enter.2: clarify -EMFILE per-user case
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-12 14:11:34 -07:00
Jens Axboe
37e48698a0 man/io_uring_enter.2: add mention of -EMFILE for fixed file sets
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-12 10:31:52 -07:00
Jens Axboe
87ec82f00f man/io_uring_enter: mention that SQE entries are always fully consumed
With a recent change to the kernel side, we now fully guarantee that
once io_uring_enter(2) returns that X entries have been submitted, it's
completely safe to reuse tohse entries. This used to not always be the
case, if an SQE had to be punted to async context for submission.

This makes for a more reliable and nicer interface.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-10 15:54:30 -07:00
Jens Axboe
f62fdcd852 Sync io_uring.h with the kernel
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-10 09:36:24 -07:00
Jens Axboe
520efcd606 src/queue: add comments on the read and write barriers
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-10 08:19:54 -07:00
Jens Axboe
e9aa44135b man/io_uring_register: make note of huge page pinning
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-09 09:48:57 -07:00
Jens Axboe
6726376f32 test/fsync: add simple fsync tester
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08 21:02:00 -07:00
Jeff Moyer
996b5a65a5 add io_uring_queue_mmap
io_uring_queue_init does not allow the caller to specify sq_thread_cpu
or sq_thread_idle.  Users that want to specify those parameters need to
call io_uring_setup(2) themselves.  Add a helper so that they don't also
have to hand-craft the code to map the submission and completion queues,
and setup the sqe ring.  This allows those applications to still make
use of io_uring_submit and get/wait_completion.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08 12:56:35 -07:00
Jeff Moyer
bd7ad347f9 remove sigsz from io_uring_enter.2
Users shouldn't be concerned with the size of the sigset.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08 12:41:28 -07:00
Jens Axboe
e377c38ca7 io_uring_enter: don't expose sigset_size argument
Applications should not need to care about this, we can pass it in
ourselves. Once the libc support is there, we won't expose this
parameter either.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08 11:40:17 -07:00
Jens Axboe
f171fa43ab test/ring-leak: silence "sending fd" message
We assume that a silent test is good.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08 11:34:38 -07:00
Jeff Moyer
3ceb15c132 Add sigmask parameter to io_uring_enter
Update liburing and io_uring_enter.2 to match the kernel.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08 11:33:28 -07:00
Jens Axboe
9f3bec5b09 syscall: update io_uring_enter() to match kernel type
We would randomly fail depending on what garbage was passed in
the two sigset related fields.

Reported-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08 10:33:00 -07:00
Jens Axboe
bed7020ffe man/io_uring_register.2: add EMFILE errno
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-08 08:19:25 -07:00
Jens Axboe
5e6a93cf0b test/ring-leak: add test app demonstrating leak of io_uring instance
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-07 12:27:23 -07:00
Jens Axboe
8471fb944d man/io_uring_setup: mention that IORING_SETUP_SQPOLL needs fixed files
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-05 11:42:04 -07:00
Jeff Moyer
450033065f io_uring_register takes 4 args
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-02-05 11:37:19 -07:00
Jens Axboe
be33b0a219 src/io_uring.h: sync with kernel header
Just a removal of the IORING_MAX_ENTRIES user visible define.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-31 22:58:02 -07:00
Jens Axboe
091b18fb85 man/io_uring_enter.2: we no longer EBUSY on mutex trylock failure
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-31 22:57:14 -07:00
Jeff Moyer
59bb09c553 man: add io_uring_setup.2 man page
Initial man page for io_uring_setup.  Content was taken from the kernel
commit logs and from an LWN article written by Jon Corbet.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-30 06:43:00 -07:00
Jens Axboe
27ad3317fb Update kernel io_uring header
- struct io_uring_params changed (u16 -> u32 for sq options)
- Use unsigned for the flag types

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-29 06:32:13 -07:00
Jeff Moyer
9688b4a00f man: fixup description of fixed files I/O
The man page suggests that IOSQE_FIXED_FILE must be specified for all
sqes when the io_uring instance has files registered.  This is not
the case, so clear that up.

Also fix a typo (few->new) while we're in there.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-26 06:40:48 -07:00
Jeff Moyer
2a8e5b105c man: io_uring_register: use a .TP list for flags
This seems to be the canonical way to do things.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-26 06:40:47 -07:00
Jeff Moyer
4a700b7e35 man: alphabetize the error section for io_uring_register
This also includes a couple of whitespace cleanups.  Most man pages
don't leave spaces between directives.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-26 06:40:44 -07:00
Jens Axboe
bceccde79a System calls have been renumbered
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-23 08:03:41 -07:00
Jeff Moyer
81f9d4616e io_uring_enter.2 man page
Initial man page for io_uring_enter.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-22 12:57:07 -07:00
Jens Axboe
bc4e4a7427 test/poll: ignore parent dying
The parent may well die before the child is done, as long as it wrote to
the pipe, we're fine.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-18 18:48:40 -07:00
Jens Axboe
a2fc9f13b5 test/poll: simply test case
Just setup one ring in the child process, and poll for when the
read side of the pipe is readable. From the parent, write something
to the pipe.

If nothing happens within 1 second, fail the test.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-18 15:14:43 -07:00
Jens Axboe
d58ea1a0ea test/poll-cancel: improve test case
- Add a timeout, if we don't finish in one second we are definitely
  hung because the poll remove command didn't work.
- Don't assume completion ordering

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-18 08:29:44 -07:00
Jens Axboe
3640699bea Switch to IORING_OP_POLL_ADD/REMOVE
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-18 07:00:14 -07:00
Jens Axboe
213d6f39ef Split src/io_uring.c up
Let's have the various helpers be in usefully named functions, no
need to bundle them all into the same one.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-01-17 21:40:30 -07:00