Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,6 @@ check_symbol_exists(kqueue "sys/event.h" TS_USE_KQUEUE)
set(CMAKE_REQUIRED_LIBRARIES uring)
check_symbol_exists(io_uring_queue_init "liburing.h" HAVE_IOURING)
unset(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_LIBRARIES aio)
check_symbol_exists(io_submit "libaio.h" HAVE_LIBAIO)
unset(CMAKE_REQUIRED_LIBRARIES)
check_symbol_exists(getresuid unistd.h HAVE_GETRESUID)
check_symbol_exists(getresgid unistd.h HAVE_GETRESGID)
check_symbol_exists(accept4 sys/socket.h HAVE_ACCEPT4)
Expand All @@ -262,12 +259,6 @@ if (HAVE_IOURING AND USE_IOURING)
set(TS_USE_LINUX_IO_URING 1)
endif(HAVE_IOURING AND USE_IOURING)

option(USE_LIBAIO "Use experimental libaio (linux only)" 0)
if (HAVE_LIBAIO AND USE_LIBAIO)
message(Using libaio)
set(TS_USE_LINUX_NATIVE_AIO 1)
endif(HAVE_LIBAIO AND USE_LIBAIO)

# Check ssl functionality
list(APPEND CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
list(APPEND CMAKE_REQUIRED_LIBRARIES
Expand Down
29 changes: 0 additions & 29 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1645,35 +1645,6 @@ AS_IF([test "x$enable_posix_cap" != "xno"],
)
AC_SUBST(use_posix_cap)

#
# If the OS is linux, we can use the '--enable-experimental-linux-native-aio' option to
# replace the aio thread mode. Effective only on the linux system.
#

AC_MSG_CHECKING([whether to enable Linux native AIO])
AC_ARG_ENABLE([experimental-linux-native-aio],
[AS_HELP_STRING([--enable-experimental-linux-native-aio], [WARNING this is experimental and has known issues enable native Linux AIO support @<:@default=no@:>@])],
[enable_linux_native_aio="${enableval}"],
[enable_linux_native_aio=no]
)

AS_IF([test "x$enable_linux_native_aio" = "xyes"], [
if test $host_os_def != "linux"; then
AC_MSG_ERROR([Linux native AIO can only be enabled on Linux systems])
fi

AC_CHECK_HEADERS([libaio.h], [],
[AC_MSG_ERROR([Linux native AIO requires libaio.h])]
)

AC_SEARCH_LIBS([io_submit], [aio], [],
[AC_MSG_ERROR([Linux native AIO requires libaio])]
)
])

AC_MSG_RESULT([$enable_linux_native_aio])
TS_ARG_ENABLE_VAR([use], [linux_native_aio])

# Check for enabling io_uring on linux

AC_MSG_CHECKING([whether to enable Linux io_uring])
Expand Down
5 changes: 0 additions & 5 deletions doc/developer-guide/testing/blackbox-testing.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ Condition Testing
- TS_USE_TLS13
- TS_USE_QUIC
- TS_HAS_QUICHE
- TS_USE_LINUX_NATIVE_AIO
- TS_HAS_SO_PEERCRED
- TS_USE_REMOTE_UNWINDING
- TS_HAS_128BIT_CAS
Expand All @@ -266,10 +265,6 @@ Examples:
+++++++++
.. code-block:: python

Test.SkipUnless(
Condition.HasATSFeature('TS_USE_LINUX_NATIVE_AIO'),
)

Test.SkipUnless(
Condition.HasCurlFeature('http2'),
)
Expand Down
1 change: 0 additions & 1 deletion include/tscore/ink_config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ const int DEFAULT_STACKSIZE = @DEFAULT_STACK_SIZE@;
#cmakedefine01 TS_USE_HWLOC
#cmakedefine01 TS_USE_KQUEUE
#cmakedefine01 TS_USE_LINUX_IO_URING
#cmakedefine01 TS_USE_LINUX_NATIVE_AIO
#cmakedefine01 TS_USE_POSIX_CAP
#cmakedefine01 TS_USE_QUIC
#cmakedefine01 TS_USE_REMOTE_UNWINDING
Expand Down
1 change: 0 additions & 1 deletion include/tscore/ink_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
#define TS_HAS_QUICHE @has_quiche@
#define TS_USE_TLS_SET_CIPHERSUITES @use_tls_set_ciphersuites@
#define TS_HAS_TLS_KEYLOGGING @has_tls_keylogging@
#define TS_USE_LINUX_NATIVE_AIO @use_linux_native_aio@
#define TS_USE_LINUX_IO_URING @use_linux_io_uring@
#define TS_USE_REMOTE_UNWINDING @use_remote_unwinding@
#define TS_HAS_TLS_EARLY_DATA @has_tls_early_data@
Expand Down
182 changes: 2 additions & 180 deletions iocore/aio/AIO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,6 @@

#include "P_AIO.h"

#if AIO_MODE == AIO_MODE_NATIVE

#ifdef HAVE_EVENTFD
#include <sys/eventfd.h>
#endif

#define AIO_PERIOD -HRTIME_MSECONDS(10)
#else

#define MAX_DISKS_POSSIBLE 100

// globals
Expand All @@ -51,7 +42,6 @@ namespace
{
void setup_prep_ops(IOUringContext *);
}

#endif

/* structure to hold information about each file descriptor */
Expand All @@ -64,7 +54,6 @@ int num_filedes = 1;
static ink_mutex insert_mutex;

int thread_is_created = 0;
#endif // AIO_MODE == AIO_MODE_NATIVE

RecInt cache_config_threads_per_disk = 12;
RecInt api_config_threads_per_disk = 12;
Expand Down Expand Up @@ -189,17 +178,12 @@ ink_aio_init(ts::ModuleVersion v, AIOBackend backend)
RecRegisterRawStat(aio_rsb, RECT_PROCESS, "proxy.process.io_uring.completed", RECD_FLOAT, RECP_PERSISTENT,
(int)AIO_STAT_IO_URING_COMPLETED, aio_stats_cb);
#endif
#if AIO_MODE == AIO_MODE_DEFAULT

memset(&aio_reqs, 0, MAX_DISKS_POSSIBLE * sizeof(AIO_Reqs *));
ink_mutex_init(&insert_mutex);
#endif

REC_ReadConfigInteger(cache_config_threads_per_disk, "proxy.config.cache.threads_per_disk");
#if TS_USE_LINUX_NATIVE_AIO
Warning(
"Running with Linux libaio is deprecated. There are known issues with this feature and it is being replaced with io_uring");
#endif

#if AIO_MODE == AIO_MODE_DEFAULT
#if TS_USE_LINUX_IO_URING
// If the caller specified auto backend, check for config to force a backend
if (backend == AIOBackend::AIO_BACKEND_AUTO) {
Expand Down Expand Up @@ -250,11 +234,8 @@ ink_aio_init(ts::ModuleVersion v, AIOBackend backend)
Note("Using thread for AIO");
}
#endif
#endif
}

#if AIO_MODE == AIO_MODE_DEFAULT

struct AIOThreadInfo : public Continuation {
AIO_Reqs *req;
int sleep_wait;
Expand Down Expand Up @@ -706,162 +687,3 @@ ink_aio_write(AIOCallback *op_in, int fromAPI)

return 1;
}
#endif

#if AIO_MODE == AIO_MODE_NATIVE
int
DiskHandler::startAIOEvent(int /* event ATS_UNUSED */, Event *e)
{
SET_HANDLER(&DiskHandler::mainAIOEvent);
e->schedule_every(AIO_PERIOD);
trigger_event = e;
return EVENT_CONT;
}

int
DiskHandler::mainAIOEvent(int event, Event *e)
{
AIOCallback *op = nullptr;
Lagain:
int ret = io_getevents(ctx, 0, MAX_AIO_EVENTS, events, nullptr);
for (int i = 0; i < ret; i++) {
op = (AIOCallback *)events[i].data;
op->aio_result = events[i].res;
ink_assert(op->action.continuation);
complete_list.enqueue(op);
}

if (ret == MAX_AIO_EVENTS) {
goto Lagain;
}

if (ret < 0) {
if (errno == EINTR)
goto Lagain;
if (errno == EFAULT || errno == ENOSYS)
Dbg(_dbg_ctl_aio, "io_getevents failed: %s (%d)", strerror(-ret), -ret);
}

ink_aiocb *cbs[MAX_AIO_EVENTS];
int num = 0;

for (; num < MAX_AIO_EVENTS && ((op = ready_list.dequeue()) != nullptr); ++num) {
cbs[num] = &op->aiocb;
ink_assert(op->action.continuation);
}

if (num > 0) {
int ret;
do {
ret = io_submit(ctx, num, cbs);
} while (ret < 0 && ret == -EAGAIN);

if (ret != num) {
if (ret < 0) {
Dbg(_dbg_ctl_aio, "io_submit failed: %s (%d)", strerror(-ret), -ret);
} else {
Fatal("could not submit IOs, io_submit(%p, %d, %p) returned %d", ctx, num, cbs, ret);
}
}
}

while ((op = complete_list.dequeue()) != nullptr) {
op->mutex = op->action.mutex;
MUTEX_TRY_LOCK(lock, op->mutex, trigger_event->ethread);
if (!lock.is_locked()) {
trigger_event->ethread->schedule_imm(op);
} else {
op->handleEvent(EVENT_NONE, nullptr);
}
}
return EVENT_CONT;
}

int
ink_aio_read(AIOCallback *op, int /* fromAPI ATS_UNUSED */)
{
op->aiocb.aio_lio_opcode = IO_CMD_PREAD;
op->aiocb.data = op;
EThread *t = this_ethread();
#ifdef HAVE_EVENTFD
io_set_eventfd(&op->aiocb, t->evfd);
#endif
t->diskHandler->ready_list.enqueue(op);

return 1;
}

int
ink_aio_write(AIOCallback *op, int /* fromAPI ATS_UNUSED */)
{
op->aiocb.aio_lio_opcode = IO_CMD_PWRITE;
op->aiocb.data = op;
EThread *t = this_ethread();
#ifdef HAVE_EVENTFD
io_set_eventfd(&op->aiocb, t->evfd);
#endif
t->diskHandler->ready_list.enqueue(op);

return 1;
}

int
ink_aio_readv(AIOCallback *op, int /* fromAPI ATS_UNUSED */)
{
EThread *t = this_ethread();
DiskHandler *dh = t->diskHandler;
AIOCallback *io = op;
int sz = 0;

while (io) {
io->aiocb.aio_lio_opcode = IO_CMD_PREAD;
io->aiocb.data = io;
#ifdef HAVE_EVENTFD
io_set_eventfd(&op->aiocb, t->evfd);
#endif
dh->ready_list.enqueue(io);
++sz;
io = io->then;
}

if (sz > 1) {
ink_assert(op->action.continuation);
AIOVec *vec = new AIOVec(sz, op);
while (--sz >= 0) {
op->action = vec;
op = op->then;
}
}
return 1;
}

int
ink_aio_writev(AIOCallback *op, int /* fromAPI ATS_UNUSED */)
{
EThread *t = this_ethread();
DiskHandler *dh = t->diskHandler;
AIOCallback *io = op;
int sz = 0;

while (io) {
io->aiocb.aio_lio_opcode = IO_CMD_PWRITE;
io->aiocb.data = io;
#ifdef HAVE_EVENTFD
io_set_eventfd(&op->aiocb, t->evfd);
#endif
dh->ready_list.enqueue(io);
++sz;
io = io->then;
}

if (sz > 1) {
ink_assert(op->action.continuation);
AIOVec *vec = new AIOVec(sz, op);
while (--sz >= 0) {
op->action = vec;
op = op->then;
}
}
return 1;
}
#endif // AIO_MODE != AIO_MODE_NATIVE
Loading