From d2a194c4f09bb0e36a64a14fa687a1555e105a6a Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Tue, 28 Jul 2020 08:23:47 +0800 Subject: [PATCH] nvme/perf: Do not use IORING_SETUP_IOPOLL This flag only works for local device. If the device from the kernel is getting from remote (e.g., /dev/nvme2n1 is from NVMe-oF target), then it will not work for those kernel devices while using IORING_SETUP_IOPOLL flag. Signed-off-by: Ziye Yang Change-Id: Ide396de9f53b884c4d12af64693293d57fac9523 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3531 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Aleksey Marchuk --- examples/nvme/perf/perf.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index ffec1566f..9e8cf6793 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -51,10 +51,6 @@ #ifdef SPDK_CONFIG_URING #include - -#ifndef __NR_sys_io_uring_enter -#define __NR_sys_io_uring_enter 426 -#endif #endif #if HAVE_LIBAIO @@ -310,25 +306,19 @@ uring_check_io(struct ns_worker_ctx *ns_ctx) struct perf_task *task; to_submit = ns_ctx->u.uring.io_pending; - to_complete = ns_ctx->u.uring.io_inflight; 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(&ns_ctx->u.uring.ring); + if (ret < 0) { + return; + } ns_ctx->u.uring.io_pending = 0; ns_ctx->u.uring.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 = syscall(__NR_sys_io_uring_enter, ns_ctx->u.uring.ring.ring_fd, 0, - 0, IORING_ENTER_GETEVENTS, NULL, 0); - } - - if (ret < 0) { - return; } + to_complete = ns_ctx->u.uring.io_inflight; if (to_complete > 0) { count = io_uring_peek_batch_cqe(&ns_ctx->u.uring.ring, ns_ctx->u.uring.cqes, to_complete); ns_ctx->u.uring.io_inflight -= count; @@ -353,7 +343,7 @@ uring_verify_io(struct perf_task *task, struct ns_entry *entry) static int uring_init_ns_worker_ctx(struct ns_worker_ctx *ns_ctx) { - if (io_uring_queue_init(g_queue_depth, &ns_ctx->u.uring.ring, IORING_SETUP_IOPOLL) < 0) { + if (io_uring_queue_init(g_queue_depth, &ns_ctx->u.uring.ring, 0) < 0) { SPDK_ERRLOG("uring I/O context setup failure\n"); return -1; }