Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177368202
D59151.1794213837.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D59151.1794213837.diff
View Options
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -138,6 +138,7 @@
struct nvme_qpair *qpair;
sbintime_t deadline;
bus_dmamap_t payload_dma_map;
+ int map_err;
uint16_t cid;
uint64_t *prp;
diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -236,7 +236,8 @@
KASSERT(cpl->cid == req->cmd.cid, ("cpl cid does not match cmd cid\n"));
if (!retry) {
- if (req->payload_valid) {
+ /* No DMA took place if the mapping failed; don't sync. */
+ if (req->payload_valid && tr->map_err == 0) {
bus_dmamap_sync(qpair->dma_tag_payload,
tr->payload_dma_map,
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
@@ -1053,7 +1054,6 @@
mtx_assert(&qpair->lock, MA_OWNED);
req = tr->req;
- req->cmd.cid = qpair->cid_base + tr->cid;
qpair->act_tr[tr->cid] = tr;
ctrlr = qpair->ctrlr;
@@ -1092,13 +1092,11 @@
uint32_t cur_nseg;
/*
- * If the mapping operation failed, return immediately. The caller
- * is responsible for detecting the error status and failing the
- * tracker manually.
+ * bus_dmamap_load_mem() reports most failures only through this
+ * callback and then returns 0; record the error for the caller.
*/
if (error != 0) {
- nvme_printf(tr->qpair->ctrlr,
- "nvme_payload_map err %d\n", error);
+ tr->map_err = error;
return;
}
@@ -1180,6 +1178,9 @@
TAILQ_INSERT_TAIL(&qpair->outstanding_tr, tr, tailq);
tr->deadline = SBT_MAX;
tr->req = req;
+ tr->map_err = 0;
+ /* Set the CID here so a failed mapping can complete the tracker. */
+ req->cmd.cid = qpair->cid_base + tr->cid;
if (!req->payload_valid) {
nvme_qpair_submit_tracker(tr->qpair, tr);
@@ -1191,8 +1192,12 @@
* nvme_qpair_submit_tracker (we call it above directly
* when there's no map to load).
*/
+ /* The payload tag has no deferred-load lock function: no deferral. */
err = bus_dmamap_load_mem(tr->qpair->dma_tag_payload,
- tr->payload_dma_map, &req->payload, nvme_payload_map, tr, 0);
+ tr->payload_dma_map, &req->payload, nvme_payload_map, tr,
+ BUS_DMA_NOWAIT);
+ if (err == 0)
+ err = tr->map_err;
if (err != 0) {
/*
* The dmamap operation failed, so we manually fail the
@@ -1202,7 +1207,7 @@
* with the qpair lock held.
*/
nvme_printf(qpair->ctrlr,
- "bus_dmamap_load_mem returned 0x%x!\n", err);
+ "payload DMA mapping failed with error %d\n", err);
mtx_unlock(&qpair->lock);
nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC,
NVME_SC_DATA_TRANSFER_ERROR, DO_NOT_RETRY, ERROR_PRINT_ALL);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 9, 8:43 AM (10 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41610196
Default Alt Text
D59151.1794213837.diff (2 KB)
Attached To
Mode
D59151: nvme: complete requests when payload DMA mapping fails
Attached
Detach File
Event Timeline