From cca62c633fdd0911b26e5161c6b3a7bfacb33127 Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Thu, 30 Jul 2020 19:30:11 +0800 Subject: [PATCH] bdev/uring: Do not use IORING_SETUP_IOPOLL. Because of the Linux kernel has limitation, IORING_SETUP_IOPOLL is only used for local devices (e.g., local files, pcie NVMe SSDs etc.). However, it does not work for devices atttached from the remote. So in order to make bdev uring generic, Let's do not use IORING_SETUP_IOPOLL to create the uring. Change-Id: I6aea1ff222a8a0d67ab040ada75aa0ef6730e725 Signed-off-by: Ziye Yang Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3587 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- include/spdk_internal/uring.h | 12 ------------ module/bdev/uring/bdev_uring.c | 20 ++++++++------------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/include/spdk_internal/uring.h b/include/spdk_internal/uring.h index ff22f11d4..86c39945c 100644 --- a/include/spdk_internal/uring.h +++ b/include/spdk_internal/uring.h @@ -36,16 +36,4 @@ #include -#ifndef __NR_sys_io_uring_enter -#define __NR_sys_io_uring_enter 426 -#endif - -static int -spdk_io_uring_enter(int ring_fd, unsigned int to_submit, - unsigned int min_complete, unsigned int flags) -{ - return syscall(__NR_sys_io_uring_enter, ring_fd, to_submit, - min_complete, flags, NULL, 0); -} - #endif /* SPDK_INTERNAL_URING_H */ diff --git a/module/bdev/uring/bdev_uring.c b/module/bdev/uring/bdev_uring.c index 494cc4794..e11783ea9 100644 --- a/module/bdev/uring/bdev_uring.c +++ b/module/bdev/uring/bdev_uring.c @@ -244,26 +244,20 @@ bdev_uring_group_poll(void *arg) int count, ret; to_submit = group_ch->io_pending; - to_complete = group_ch->io_inflight; - ret = 0; if (to_submit > 0) { /* If there are I/O to submit, use io_uring_submit here. * It will automatically call spdk_io_uring_enter appropriately. */ ret = io_uring_submit(&group_ch->uring); + if (ret < 0) { + return SPDK_POLLER_BUSY; + } + group_ch->io_pending = 0; group_ch->io_inflight += to_submit; - } else if (to_complete > 0) { - /* If there are I/O in flight but none to submit, we need to - * call io_uring_enter ourselves. */ - ret = spdk_io_uring_enter(group_ch->uring.ring_fd, 0, 0, - IORING_ENTER_GETEVENTS); - } - - if (ret < 0) { - return SPDK_POLLER_BUSY; } + to_complete = group_ch->io_inflight; count = 0; if (to_complete > 0) { count = bdev_uring_reap(&group_ch->uring, to_complete); @@ -426,7 +420,9 @@ bdev_uring_group_create_cb(void *io_device, void *ctx_buf) { struct bdev_uring_group_channel *ch = ctx_buf; - if (io_uring_queue_init(SPDK_URING_QUEUE_DEPTH, &ch->uring, IORING_SETUP_IOPOLL) < 0) { + /* Do not use IORING_SETUP_IOPOLL until the Linux kernel can support not only + * local devices but also devices attached from remote target */ + if (io_uring_queue_init(SPDK_URING_QUEUE_DEPTH, &ch->uring, 0) < 0) { SPDK_ERRLOG("uring I/O context setup failure\n"); return -1; }