Commit c4f7ddd2 authored by John Levon's avatar John Levon Committed by Tomasz Zawadzki
Browse files

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: default avatarJohn Levon <john.levon@nutanix.com>
Change-Id: I211a77902e38265c99b15862034c6d022dc582a0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11844


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 9e239b1c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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);
}

+4 −2
Original line number Diff line number Diff line
@@ -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 {
+4 −2
Original line number Diff line number Diff line
@@ -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;
+6 −2
Original line number Diff line number Diff line
@@ -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