summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-07-08Make runtests.sh output test to dmesgJens Axboe
Can be useful to figure out which test crashed. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-07-08Optimize i386 memory barriersBart Van Assche
Use identical memory barrier implementations on 32 and 64 bit Intel CPUs. In the past the Linux kernel supported 32 bit CPUs that violate the x86 ordering standard. Since io_uring is not supported by these older kernels, do not support these older CPUs in liburing. See also Linux kernel commit 5927145efd5d ("x86/cpu: Remove the CONFIG_X86_PPRO_FENCE=y quirk") # v4.16. Cc: Roman Penyaev <rpenyaev@suse.de> Suggested-by: Roman Penyaev <rpenyaev@suse.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-07-08Change __x86_64 into __x86_64__Bart Van Assche
This patch improves consistency with the Linux kernel source code. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-07-08Fix the 32-bit buildBart Van Assche
Fix the warnings reported when building liburing as follows: make CFLAGS=-m32 Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-07-08Makefiles: Support specifying CFLAGS on the command lineBart Van Assche
This patch makes the liburing build work as expected for e.g. the following command: make CFLAGS=-m32 and avoids that the build fails as follows for the above command: make[1]: Entering directory 'liburing/test' cc -m32 -o poll poll.c -luring /usr/bin/ld: cannot find -luring collect2: error: ld returned 1 exit status Makefile:18: recipe for target 'poll' failed make[1]: *** [poll] Error 1 make[1]: Leaving directory 'software/liburing/test' Makefile:12: recipe for target 'all' failed make: *** [all] Error 2 Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-07-02Fix the use of memory barriersBart Van Assche
Introduce the smp_load_acquire() and smp_store_release() macros. Fix synchronization in io_uring_cq_advance() and __io_uring_get_cqe(). Remove a superfluous local variable, if-test and write barrier from __io_uring_submit(). Remove a superfluous barrier from test/io_uring_enter.c. Cc: Stefan Hajnoczi <stefanha@redhat.com> Cc: Roman Penyaev <rpenyaev@suse.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-07-02__io_uring_get_cqe(): Use io_uring_for_each_cqe()Bart Van Assche
Use io_uring_for_each_cqe() inside __io_uring_get_cqe() such that it becomes possible to test the io_uring_for_each_cqe() implementation from inside the liburing project. Cc: Stefan Hajnoczi <stefanha@redhat.com> Cc: Roman Penyaev <rpenyaev@suse.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-06-17src/queue: cleanup sq_ring_needs_enter()Jens Axboe
Don't check for IORING_SQ_NEED_WAKEUP twice, put it inside sq_ring_needs_enter(). Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-06-17Add support for eventfd registrationJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-06-17Make io_uring registration arguments constJens Axboe
We don't modify them, make that clear. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-06-13example/io_uring-test.c: Fix iovecs incrementStephen Bates
This example misses an increment though the iovecs array. This causes the same buffer to be filled from the block device every time. It would be good to fix this since it is one of the first examples a new-comer to io_uring is exposed too. Signed-off-by: Stephen Bates <sbates@raithlin.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-06-06Add io_uring_submit_and_wait()Jens Axboe
Works just like io_uring_submit(), but also allows retrieving events (or waiting/polling for them) in the same call. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-06-04Add basic helpers for file/buffer registrationJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-06-04test/ring-leak: use static array for io_uring_register()Jens Axboe
Don't leak the memory. We never need to reference it from the test app once the io_uring_register() call is done. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-06-04test/io_uring_register: don't test buffer size if too largeJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-06-03Do not assume p->{cq,sq}_off.head is 0Kornilios Kourtis
Ring memory is released by umapping {cq,sq}->khead, which assumes that p->{cq,sq}_off.head will always be 0. Add another field to for the mmaped region and use that instead of ->khead when umapping. Signed-off-by: Kornilios Kourtis <kkourt@kkourt.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-29liburing: export io_uring_queue_mmap symbolAustin Seipp
io_uring_queue_mmap wasn't exported from the ld map file, meaning the linker gave it private, static linkage in the resulting shared object, as opposed to global linkage. This results in the symbol seemingly missing at link-time, despite the existence of the symbol in the library itself. Signed-off-by: Austin Seipp <aseipp@pobox.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-27test/fsync: use io_uring_sqe_set_flags()Jens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-27liburing: introduce io_uring_for_each_cqe() and io_uring_cq_advance()Roman Penyaev
io_uring_cqe_seen() contains write memory barrier (at least for !x86), so calling it can be very expensive for a big number of cqes. Would be better to have a loop over all available cqes and only then advance the cq ring once, e.g.: struct io_uring_cqe *cqe; unsigned nr, head; nr = 0; io_uring_for_each_cqe(&ring, head, cqe) { /* handle cqe */ if (++nr == max) break; } io_uring_cq_advance(&ring, nr); Signed-off-by: Roman Penyaev <rpenyaev@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-27liburing: introduce io_uring_cqe_set_flags() helperRoman Penyaev
Signed-off-by: Roman Penyaev <rpenyaev@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-27queue: always fill in sq->array on io_uring_submit()Roman Penyaev
io_uring_submit() is a last commit point when a caller has to be sure that all prepared sqes eventually lands to the kernel. If SQ thread is running it is quite possible that khead != ktail, thus charging of sq->array is skipped, which leads to IO hang. Nasty hang is well reproduced when submitter and completion harverster are different threads. Signed-off-by: Roman Penyaev <rpenyaev@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-27liburing,queue,setup: handle IORING_SQ_NEED_WAKEUP for io_uring_submit()Roman Penyaev
Enter kernel only if SQ thread is off or wakeup is needed. Signed-off-by: Roman Penyaev <rpenyaev@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-27setup: return -errno explicitly from io_uring_queue_init()Roman Penyaev
Signed-off-by: Roman Penyaev <rpenyaev@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-26Add pkgconfig to rpm specHrvoje Zeba
pkgconfig file is installed but not referenced in the rpm's spec file so rpmbuild fails. Signed-off-by: Hrvoje Zeba <zeba.hrvoje@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-25configure: move directory options to ./configureStefan Hajnoczi
libdir is hardcoded to ${prefix}/lib in Makefile. Fedora x86_64 uses /usr/lib64 and this means libaries will be installed in the wrong place. This patch moves prefix, includedir, libdir, and mandir into ./configure for easier customization. To build and install on Fedora x86_64: # ./configure --libdir=/usr/lib64 # make && make install Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-25pkgconfig: install a liburing.pc fileStefan Hajnoczi
pkg-config (https://pkgconfig.freedesktop.org/) makes it easier to build applications that have library dependencies. Libraries ship .pc files containing the compiler and linker flags needed to build successfully. This saves applications from hardcoding these details into their build scripts, especially when these details can change between operating systems or distributions. To build a liburing application: gcc $(pkg-config --cflags --libs liburing) -o myapp myapp.c Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-24test/send_recvmsg: code cleanups and error handlingJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-23Add send/recvmsg test caseJens Axboe
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-23io_uring.h: add send/recvmsg partsJens Axboe
This syncs with io_uring-next, which has support for doing recvmsg and sendmsg through io_uring. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-22examples/io_uring-cp: fix a NULL pointer dereferencezhangliguang
In case malloc fails, the fix returns NULL to avoid NULL pointer dereference. Signed-off-by: zhangliguang <zhangliguang@linux.alibaba.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-21clean examples when make cleanWeiping Zhang
Signed-off-by: Weiping Zhang <zhangweiping@didiglobal.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-21io_uring_submit: fix head/tail wrap issueJens Axboe
Use proper unsigned math to figure out how many entries we have. If we have head and tail on either side of UINT_MAX, then we currently don't submit anything as: while (head < tail) { is never true. Reported-by: Weiping Zhang <zhangweiping@didiglobal.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-20Fix leak of fd in io_uring_queue_init() on failureJens Axboe
If the ring setup fails, close the fd before returning failure. Reported-by: Kornilios Kourtis <kkourt@kkourt.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-20io_uring_register.2: fix multiple formatting issuesDmitry V. Levin
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-20io_uring_enter.2: fix multiple formatting issuesDmitry V. Levin
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-20io_uring_setup.2: fix multiple formatting issuesDmitry V. Levin
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-20fix harmless typo in sq_entries in io_uring_mmapWeiping Zhang
We really should use a ';' to terminate the line. This is just a cosmetic issue, no functional changes. Signed-off-by: Weiping Zhang <zhangweiping@didiglobal.com> Modified wording Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-20Add missing symbols to linker version mapHrvoje Zeba
Some of the symbols were missing from linker version script so they weren't exported in the dynamic library. Signed-off-by: Hrvoje Zeba <zeba.hrvoje@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-20syscall: add support of non-x86 architecturesDmitry V. Levin
Fortunately, all architectures except alpha have common numbers for new system calls nowadays, so support of non-alpha architectures is as simple as support of x86. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-20syscall: fix names of __NR_* macrosDmitry V. Levin
Rename __NR_sys_io_uring* to __NR_io_uring* to match kernel headers. The prefix traditionally used for macros describing syscall numbers is "__NR_", not "__NR_sys_". Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-19Merge branch 'const-matching' of https://github.com/flamingcow66/liburingJens Axboe
* 'const-matching' of https://github.com/flamingcow66/liburing: Match const signatures in io_uring_prep_* to native functions
2019-05-19Match const signatures in io_uring_prep_* to native functionsIan Gulliver
io_uring_prep_{readv,writev,read_fixed,write_fixed}() take non-const arguments that are const in the native functions that they mimic. Make those arguments const. Signed-off-by: Ian Gulliver <git@flamingcow.io>
2019-05-18Merge branch 'missing-header' of https://github.com/flamingcow66/liburingJens Axboe
* 'missing-header' of https://github.com/flamingcow66/liburing: Fix liburing.h memset() missing declaration
2019-05-18Fix liburing.h memset() missing declarationIan Gulliver
liburing.h uses memset() but doesn't include string.h. If nothing else includes it, this causes compile errors. Add the include. Signed-off-by: Ian Gulliver <git@flamingcow.io>
2019-05-18io_uring.h: sync with kernelJens Axboe
Add sync_range_file opcode and related fields, and the io_uring_register(2) commands for eventfd registration. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-18Fix manpage mmap() syntaxIan Gulliver
The examples in the io_uring_setup.2 man patch erroneously ORs the protection bits and mmap flags, fix it up. Signed-off-by: Ian Gulliver <git@flamingcow.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-16Include man dir/pages in spec file installJens Axboe
Also kill reference to long dead TODO file. Patch from Hrvoje Zeba <zeba.hrvoje@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-15examples/link-cp: improve memory useJens Axboe
Put the data at the end so we don't have to offset the actual buffer. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-15examples/link-cp: improvementsJens Axboe
Add short read requeue and abort on error. Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-05-14examples/link-cp: fix a few issuesJens Axboe
Still need to handle broken chains, must resubmit those. Signed-off-by: Jens Axboe <axboe@kernel.dk>