Age | Commit message (Collapse) | Author |
|
io_uring depends on the caller specifying the index into the array
of registered buffers for doing pre-mapped IO. Make this explicit
by requiring the caller to pass in this value for the
io_uring_prep_read_fixed() and io_uring_prep_write_fixed() helpers.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Currently we return 0 if someone calls io_uring_peek_cqe(), but
we really should be returning 0 only if we managed to find a
completion entry.
Return -EAGAIN to notify the caller that no entries are there.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
The configure script used the default value of the prefix variable
(/usr) to determine the includedir etc. *before* parsing the command
line to determine if the user specified a prefix. This made configure
--prefix ineffective.
Fix.
Tested with configure --help, configure --prefix, configure --prefix
--includedir
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Rename the newly added arm barriers and READ/WRITE_ONCE
to avoid using popular names.
Signed-off-by: Julia Suvorova <jusual@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
The names of the barriers conflict with the namespaces of other projects
when trying to directly include liburing.h. Avoid using popular global
names.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Julia Suvorova <jusual@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
making liburing on arm64 platform failed. let's support it.
root@Kylin:/# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux buster/sid"
root@Kylin:/# gcc -v
gcc version 8.2.0 (Debian 8.2.0-20)
root@Kylin:~/liburing# make
make[1]: Entering directory '/root/liburing/src'
cc -g -fomit-frame-pointer -O2 -Wall -Iinclude/ -c -o setup.ol setup.c
In file included from include/liburing.h:14,
from setup.c:10:
include/liburing.h: In function 'io_uring_cq_advance':
include/liburing/barrier.h:73:2: warning: implicit declaration of function 'smp_mb'; did you mean 'smp_wmb'? [-Wimplicit-function-declaration]
smp_mb(); \
^~~~~~
include/liburing.h:111:3: note: in expansion of macro 'smp_store_release'
smp_store_release(cq->khead, *cq->khead + nr);
^~~~~~~~~~~~~~~~~
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Mostly for the purposes of github
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
There are two issues with the <liburing/*.h> headers:
1. They are installed with 0755 permissions.
2. The empty /usr/include/liburing/ directory is left behind by rpm -e.
Fix this by specifying the directory (not just globbing the files inside
it) and letting rpm use the default permissions on these files.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
rpmlint complains that there is no URL tag pointing to the software's
website/documentation. Since liburing does not have a landing page,
point to the cgit page where all information can be found.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
rpmlint complains that "LGPL" is not a valid License tag. The License
tag for "GNU Lesser General Public License v2 (or 2.1) or later" is
"LGPLv2+" according to:
https://fedoraproject.org/wiki/Licensing:Main
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
rpmlint spotted that the LGPL v2.1 license file is outdated so I've
replaced it with the latest one from
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
The Free Software Foundation address is outdated in COPYING and the file
still mentions LGPL v2 where the latest text mentions v2.1:
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
It is not possible to install barrier.h and compat.h into the top-level
/usr/include directly since they are likely to conflict with other
software. io_uring.h could be confused with the system's kernel header
file.
Put liburing headers into <liburing/*.h> so there is no chance of
conflicts or confusion.
Existing applications continue to build successfully since the location
of <liburing.h> is unchanged. In-tree examples and tests require
modification because src/liburing.h is moved to src/include/liburing.h.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
The top-level makefile passes in includedir and libdir so we should
not override them.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Commit fd26c1a2f0eb ("configure: move directory options to ./configure")
moved --prefix=PREFIX and other directory options to ./configure.
Invoke ./configure with these options instead of passing them to the
makefile.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Rebuild the .pc file when config-host.mak changes since @prefix@,
@libdir@, etc could have changed.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Yum doesn't like packages taking ownership of
directories provided by other packages.
Signed-off-by: Hrvoje Zeba <zeba.hrvoje@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Add descriptions of these SQE flags.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
typeof() is not available on all compilers. __typeof() is
a safer bet.
Signed-off-by: Hrvoje Zeba <zeba.hrvoje@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Can be useful to figure out which test crashed.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Don't check for IORING_SQ_NEED_WAKEUP twice, put it inside
sq_ring_needs_enter().
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
We don't modify them, make that clear.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
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>
|
|
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>
|
|
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
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>
|
|
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
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>
|
|
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>
|
|
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
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>
|
|
Signed-off-by: Roman Penyaev <rpenyaev@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
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>
|
|
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>
|
|
Signed-off-by: Roman Penyaev <rpenyaev@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
|
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>
|
|
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>
|