summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-05-16test/nop: make less verbose and don't fail on older kernelsbig-sqeJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16liburing: Update io_uring.hKrishna Kanth Reddy
This updates the io_uring.h file with the changes in the kernel. Fixed the build issue that arises because of the updated fields. Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
2022-05-16liburing: Test all configurations with NOP testStefan Roesch
This runs the NOP test with all four configurations: - default SQE and CQE size - large SQE size - large CQE size - large SQE and large CQE size Signed-off-by: Stefan Roesch <shr@fb.com> Link: https://lore.kernel.org/r/20220425182639.2446370-7-shr@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16liburing: add large CQE tests to nop testStefan Roesch
This adds two test cases for large CQE's: - Single NOP test, which checks that the new extra1 and extra2 fields are set. - Multiple NOP submission test which also checks for the new fields. Signed-off-by: Stefan Roesch <shr@fb.com> Link: https://lore.kernel.org/r/20220425182639.2446370-6-shr@fb.com [axboe: fixup cqe naming] Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16liburing: index large CQE's correctlyStefan Roesch
Large CQE's need to take into account that each CQE has double the size. When the CQE array is indexed, the offset into the array needs to be changed accordingly. Signed-off-by: Stefan Roesch <shr@fb.com> Link: https://lore.kernel.org/r/20220425182639.2446370-5-shr@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16liburing: return correct ring size for large CQE'sStefan Roesch
Return the correct ring_size when large CQE's are used. Signed-off-by: Stefan Roesch <shr@fb.com> Link: https://lore.kernel.org/r/20220425182639.2446370-4-shr@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16liburing: increase mmap size for large CQE'sStefan Roesch
This doubles the mmap size for large CQE's. Signed-off-by: Stefan Roesch <shr@fb.com> Link: https://lore.kernel.org/r/20220425182639.2446370-3-shr@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16liburing: Update io_uring.h with large CQE kernel changesStefan Roesch
This updates the io_uring.h file with the changes in the kernel. Signed-off-by: Stefan Roesch <shr@fb.com> Link: https://lore.kernel.org/r/20220425182639.2446370-2-shr@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16test/nop: add basic IORING_SETUP_SQE128 testsJens Axboe
Just repeats the original test cases, but using a big ring. Assign and check for user_data never being NULL, which would be a common issue with mistakes between big and normal SQEs. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16setup: add basic support for SQE128Jens Axboe
Adjust the helpers for getting ring size and knowing how much memory we need for a ring of a given size, and basic support for knowing how much to increment a ring when an SQE is allocated. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16io_uring.h: add IORING_SETUP_SQE128Jens Axboe
This asks the kernel to setup a ring with 128-byte SQE entries. May fail with -EINVAL if the kernel doesn't support this feature. If the kernel does support the feature, then the ring will support big sqe entries which some commands may require. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-16Merge branch 'xattr'Jens Axboe
* xattr: 32-bit build warning cleanups test/xattr: don't fail on kernels not supporting the feature test/xattr: style fixups test/xattr: specify file mode with O_CREAT liburing: Add new test program to verify xattr support liburing: Add helper functions for fgetxattr and getxattr liburing: add helper functions for setxattr and fsetxattr liburing: Update io_uring in liburing Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14test/send_recvmsg.c: only check buffer group ID if setJens Axboe
This test assumes that the only valid flag being set for a send/recv is IORING_CQE_F_BUFFER. But that isn't necessarily true, so check specifically for whether this is a provided buffer return before checking the buffer group ID. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14io_uring.h: add IORING_RECVSEND_POLL_FIRSTJens Axboe
This flag can be used by send/sendmsg or recv/recvmsg to tell io_uring that it expects the socket to not be immediately ready for send or recv. For that case, it's worthless trying to do IO first, it's better to just arm poll internally and let that drive the first attempt. Can be used in conjunction with the IORING_CQE_F_SOCK_NONEMPTY feedback from the kernel, or independently. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14io_uring.h: add IORING_CQE_F_SOCK_NONEMPTYJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14test/open-direct-pick.c: add test case for open direct with allocJens Axboe
Test case that tests the basic functionality of openat with direct descriptors and asking io_uring to allocate the descriptors. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14Merge branch 'cancel-fd-all'Jens Axboe
* cancel-fd-all: test/poll-cancel-all: add async read test case test/poll-cancel-all: test IORING_ASYNC_CANCEL_ANY io_uring.h: add IORING_ASYNC_CANCEL_ANY test/poll-cancel-all: abort test if cancel flags not supported test/poll-cancel-all: add test case canceling a subset of pending test/poll-cancel-all: test issuing CANCEL_ALL | CANCEL_FD liburing.h: add io_uring_prep_cancel_fd() io_uring: add new cancel flags
2022-05-14Add sparse registration helper and kernel definitionJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-14queue: add new IORING_SQ_TASKRUN flagJens Axboe
Check it in cq_ring_needs_flush(), so that a peek operation will notice and enter the kernel to flush completions. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-10man: update man pages for waiting on a CQE with a timeoutJens Axboe
On older kernels, it was indeed true that you did not need to separately submit before doing a wait, IFF you used a timeout. However, this is not true since kernels supported IORING_ENTER_EXT_ARG. Link: https://github.com/axboe/liburing/issues/579 Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-05-02test/statx: use regular stat includeJens Axboe
Link: https://github.com/axboe/liburing/issues/578 Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test/double-poll-crash: Skip this test if the `mmap()` failsAmmar Faizi
This test is very prone to hiting a SIGSEGV signal due to missing error handling on mmap() calls. This especially often happens when executing `runtests-parallel`. Let's just skip this test if those calls fail instead of having a random segfault with no clear resolution. Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22.github/workflows: Run the nolibc build for x86 32-bitAmmar Faizi
Since commit: b7d8dd8bbf5b ("arch/x86/syscall: Add x86 32-bit native syscall support") liburing supports nolibc build for x86 32-bit. Run the nolibc build for this arch on the GitHub bot too. Currently, liburing nolibc is only available for: - x86-64. - x86 (32-bit). Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test/Makefile: Sort the test file list alphabeticallyAmmar Faizi
Make it easy to manage and find by sorting it alphabetically. Also, add a comment to remind us to keep it sorted alphabetically. Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test/Makefile: Remove `.PHONY` variableAmmar Faizi
What we want is a .PHONY build target that depends on runtests-parallel, not a .PHONY variable. This variable doesn't do anything. Remove it. Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22Makefile: Make sure we build everything before runtestsAmmar Faizi
A recent commit added `runtests-parallel` target to run the tests in parallel. But it doesn't have a proper build dependency. As such, when doing: make -j clean; make -j runtests-parallel; we got this error: ``` make[1]: Entering directory '/home/ammarfaizi2/app/liburing/test' make[1]: *** No rule to make target '232c93d07b74.t', needed by '232c93d07b74.run_test'. Stop. make[1]: Leaving directory '/home/ammarfaizi2/app/liburing/test' make: *** [Makefile:25: runtests-parallel] Error 2 ``` Add `all` target as the dependency of `runtests-parallel`. While in there, I found the same issue on `runtests-loop` target. Do the same thing for it too. This way the main Makefile will build everything first before trying to execute the tests. Cc: Dylan Yudaken <dylany@fb.com> Fixes: 4fb3c9e9c737c2cf2d4df4e1972e68d596a626f7 ("Add runtests-loop target") Fixes: 6480f692d62afbebb088febc369b30a63dbc2ea7 ("test: add make targets for each test") Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test/runtests-quiet.sh: Fixup redirectionAmmar Faizi
1) command > file.txt will redirect the stdout to file.txt. 2) command > file.txt 2>&1 will redirect the stdout and stderr to file.txt. What we want is (2). Previous commits placed the "2>&1" wrong. Cc: Dylan Yudaken <dylany@fb.com> Fixes: 770efd14e8b17ccf23a45c95ecc9d38de4e17011 ("test/runtests-quiet.sh: fixup redirection") Fixes: 6480f692d62afbebb088febc369b30a63dbc2ea7 ("test: add make targets for each test") Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test/runtests-quiet.sh: fixup redirectionJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test/runtests-quiet.sh: quote file namesJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test: use remove_buffers instead of nop to generate error codesDylan Yudaken
This is in prep for allwoing NOP to be used in IOPOLL mode. remove_buffers will consistently return ENOENT if asked to remove buffers from a nonexistent group, and so this is a suitable replacement. Other opcodes return -EINVAL in IOPOLL from the prep stage, which has slightly different behaviour. Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220422160132.2891927-8-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test: add make targets for each testDylan Yudaken
Add a make target runtests-parallel which can run tests in parallel. This is very useful to quickly run all the tests locally with $ make -j runtests-parallel Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220422160132.2891927-7-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test: mkdir -p output folderDylan Yudaken
In case multiple mkdir are running at once, do not log an error if it exists due to a race condition. Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220422160132.2891927-6-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test: use unique filenamesDylan Yudaken
Allow tests to be run in parallel Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220422160132.2891927-5-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test: use unique portsDylan Yudaken
In preparation for running tests in parallel remove some collisions in ports. In the future this should probably use ephemeral ports, but for now there are not too many places to change. Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220422160132.2891927-4-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test: use unique path for socketDylan Yudaken
Do not collide if multiple tests are running at once. Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220422160132.2891927-3-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-22test: handle mmap return failures in pollfree testDylan Yudaken
Sometimes these mmap's fail, and it causes SEGFAULTS. I assume this was accidentally left off when this was originally landed. Signed-off-by: Dylan Yudaken <dylany@fb.com> Link: https://lore.kernel.org/r/20220422160132.2891927-2-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-21arch/x86/syscall: Remove TODO commentAmmar Faizi
nolibc support for x86 32-bit has been added in commit b7d8dd8bbf5b855 ("arch/x86/syscall: Add x86 32-bit native syscall support"). But I forgot to remove the comment that says "We can't use CONFIG_NOLIBC for x86 (32-bit)". Remove it. Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20220421075205.98770-1-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-18arch/x86/syscall: Add x86 32-bit native syscall supportAmmar Faizi
Create __do_syscall{0..6} macros for x86 32-bit. Unlike x86-64, only use these macros when CONFIG_NOLIBC is enabled for a 32-bit build. The reason is that the libc syscall wrapper can do better in 32-bit. libc syscall wrapper can dispatch the best syscall instruction that the environment is supported, there are at least two variants of syscall instruction for x86 32-bit, they are: `int $0x80` and `sysenter`. The `int $0x80` instruction is always available, but `sysenter` is not, it relies on VDSO. liburing always uses `int $0x80` for syscall if it's compiled with CONFIG_NOLIBC, otherwise, it uses whatever the libc provides. Extra notes for __do_syscall6() macro: On i386, the 6th argument of syscall goes in %ebp. However, both Clang and GCC cannot use %ebp in the clobber list and the "r" constraint without using -fomit-frame-pointer. To make it always available for any kind of compilation, the below workaround is implemented: 1) Push the 6-th argument. 2) Push %ebp. 3) Load the 6-th argument from 4(%esp) to %ebp. 4) Do the syscall (int $0x80). 5) Pop %ebp (restore the old value of %ebp). 6) Add %esp by 4 (undo the stack pointer). WARNING: Don't use register variables for __do_syscall6(), there is a known GCC bug that results in an endless loop. BugLink: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105032 Link: https://lore.kernel.org/lkml/2e335ac54db44f1d8496583d97f9dab0@AcuMS.aculab.com Suggested-by: David Laight <David.Laight@ACULAB.COM> Co-authored-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org> Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org> Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20220414224001.187778-4-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-18arch/x86/lib: Provide `get_page_size()` function for x86 32-bitAmmar Faizi
A preparation to add nolibc support for x86 32-bit. Provide get_page_size() function for x86 32-bit. x86 32-bit and x86-64, both have the same page size 4K, and they can share the same function definition. Just remove the #ifdef here. Co-authored-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org> Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org> Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20220414224001.187778-3-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-18arch/syscall-defs: Use `__NR_mmap2` instead of `__NR_mmap` for x86 32-bitAmmar Faizi
A preparation to add x86 32-bit native syscall support for the nolibc build. On x86 32-bit, the __NR_mmap maps to sys_old_mmap: long sys_old_mmap(struct mmap_arg_struct __user *arg); which only receives one argument and is not suitable with the canonical mmap() definition we use. As such, use __NR_mmap2 that maps to sys_mmap_pgoff: long sys_mmap_pgoff(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff); Note: For __NR_mmap2, the offset must be shifted-right by 12-bit. Co-authored-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org> Signed-off-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org> Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20220414224001.187778-2-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-17tests: add more file registration testsPavel Begunkov
Add tests for file registration failing in the middle of the fd set, and mixing files that need and don't SCM accounting + checking for underflows. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/b868cdd8d996a53a196e9cfb8807d07d318ef876.1650205541.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-17tests: extend scm cycle breaking testsPavel Begunkov
Add a test with file ref dependency, which is actually checks that the files are removed and put. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/bf406c7d141b46f1fa94e72b9ba853dd72f27561.1650186365.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-17tests: reduce multicqe_drain waiting timePavel Begunkov
sleep(4) is too long and not needed, wait just for one second, should be good enough. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/5f2ddf9fb44d4b746c12654dad649db1470c2748.1650186365.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-16test/poll-cancel-all: add async read test casecancel-fd-allJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-16test/poll-cancel-all: test IORING_ASYNC_CANCEL_ANYJens Axboe
_ANY will match any request, no keys needed. Allows canceling any request on the ring. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-16io_uring.h: add IORING_ASYNC_CANCEL_ANYJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-16test/poll-cancel-all: abort test if cancel flags not supportedJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-16test/poll-cancel-all: add test case canceling a subset of pendingJens Axboe
Have two different files active, cancel each set separately and check we get the expected results. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-16Add eventfd register/unregister man pagesJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-04-16man/io_uring_register.2: clarify eventfd notification countsJens Axboe
We may see both spurious eventfd notifications (eg an eventfd notification was posted, yet no CQEs are available), as well as batched notifications where a batch of CQEs are posted but only a single eventfd notification generated. Signed-off-by: Jens Axboe <axboe@kernel.dk>