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 <james.r.harris@intel.com>
Change-Id: Idaeb59db241cc1630e438e300559a02c4d59cd49

Reviewed-on: https://review.gerrithub.io/413148
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Jim Harris 2018-05-31 06:07:39 -07:00 committed by Daniel Verkamp
parent 4f0c061d08
commit 95e9846781

View File

@ -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) {
/*