From c4f7ddd2c77b1f1512b685d942fb53ffe4d827c5 Mon Sep 17 00:00:00 2001 From: John Levon Date: Tue, 8 Mar 2022 12:42:09 +0000 Subject: [PATCH] lib/nvme: report shadow doorbell update stats Currently shadow doorbell updates are not counted; add statistics for those, and rename the other statistic for clarity. Signed-off-by: John Levon Change-Id: I211a77902e38265c99b15862034c6d022dc582a0 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11844 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris --- examples/nvme/perf/perf.c | 6 ++++-- include/spdk/nvme.h | 6 ++++-- lib/nvme/nvme_pcie_internal.h | 6 ++++-- module/bdev/nvme/bdev_nvme_rpc.c | 8 ++++++-- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index 25ec4a194..b897709e3 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -1059,9 +1059,11 @@ nvme_dump_pcie_statistics(struct spdk_nvme_transport_poll_group_stat *stat) printf("\tpolls: %"PRIu64"\n", pcie_stat->polls); printf("\tidle_polls: %"PRIu64"\n", pcie_stat->idle_polls); printf("\tcompletions: %"PRIu64"\n", pcie_stat->completions); - printf("\tcq_doorbell_updates: %"PRIu64"\n", pcie_stat->cq_doorbell_updates); + printf("\tcq_mmio_doorbell_updates: %"PRIu64"\n", pcie_stat->cq_mmio_doorbell_updates); + printf("\tcq_shadow_doorbell_updates: %"PRIu64"\n", pcie_stat->cq_shadow_doorbell_updates); printf("\tsubmitted_requests: %"PRIu64"\n", pcie_stat->submitted_requests); - printf("\tsq_doorbell_updates: %"PRIu64"\n", pcie_stat->sq_doorbell_updates); + printf("\tsq_mmio_doorbell_updates: %"PRIu64"\n", pcie_stat->sq_mmio_doorbell_updates); + printf("\tsq_shadow_doorbell_updates: %"PRIu64"\n", pcie_stat->sq_shadow_doorbell_updates); printf("\tqueued_requests: %"PRIu64"\n", pcie_stat->queued_requests); } diff --git a/include/spdk/nvme.h b/include/spdk/nvme.h index b748f3e09..f3321dfb3 100644 --- a/include/spdk/nvme.h +++ b/include/spdk/nvme.h @@ -499,10 +499,12 @@ struct spdk_nvme_pcie_stat { uint64_t polls; uint64_t idle_polls; uint64_t completions; - uint64_t cq_doorbell_updates; + uint64_t cq_mmio_doorbell_updates; + uint64_t cq_shadow_doorbell_updates; uint64_t submitted_requests; uint64_t queued_requests; - uint64_t sq_doorbell_updates; + uint64_t sq_mmio_doorbell_updates; + uint64_t sq_shadow_doorbell_updates; }; struct spdk_nvme_tcp_stat { diff --git a/lib/nvme/nvme_pcie_internal.h b/lib/nvme/nvme_pcie_internal.h index e58da1615..d8f4f29a4 100644 --- a/lib/nvme/nvme_pcie_internal.h +++ b/lib/nvme/nvme_pcie_internal.h @@ -281,6 +281,7 @@ nvme_pcie_qpair_ring_sq_doorbell(struct spdk_nvme_qpair *qpair) } if (spdk_unlikely(pqpair->flags.has_shadow_doorbell)) { + pqpair->stat->sq_shadow_doorbell_updates++; need_mmio = nvme_pcie_qpair_update_mmio_required( pqpair->sq_tail, pqpair->shadow_doorbell.sq_tdbl, @@ -289,7 +290,7 @@ nvme_pcie_qpair_ring_sq_doorbell(struct spdk_nvme_qpair *qpair) if (spdk_likely(need_mmio)) { spdk_wmb(); - pqpair->stat->sq_doorbell_updates++; + pqpair->stat->sq_mmio_doorbell_updates++; g_thread_mmio_ctrlr = pctrlr; spdk_mmio_write_4(pqpair->sq_tdbl, pqpair->sq_tail); g_thread_mmio_ctrlr = NULL; @@ -304,6 +305,7 @@ nvme_pcie_qpair_ring_cq_doorbell(struct spdk_nvme_qpair *qpair) bool need_mmio = true; if (spdk_unlikely(pqpair->flags.has_shadow_doorbell)) { + pqpair->stat->cq_shadow_doorbell_updates++; need_mmio = nvme_pcie_qpair_update_mmio_required( pqpair->cq_head, pqpair->shadow_doorbell.cq_hdbl, @@ -311,7 +313,7 @@ nvme_pcie_qpair_ring_cq_doorbell(struct spdk_nvme_qpair *qpair) } if (spdk_likely(need_mmio)) { - pqpair->stat->cq_doorbell_updates++; + pqpair->stat->cq_mmio_doorbell_updates++; g_thread_mmio_ctrlr = pctrlr; spdk_mmio_write_4(pqpair->cq_hdbl, pqpair->cq_head); g_thread_mmio_ctrlr = NULL; diff --git a/module/bdev/nvme/bdev_nvme_rpc.c b/module/bdev/nvme/bdev_nvme_rpc.c index 659c3e54e..9f4fcaac3 100644 --- a/module/bdev/nvme/bdev_nvme_rpc.c +++ b/module/bdev/nvme/bdev_nvme_rpc.c @@ -1172,10 +1172,14 @@ rpc_bdev_nvme_pcie_stats(struct spdk_json_write_ctx *w, spdk_json_write_named_uint64(w, "polls", stat->pcie.polls); spdk_json_write_named_uint64(w, "idle_polls", stat->pcie.idle_polls); spdk_json_write_named_uint64(w, "completions", stat->pcie.completions); - spdk_json_write_named_uint64(w, "cq_doorbell_updates", stat->pcie.cq_doorbell_updates); + spdk_json_write_named_uint64(w, "cq_mmio_doorbell_updates", stat->pcie.cq_mmio_doorbell_updates); + spdk_json_write_named_uint64(w, "cq_shadow_doorbell_updates", + stat->pcie.cq_shadow_doorbell_updates); spdk_json_write_named_uint64(w, "queued_requests", stat->pcie.queued_requests); spdk_json_write_named_uint64(w, "submitted_requests", stat->pcie.submitted_requests); - spdk_json_write_named_uint64(w, "sq_doorbell_updates", stat->pcie.sq_doorbell_updates); + spdk_json_write_named_uint64(w, "sq_mmio_doorbell_updates", stat->pcie.sq_mmio_doorbell_updates); + spdk_json_write_named_uint64(w, "sq_shadow_doorbell_updates", + stat->pcie.sq_shadow_doorbell_updates); } static void