summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
3 daysgithub: Add `-Wmissing-prototypes` for GitHub CI botHEADmasterAmmar Faizi
Using -Wmissing-prototypes ensures we mark functions and variables as static if we don't use them outside the translation unit. Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221124162633.3856761-9-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 daystest/Makefile: Omit `-Wmissing-prototypes` from the C++ compiler flagsAmmar Faizi
This is a preparation patch to integrate -Wmissing-prototypes to the CI test robot. Clang++ is not happy with -Wmissing-prototypes: cc1plus: warning: command-line option '-Wmissing-prototypes' \ is valid for C/ObjC but not for C++ Omit this flag when we are compiling a C++ source file. Using -Wmissing-prototypes ensures we mark functions and variables as static if we don't use them outside the translation unit. Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221124162633.3856761-8-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 daysucontext-cp: Mark a non-exported function as staticAmmar Faizi
Functions that are not used outside the translation unit should be static. Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221124162633.3856761-7-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 daystests: Mark non-exported functions as staticAmmar Faizi
Functions that are not used outside the translation unit should be static. Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221124162633.3856761-6-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 daysucontext-cp: Remove an unused functionAmmar Faizi
When marking all internal functions as static after an attempt to integrate `-Wmissing-prototypes` flag. An unused function is found: ucontext-cp.c:71:12: error: ‘await_poll’ defined but not used [-Werror=unused-function] 71 | static int await_poll(async_context *pctx, int fd, short poll_mask) | ^~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:36: ucontext-cp] Error 1 Remove it. Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221124162633.3856761-5-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 daystest/io_uring_setup: Remove unused functionsAmmar Faizi
When marking all internal functions as static after an attempt to integrate `-Wmissing-prototypes` flag. Unused functions are found: io_uring_setup.c:22:14: error: unused function 'features_string' [-Werror,-Wunused-function] static char *features_string(struct io_uring_params *p) ^ io_uring_setup.c:44:14: error: unused function 'flags_string' [-Werror,-Wunused-function] static char *flags_string(struct io_uring_params *p) ^ io_uring_setup.c:83:15: error: unused function 'dump_resv' [-Werror,-Wunused-function] static char * dump_resv(struct io_uring_params *p) ^ 3 errors generated. make[1]: *** [Makefile:215: io_uring_setup.t] Error 1 make[1]: *** Waiting for unfinished jobs.... Remove them. Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221124162633.3856761-4-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 daysqueue: Mark `__io_uring_flush_sq()` as staticAmmar Faizi
This function is not exported, mark it as static. Clang says: queue.c:204:10: error: no previous prototype for function \ '__io_uring_flush_sq' [-Werror,-Wmissing-prototypes] \ unsigned __io_uring_flush_sq(struct io_uring *ring) ^ queue.c:204:1: note: declare 'static' if the function is not intended \ to be used outside of this translation unit \ unsigned __io_uring_flush_sq(struct io_uring *ring) Side note: There was an attempt to export this function because it is used by test/iopoll.c and test/io_uring_passthrough.c. But after a discussion with Dylan and Jens, it's better to make a copy of this function for those tests only instead of exporting it. Therefore, also create a copy of this function in test/helpers.c. Cc: Dylan Yudaken <dylany@meta.com> Cc: Jens Axboe <axboe@kernel.dk> Link: https://lore.kernel.org/io-uring/6491d7b5-0a52-e6d1-0f86-d36ec88bbc15@kernel.dk Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221124162633.3856761-3-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 daysqueue: Fix typo "entererd" -> "entered"Ammar Faizi
s/entererd/entered/ Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221124162633.3856761-2-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 daysnolibc: Simplify function namingAmmar Faizi
Define malloc() and free() as __uring_malloc() and __uring_free() with macros when CONFIG_NOLIBC is enabled. This way the callers will just use malloc() and free() instead of uring_malloc() and uring_free(). Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221124054345.3752171-3-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 daysnolibc: Do not define `memset()` function in liburingAmmar Faizi
liburing has its own memset() in nolibc.c. liburing nolibc can be linked to apps that use libc. libc has an optimized version of memset() function. Alviro reports that he found the memset() from liburing replaces the optimized memset() from libc when he compiled liburing statically. A simple reproducer: #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { static const size_t len = 1024ul 1024ul 1024ul * 4ul; char *p; p = malloc(len); __asm__ volatile ("":"+m"(p)); memset(p, 0, len); __asm__ volatile ("":"+m"(p)); return 0; } Compile liburing with: # Build liburing nolibc. ./configure --nolibc; make -j8; # Without liburing, memset() comes from libc (good) gcc x.c -o x; objdump -d x; # With liburing.a, memset() comes from liburing (bad) gcc x.c -o x src/liburing.a; objdump -d x; When we statically link liburing, the linker will choose the statically linked memset() over the dynamically linked memset() that the libc provides. Change the function name to __uring_memset() and define a macro memset() as: #define memset(PTR, C, LEN) __uring_memset(PTR, C, LEN) when CONFIG_NOLIBC is enabled so we don't have to touch the callers. Fixes: f48ee3168cdc325233825603269f304d348d323c ("Add nolibc build support") Reported-by: Alviro Iskandar Setiawan <alviro.iskandar@gnuweeb.org> Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221124054345.3752171-2-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 daysMerge branch 'man-fix-io-uring-wait-cqe-timeout-typo' of ↵Jens Axboe
https://github.com/dmantipov/liburing * 'man-fix-io-uring-wait-cqe-timeout-typo' of https://github.com/dmantipov/liburing: man: fix io_uring_wait_cqe_timeout() typo
4 daysman: fix io_uring_wait_cqe_timeout() typoDmitry Antipov
Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
4 daysregister: Remove useless branch in register restrictionsAmmar Faizi
IORING_REGISTER_RESTRICTIONS doesn't return a positive value. This branch is useless. Remove it. [1]: io_register_restrictions Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/io_uring.c#L3665-L3733 [1] Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221123124922.3612798-6-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 daysregister: Remove useless branch in register probeAmmar Faizi
IORING_REGISTER_PROBE doesn't return a positive value. This branch is useless. Remove it. [1]: io_probe Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/io_uring.c#L3608-L3646 [1] Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221123124922.3612798-5-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 daysregister: Remove useless branch in unregister filesAmmar Faizi
IORING_UNREGISTER_FILES doesn't return a positive value. This branch is useless. Remove it. [1]: io_sqe_files_unregister Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/rsrc.c#L787-L805 [1] Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221123124922.3612798-4-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 daysregister: Remove useless branches in {un,}register buffersAmmar Faizi
IORING_REGISTER_BUFFERS and IORING_UNREGISTER_BUFFERS don't return a positive value. These bracnes are useless. Remove them. [1]: io_sqe_buffers_register [2]: io_sqe_buffers_unregister Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/rsrc.c#L1250-L1307 [1] Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/rsrc.c#L1036-L1054 [2] Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221123124922.3612798-3-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 daysregister: Remove useless branches in {un,}register eventfdAmmar Faizi
IORING_{UN,}REGISTER_EVENTFD and IORING_REGISTER_EVENTFD_ASYNC don't return a positive value. These branches are useless. Remove them. [1]: io_eventfd_register [2]: io_eventfd_unregister Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/io_uring.c#L2511-L2547 [1] Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/io_uring.c#L2549-L2564 [2] Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221123124922.3612798-2-ammar.faizi@intel.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 daysadd a test for multishot downgradingDylan Yudaken
If the poll overflows we expect multishot poll to eventually downgrade to single shot. Also the ordering of CQE's must be consistent, so check that. Signed-off-by: Dylan Yudaken <dylany@meta.com> Link: https://lore.kernel.org/r/20221124103042.4129289-3-dylany@meta.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
4 daysAdd a test for errors in multishot recvDylan Yudaken
In a later kernel release there will be deferred completions of multishot ops. Add a test to ensure ordering is preserved when there is an error during the multishot operation. Signed-off-by: Dylan Yudaken <dylany@meta.com> Link: https://lore.kernel.org/r/20221124103042.4129289-2-dylany@meta.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 daystests: check for missing multipoll eventsPavel Begunkov
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/4b0f4d96027b69d9b0f8392887dc973c5afffe31.1669079092.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 daystests: refactor poll.cPavel Begunkov
Extract all poll.c testing into a separate function Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/880d8b2607a063442659025a43240127a8887470.1669079092.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
5 daystests: remove sigalarm from poll.cPavel Begunkov
Test loop handles timeouting and killing stuck tests, no need to have a separate sigalarm in poll.c Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/cb1f7add1ede0a1f9526b53ba8ff337fd9a754c6.1669079092.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-11-10man/io_uring_prep_provide_buffers.3: clarify buffer ID rangeJens Axboe
Buffer range is always 0..65535 regardless of how the group was created, and the kernel may error any value or range that wraps. Link: https://github.com/axboe/liburing/issues/726 Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-11-08Alphabetise the test listDylan Yudaken
Alphabetical order is commanded by the comment at the top of the list, and also would have helped notice that skip-cqe.c is repeated. Signed-off-by: Dylan Yudaken <dylany@meta.com> Link: https://lore.kernel.org/r/20221108172137.2528931-1-dylany@meta.com Acked-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-11-08test that unregister_files processes task workDylan Yudaken
Ensure that unregister_files processes task work from defer_taskrun even when not explicitly flushed. Signed-off-by: Dylan Yudaken <dylany@meta.com> Reviewed-by: Ammar Faizi <ammarfaizi2@gnuweeb.org> Link: https://lore.kernel.org/r/20221108124207.751615-1-dylany@meta.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-11-07Do not always expect multishot recv to stop posting eventsDylan Yudaken
Later kernels can have a fix that does not stop multishot from posting events, and would just continue in overflow mode. Signed-off-by: Dylan Yudaken <dylany@meta.com> Link: https://lore.kernel.org/r/20221107130404.360691-1-dylany@meta.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-11-06Merge branch 'master' of https://github.com/itaysnir/liburingJens Axboe
* 'master' of https://github.com/itaysnir/liburing: test/send_recv.c: added io_uring_queue_exit call for do_send err handler
2022-11-06test/send_recv.c: added io_uring_queue_exit call for do_send err handlerItay Snir
The function do_send lacks releasing the ring, that was allocated via io_uring_queue_init. This fix releases the ring, avoiding resource leakage. Signed-off-by: Itay Snir <itaysnir@campus.technion.ac.il>
2022-11-05tests/zc: extra verification for notif completionsPavel Begunkov
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/a3149c7ca700ddb93ceceb2a32bdde1dd51d4d19.1667559818.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-11-05tests/zc: add control flags testsPavel Begunkov
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/49b3b714bce66a056b645afe894748f7cabd548d.1667559818.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-11-05tests/zc: create a new ring for test_send_faults()Pavel Begunkov
We need IORING_SETUP_SUBMIT_ALL for test_send_faults() to be sure io_uring doesn't stop submission on first failure. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/2c2adfcd0d89d1961dab3c3a1265f0d26c73e03e.1667559818.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-11-01liburing.spec: bump version to 2.4Jens Axboe
2.3 has been released, bump the library version for the next version. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-11-01Merge branch 'next'Jens Axboe
* next: tests: test both TCP ends in send zc tests tests: test poll_first tests: add tests for retries with long iovec tests: add non-zc tests in send-zerocopy.c tests: pass params in a struct tests: improve zc cflags handling test/fsnotify: only test on regular files test/pipe-bug.c: remove last remaining bzero() io_uring: add a test for missing task work Add fsnotify test case
2022-10-27tests: test both TCP ends in send zc testsnextPavel Begunkov
Test sending data from both ends of a TCP connection to tests any modifications need for zc in the accept path. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/83dce097a9930b47788cc5c14a9f19b0f901146e.1666807018.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-10-26man/io_uring_register.2: clarify that > 0 can also be successliburing-2.3Jens Axboe
It really depends on the opcode in question. Ideally we'd want to document the success returns for each, for now at least note that some will return > 0 for success. In general, the liburing man pages will have those details, though this one should too. Link: https://github.com/axboe/liburing/issues/712 Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-10-25Roughly fill in CHANGELOG for the 2.3 releaseJens Axboe
Not exhaustive, but should hit the most important changes done since the 2.2 release. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-10-24Merge branch 'frankreh/man-accept-2' of https://github.com/FrankReh/liburingJens Axboe
* 'frankreh/man-accept-2' of https://github.com/FrankReh/liburing: man/io_uring_prep_accept.3 remove bad advice man/io_uring_prep_accept.3 rework
2022-10-24Merge branch 'io_uring_prep_send_set_addr' of ↵Jens Axboe
https://github.com/metze-samba/liburing * 'io_uring_prep_send_set_addr' of https://github.com/metze-samba/liburing: fix const warning in io_uring_prep_send_set_addr()
2022-10-24Merge branch 'io_uring_uapi' of https://github.com/metze-samba/liburingJens Axboe
* 'io_uring_uapi' of https://github.com/metze-samba/liburing: uapi: Sync with the kernel in order to build systems without linux/time_types.h
2022-10-24Merge branch 'frankreh/link_io_uring_register_files_sparse' of ↵Jens Axboe
https://github.com/FrankReh/liburing * 'frankreh/link_io_uring_register_files_sparse' of https://github.com/FrankReh/liburing: symlink man/io_uring_register_files_sparse.3
2022-10-24man/io_uring_prep_accept.3 remove bad adviceFrank Rehwinkel
Fixes: https://github.com/axboe/liburing/issues/673 Signed-off-by: Frank Rehwinkel <frankrehwinkel@gmail.com>
2022-10-24symlink man/io_uring_register_files_sparse.3Frank Rehwinkel
Signed-off-by: Frank Rehwinkel <frankrehwinkel@gmail.com>
2022-10-24uapi: Sync with the kernel in order to build systems without linux/time_types.hStefan Metzmacher
Fixes: https://github.com/axboe/liburing/issues/708 Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-10-23man/io_uring_prep_accept.3 reworkFrank Rehwinkel
Make the man page more consistent with the four versions of the accept function that it describes. Signed-off-by: Frank Rehwinkel <frankrehwinkel@gmail.com>
2022-10-23fix const warning in io_uring_prep_send_set_addr()Stefan Metzmacher
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2022-10-22Merge branch 'submit-and-wait-ts'Jens Axboe
Merge in branch fixing up io_uring_submit_and_wait_timeout(). * submit-and-wait-ts: man: io_uring_submit_and_wait(_timeout) updates Add io_uring_submit_and_wait_timeout() test Revert "man/io_uring_submit_and_wait_timeout.3: fix return value description" src/queue: don't wait twice if looping in _io_uring_get_cqe() test/recv-multishot.c: check for error specifically when submitting
2022-10-22man: io_uring_submit_and_wait(_timeout) updatesJens Axboe
Clarify that earlier versions of io_uring_submit_and_wait_timeout() returned 0 on success rather than the number of submitted entries. The man page has always been correct, the implementation just didn't match the description. Clarify we're submitting requests from the SQ ring for both man pages. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-10-22Add io_uring_submit_and_wait_timeout() testsubmit-and-wait-tsJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-10-22Revert "man/io_uring_submit_and_wait_timeout.3: fix return value description"Jens Axboe
This reverts commit fccfc930d582796029f7e91b8ce744e2729a22c2. Let's make this saner rather than document the odd return of it. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-10-22src/queue: don't wait twice if looping in _io_uring_get_cqe()Jens Axboe
If the caller asks for > 1 events with a timeout and we get just 1 event, then we end up looping around and issuing an IORING_ENTER_GETEVENTS with the timeout set twice. This results in twice the timeout that the caller asked for. Add a ->has_ts argument to struct get_data and don't re-enter if we've already looped and it is set. Also be a bit saner in not overwriting the return value, if set, and return the initial value from io_uring_enter(). Signed-off-by: Jens Axboe <axboe@kernel.dk>