0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 15:04:10 +01:00

Enable io_uring on supporting platforms. (#37)

docker: Add liburing to base packages. (#37)
This commit is contained in:
Jason Volk 2022-09-04 11:08:05 -07:00
parent dcf60ae248
commit da55b185da
6 changed files with 96 additions and 18 deletions

View file

@ -1474,15 +1474,16 @@ AM_COND_IF(LINUX,
], [
aio=yes
])
], [])
])
if test "$aio" = "yes"; then
IRCD_DEFINE(USE_AIO, [1], [Linux AIO is supported and will be used])
else
IRCD_DEFINE(USE_AIO, [0], [Linux AIO is not supported and won't be used])
fi
AM_CONDITIONAL([AIO], [test "x$aio" = "xyes" ])
AM_CONDITIONAL([AIO], [[[[ $aio = yes ]]]])
AM_COND_IF([AIO],
[
IRCD_DEFINE(USE_AIO, [1], [Linux AIO is enabled and may be used])
], [
IRCD_DEFINE(USE_AIO, [0], [Linux AIO is disabled and will not be used])
])
dnl
dnl Linux io_uring support
@ -1490,21 +1491,21 @@ dnl
AM_COND_IF(LINUX,
[
AC_ARG_ENABLE(io_uring, RB_HELP_STRING([--disable-io_uring], [Disable kernel io_uring support]),
AC_ARG_ENABLE(iou, RB_HELP_STRING([--disable-iou], [Disable kernel io_uring support]),
[
io_uring=$enableval
iou=$enableval
], [
io_uring="$ac_cv_header_linux_io_uring_h"
iou=yes
])
])
AM_CONDITIONAL([IOU], [[[[ $io_uring = yes ]]]])
AM_CONDITIONAL([IOU], [test "x$iou" = "xyes" ])
AM_COND_IF([IOU],
[
IRCD_DEFINE(USE_IOU, [1], [Linux io_uring is supported and may be used])
IRCD_DEFINE(USE_IOU, [1], [Linux io_uring is enabled for use if available])
], [
IRCD_DEFINE(USE_IOU, [0], [Linux io_uring is not available])
IRCD_DEFINE(USE_IOU, [0], [Linux io_uring is disabled and will not be used])
])
@ -2623,6 +2624,63 @@ AM_COND_IF([ARMNN],
IRCD_DEFINE(USE_ARMNN, [0], [Arm NN support is not available])
])
dnl
dnl
dnl liburing
dnl
dnl
AC_SUBST(URING_CPPFLAGS, [])
AC_SUBST(URING_LDFLAGS, [])
AC_SUBST(URING_LIBS, [])
AC_ARG_WITH(uring-includes,
RB_HELP_STRING([--with-uring-includes=[[[DIR]]]], [Path to uring include directory]),
[
RB_VAR_APPEND([URING_CPPFLAGS], ["-isystem $withval"])
])
AC_ARG_WITH(uring-libs,
RB_HELP_STRING([--with-uring-libs=[[[DIR]]]], [Path to uring libraries directory]),
[
RB_VAR_APPEND([URING_LDFLAGS], ["-L$withval"])
])
dnl push
restore_cppflags=$CPPFLAGS
restore_ldflags=$LDFLAGS
RB_VAR_PREPEND([CPPFLAGS], [$URING_CPPFLAGS])
RB_VAR_PREPEND([LDFLAGS], [$URING_LDFLAGS])
RB_CHK_SYSHEADER(liburing.h, [LIBURING_H])
have_uring="no"
PKG_CHECK_MODULES(uring, [uring],
[
have_uring="$iou"
], [
AC_CHECK_LIB([uring], [io_uring_queue_init],
[
have_uring="$iou"
], [
have_uring="no"
])
])
dnl pop
CPPFLAGS=$restore_cppflags
LDFLAGS=$restore_ldflags
AM_CONDITIONAL([URING], [test "x$have_uring" = "xyes"])
AM_COND_IF([URING],
[
RB_VAR_APPEND([LIBS], ["-luring"])
IRCD_DEFINE(USE_URING, [1], [liburing's availability for use.])
], [
IRCD_DEFINE(USE_URING, [0], [liburing's availability for use.])
])
dnl
dnl
dnl boost support
@ -2738,6 +2796,7 @@ AC_SUBST(ASIO_UNIT_CPPFLAGS)
RB_VAR_APPEND([ASIO_UNIT_CPPFLAGS], ["$BOOST_CPPFLAGS"])
RB_VAR_APPEND([ASIO_UNIT_CPPFLAGS], ["$SSL_CPPFLAGS"])
RB_VAR_APPEND([ASIO_UNIT_CPPFLAGS], ["$CRYPTO_CPPFLAGS"])
RB_VAR_APPEND([ASIO_UNIT_CPPFLAGS], ["$URING_CPPFLAGS"])
dnl Units defining spirit grammars may benefit from special compiler flags due
dnl to their various complexities. The ./configure may have generated flags
@ -3064,8 +3123,7 @@ echo "LLVM library support .............. $have_libllvm"
echo "DRM support ....................... $have_drm"
echo "ARM NN support .................... $have_armnn"
echo "OpenCL support .................... $have_opencl"
echo "Linux AIO support ................. $aio"
echo "Linux io_uring support ............ $io_uring"
echo "Liburing support .................. $have_uring"
echo "Memory allocator .................. $alloc_lib"
echo
echo "Using bundled Boost ............... $with_included_boost"

View file

@ -15,6 +15,7 @@ AM_CPPFLAGS = \
@BOOST_CPPFLAGS@ \
@SSL_CPPFLAGS@ \
@CRYPTO_CPPFLAGS@ \
@URING_CPPFLAGS@ \
$(EXTRA_CPPFLAGS) \
###
@ -50,6 +51,7 @@ construct_LDFLAGS = \
@BOOST_LDFLAGS@ \
@SSL_LDFLAGS@ \
@CRYPTO_LDFLAGS@ \
@URING_LDFLAGS@ \
###
construct_LDADD = \
@ -57,6 +59,7 @@ construct_LDADD = \
@BOOST_LIBS@ \
@SSL_LIBS@ \
@CRYPTO_LIBS@ \
@URING_LIBS@ \
$(EXTRA_LIBS) \
###

View file

@ -12,6 +12,7 @@ libatomic \
libmagic \
libsodium \
libstdc++ \
liburing \
lz4 \
openssl \
rocksdb \
@ -23,6 +24,7 @@ boost-dev \
file-dev \
icu-dev \
libsodium-dev \
liburing-dev \
lz4-dev \
openssl-dev \
rocksdb-dev \

View file

@ -22,6 +22,7 @@ libsodium23 \
libssl3 \
liblz4-1 \
libmagic1 \
liburing2 \
libzstd1 \
"
@ -47,6 +48,7 @@ libicu-dev \
libmagic-dev \
libsodium-dev \
libssl-dev \
liburing-dev \
"
ENV rocksdb_cmake="\

View file

@ -44,6 +44,7 @@ namespace boost
#include <RB_INC_SYS_EPOLL_H
#include <RB_INC_SYS_TIMERFD_H
#include <RB_INC_SYS_EVENTFD_H
#include <RB_INC_LIBURING_H
#pragma GCC visibility push(internal)
#include <boost/throw_exception.hpp>
@ -51,22 +52,32 @@ namespace boost
#include <boost/system/system_error.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
#if defined(HAVE_LIBURING_H) \
&& IRCD_USE_URING == 1 \
&& BOOST_VERSION >= 107800
#define BOOST_ASIO_HAS_IO_URING
#define BOOST_ASIO_DISABLE_EPOLL
#endif
#include <boost/asio/detail/config.hpp>
#include <boost/asio/detail/socket_types.hpp>
#include <boost/asio/ssl/detail/openssl_types.hpp>
#include <boost/coroutine/coroutine.hpp>
#if defined(BOOST_ASIO_HAS_EPOLL) || defined(BOOST_ASIO_HAS_KQUEUE)
#if defined(BOOST_ASIO_HAS_EPOLL) \
|| defined(BOOST_ASIO_HAS_KQUEUE) \
|| defined(BOOST_ASIO_HAS_IO_URING)
#pragma GCC visibility push(protected)
#else
#pragma GCC visibility push(default)
#endif
#include <boost/asio.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/asio/spawn.hpp>
#include <boost/asio/ssl.hpp>
#if defined(BOOST_ASIO_HAS_EPOLL) || defined(BOOST_ASIO_HAS_KQUEUE)
#pragma GCC visibility pop
#endif
// Template-specializations for some functions we may redefine (interpose).
// Declarations are needed for template instantiation in PCH and with LTO.

View file

@ -115,6 +115,7 @@ libircd_la_LDFLAGS += @SNAPPY_LDFLAGS@
libircd_la_LDFLAGS += @LZ4_LDFLAGS@
libircd_la_LDFLAGS += @Z_LDFLAGS@
libircd_la_LDFLAGS += @MALLOC_LDFLAGS@
libircd_la_LDFLAGS += @URING_LDFLAGS@
libircd_la_LIBADD =#
libircd_la_LIBADD += @ROCKSDB_LIBS@
@ -132,6 +133,7 @@ libircd_la_LIBADD += @ZSTD_LIBS@
libircd_la_LIBADD += @SNAPPY_LIBS@
libircd_la_LIBADD += @LZ4_LIBS@
libircd_la_LIBADD += @Z_LIBS@
libircd_la_LIBADD += @URING_LIBS@
libircd_la_LIBADD += $(EXTRA_LIBS)
if PROFILE