On Wed, Jul 22, 2015 at 11:30:48AM -0600, Jason Gunthorpe wrote: > On Wed, Jul 22, 2015 at 09:55:40AM +0300, Sagi Grimberg wrote: > > + size += max_t(int, MLX5_UMR_ALIGN - ARCH_KMALLOC_MINALIGN, 0); > > + mr->klms = kzalloc(size, GFP_KERNEL); > > + if (!mr->klms) > > + return -ENOMEM; > > + > > + mr->pl_map = dma_map_single(device->dma_device, mr->klms, > > + size, DMA_TO_DEVICE); > > This is a misuse of the DMA API, you must call dma_map_single after > the memory is set by the CPU, not before. > > The fast reg varient is using coherent allocations, which is OK..
It's fine as long as you dma_sync_*_for_{cpu,device} in the right places, which is what a lot of drivers do for longer held allocations. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html