From 95e984678114ccb41882c13232c3eb39dcbec779 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 31 May 2018 06:07:39 -0700 Subject: [PATCH] nvme/overhead: relax ordering around spdk_get_ticks The Intel SDM clearly states that only an lfence (not an mfence) is needed to ensure rdtsc is executed before subsequent instructions. So change spdk_mb calls to spdk_rmb to avoid overhead related to the unneeded part of the fencing operation. This provides a more accurate view of the overhead of both the SPDK and kernel NVMe drivers. Signed-off-by: Jim Harris Change-Id: Idaeb59db241cc1630e438e300559a02c4d59cd49 Reviewed-on: https://review.gerrithub.io/413148 Tested-by: SPDK Automated Test System Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker Reviewed-by: Daniel Verkamp --- test/nvme/overhead/overhead.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/nvme/overhead/overhead.c b/test/nvme/overhead/overhead.c index 7924c92ab..e25c7bada 100644 --- a/test/nvme/overhead/overhead.c +++ b/test/nvme/overhead/overhead.c @@ -293,7 +293,7 @@ submit_single_io(void) offset_in_ios = rand_r(&seed) % entry->size_in_ios; start = spdk_get_ticks(); - spdk_mb(); + spdk_rmb(); #if HAVE_LIBAIO if (entry->type == ENTRY_TYPE_AIO_FILE) { rc = aio_submit(g_ns->u.aio.ctx, &g_task->iocb, entry->u.aio.fd, IO_CMD_PREAD, g_task->buf, @@ -306,7 +306,7 @@ submit_single_io(void) entry->io_size_blocks, io_complete, g_task, 0); } - spdk_mb(); + spdk_rmb(); tsc_submit = spdk_get_ticks() - start; g_tsc_submit += tsc_submit; if (tsc_submit < g_tsc_submit_min) { @@ -338,7 +338,8 @@ static void check_io(void) { uint64_t end, tsc_complete; - spdk_mb(); + + spdk_rmb(); #if HAVE_LIBAIO if (g_ns->type == ENTRY_TYPE_AIO_FILE) { aio_check_io(); @@ -347,7 +348,7 @@ check_io(void) { spdk_nvme_qpair_process_completions(g_ns->u.nvme.qpair, 0); } - spdk_mb(); + spdk_rmb(); end = spdk_get_ticks(); if (g_ns->current_queue_depth == 1) { /*