Re: [PATCH net-next, v3] net/mlx5: Use dma_wmb() for completion queue doorbell updates

From: Paolo Abeni

Date: Thu Aug 20 2026 - 09:25:26 EST


On 8/16/26 5:56 AM, lirongqing wrote:
> From: Li RongQing <lirongqing@xxxxxxxxx>
>
> dma_*() barriers are specifically for ordering writes to DMA
> coherent memory that is accessible to both the CPU and DMA capable
> devices.
>
> The dma_wmb() barrier is lighter than wmb() on some architectures
> because it only ensures ordering for DMA writes, not for all writes
> including MMIO accesses.
>
> In the MLX5 driver, completion queue (CQ) doorbell records are
> allocated as DMA coherent memory via mlx5_dma_zalloc_coherent_node().
> The CQ update pattern is:
> 1. Update CQ space (device reads via DMA)
> 2. Update doorbell record (device reads via DMA)
> 3. Memory barrier
> 4. Enable more CQEs
> Since only DMA coherent memory accesses are involved (no MMIO accesses
> follow), we can safely use dma_wmb() instead of wmb().
>
> This change improves performance slightly on architectures where
> dma_wmb() is lighter than wmb().
>
> Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
> Signed-off-by: Tariq Toukan <tariqt@xxxxxxxxxx>
## Form letter - net-next-closed

We have already submitted our pull request with net-next material for v7.3,
and therefore net-next is closed for new drivers, features, code refactoring
and optimizations. We are currently accepting bug fixes only.

Please repost when net-next reopens after Aug 31st.

RFC patches sent for review only are obviously welcome at any time.

See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle