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..

Personally, I'd switch them both to map_single, then when copying the
scatter list
 - Make sure the buffer is DMA unmapped
 - Copy
 - dma_map_single

Unless there is some additional reason for the coherent allocation..

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to