nvme: only prefetch req's stailq when req != NULL

It is fine to prefetch an invalid address, but ASAN
doesn't like it.  So move the prefetch slightly to
make ASAN happy.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib51ab8890e5fe91d30057f65e1399cfc9dd1dd49
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17432
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2023-03-30 18:27:42 +00:00
parent 7858e18b05
commit 7d44b36e0d

View File

@ -925,13 +925,13 @@ nvme_pcie_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_
}
tr = &pqpair->tr[cpl->cid];
/* Prefetch the req's STAILQ_ENTRY since we'll need to access it
* as part of putting the req back on the qpair's free list.
*/
__builtin_prefetch(&tr->req->stailq);
pqpair->sq_head = cpl->sqhd;
if (tr->req) {
/* Prefetch the req's STAILQ_ENTRY since we'll need to access it
* as part of putting the req back on the qpair's free list.
*/
__builtin_prefetch(&tr->req->stailq);
nvme_pcie_qpair_complete_tracker(qpair, tr, cpl, true);
} else {
SPDK_ERRLOG("cpl does not map to outstanding cmd\n");