From a606a3ed5ca529f9c8e2b85eb8d3b73acc94d7df Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 7 Mar 2016 15:06:33 -0700 Subject: [PATCH] nvme/reset: simplify timing logic and shorten test Change-Id: I070223e25988e9a35a4df91331ea88bc4f7c5f13 Signed-off-by: Daniel Verkamp --- test/lib/nvme/nvme.sh | 2 +- test/lib/nvme/reset/reset.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/lib/nvme/nvme.sh b/test/lib/nvme/nvme.sh index 8917677d8..24c417d2f 100755 --- a/test/lib/nvme/nvme.sh +++ b/test/lib/nvme/nvme.sh @@ -34,7 +34,7 @@ timing_exit reserve #Now test nvme reset function timing_enter reset -$testdir/reset/reset -q 64 -w write -s 4096 -t 15 +$testdir/reset/reset -q 64 -w write -s 4096 -t 2 timing_exit reset timing_enter sgl diff --git a/test/lib/nvme/reset/reset.c b/test/lib/nvme/reset/reset.c index d97267d0d..7c7402f17 100644 --- a/test/lib/nvme/reset/reset.c +++ b/test/lib/nvme/reset/reset.c @@ -271,6 +271,7 @@ work_fn(void *arg) uint64_t tsc_end = rte_get_timer_cycles() + g_time_in_sec * g_tsc_rate; struct worker_thread *worker = (struct worker_thread *)arg; struct ns_worker_ctx *ns_ctx = NULL; + bool did_reset = false; printf("Starting thread on core %u\n", worker->lcore); @@ -298,8 +299,7 @@ work_fn(void *arg) ns_ctx = ns_ctx->next; } - if (((tsc_end - rte_get_timer_cycles()) / g_tsc_rate) > (uint64_t)g_time_in_sec / 5 && - ((tsc_end - rte_get_timer_cycles()) / g_tsc_rate) < (uint64_t)(g_time_in_sec / 5 + 10)) { + if (!did_reset && ((tsc_end - rte_get_timer_cycles()) / g_tsc_rate) > (uint64_t)g_time_in_sec / 2) { ns_ctx = worker->ns_ctx; while (ns_ctx != NULL) { if (spdk_nvme_ctrlr_reset(ns_ctx->entry->ctrlr) < 0) { @@ -308,6 +308,7 @@ work_fn(void *arg) } ns_ctx = ns_ctx->next; } + did_reset = true; } if (rte_get_timer_cycles() > tsc_end) {