git: 2ec165e3f065 - main - nvme: Reduce traffic to the doorbell register
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 14 Oct 2021 14:45:36 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=2ec165e3f065217ae8d54a2a8235fe1f219805ea
commit 2ec165e3f065217ae8d54a2a8235fe1f219805ea
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-10-14 14:44:37 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-10-14 14:44:37 +0000
nvme: Reduce traffic to the doorbell register
Reduce traffic to doorbell register when processing multiple completion
events at once. Only write it at the end of the loop after we've
processed everything (assuming we found at least one completion,
even if that completion wasn't valid).
Sponsored by: Netflix
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D32470
---
sys/dev/nvme/nvme_qpair.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c
index 6669eeee6613..54718492ff09 100644
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -629,10 +629,10 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair)
else
tr = NULL;
+ done++;
if (tr != NULL) {
nvme_qpair_complete_tracker(tr, &cpl, ERROR_PRINT_ALL);
qpair->sq_head = cpl.sqhd;
- done++;
} else if (!in_panic) {
/*
* A missing tracker is normally an error. However, a
@@ -664,10 +664,13 @@ nvme_qpair_process_completions(struct nvme_qpair *qpair)
atomic_store_rel_int(&qpair->cq_head, 0); /* 2 */
qpair->phase = !qpair->phase; /* 3 */
}
+ }
+ if (done != 0) {
bus_space_write_4(qpair->ctrlr->bus_tag, qpair->ctrlr->bus_handle,
qpair->cq_hdbl_off, qpair->cq_head);
}
+
return (done != 0);
}