Date: Sat, 31 Jul 2021 00:21:28 GMT From: Warner Losh <imp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 644837397fa7 - stable/12 - nvme: Remove a wmb() that's not necessary. Message-ID: <202107310021.16V0LSE2052042@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=644837397fa7fbc6f5bdd7d885c6347045c18bf3 commit 644837397fa7fbc6f5bdd7d885c6347045c18bf3 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2020-12-04 21:34:48 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2021-07-31 00:02:52 +0000 nvme: Remove a wmb() that's not necessary. bus_dmamap_sync() ensures that memory that's prepared for PREWRITE can be DMA'd immediately after it returns. The details differ, but this mirrors atomic thread release semantics, at least for the buffers synced. For non-x86 platforms, bus_dmamap_sync() has the right syncing and fences. So in the past, wmb() had been omitted for them. For x86 platforms, the memory ordering is already strong enough to ensure DMA to the device sees the current contents. As such, we don't need the wmb() here. It translates to an sfence which is only needed for writes to regions that have the write combining attribute set or when some exotic opcodes are used. The nvme driver does neither of these. Since bus_dmamap_sync() includes atomic_thread_fence_rel, we can be assured any optimizer won't reorder the bus_dmamap_sync and the bus_space_write operations. The wmb() was a vestiage of the pre-busdma version initially committed to the tree. Reviewed by: kib@, gallatin@, chuck@, mav@ Differential Revision: https://reviews.freebsd.org/D27448 (cherry picked from commit 082905cad121bf6721606b6b9ba20a09bc6e56d0) --- sys/dev/nvme/nvme_qpair.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c index e43e8285e9bb..651eee121be1 100644 --- a/sys/dev/nvme/nvme_qpair.c +++ b/sys/dev/nvme/nvme_qpair.c @@ -987,14 +987,6 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr) bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( __arm__) - /* - * powerpc's bus_dmamap_sync() already includes a heavyweight sync, but - * no other archs do. - */ - wmb(); -#endif - bus_space_write_4(qpair->ctrlr->bus_tag, qpair->ctrlr->bus_handle, qpair->sq_tdbl_off, qpair->sq_tail); qpair->num_cmds++;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107310021.16V0LSE2052042>