Commit 95e98467 authored by Jim Harris's avatar Jim Harris Committed by Daniel Verkamp
Browse files

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

Reviewed-on: https://review.gerrithub.io/413148


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 4f0c061d
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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) {
		/*