svn commit: r368352 - head/sys/dev/nvme

Warner Losh imp at FreeBSD.org
Fri Dec 4 21:34:49 UTC 2020


Author: imp
Date: Fri Dec  4 21:34:48 2020
New Revision: 368352
URL: https://svnweb.freebsd.org/changeset/base/368352

Log:
  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

Modified:
  head/sys/dev/nvme/nvme_qpair.c

Modified: head/sys/dev/nvme/nvme_qpair.c
==============================================================================
--- head/sys/dev/nvme/nvme_qpair.c	Fri Dec  4 21:34:04 2020	(r368351)
+++ head/sys/dev/nvme/nvme_qpair.c	Fri Dec  4 21:34:48 2020	(r368352)
@@ -982,14 +982,6 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, st
 
 	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++;


More information about the svn-src-head mailing list