Re: [RFC PATCH 0/2] dma-unmap: allow to only unmap completed DMAbuffer

From: Alan Stern
Date: Mon May 27 2013 - 16:18:50 EST


On Tue, 28 May 2013, Ming Lei wrote:

> This patchset tries to loose the check on DMA buffer size in check_unmap()
> of dma-debug first, then only unmap the actual completed DMA buffer in USB
> unmap path.
>
> Considered that DMA unmapping often runs in hard irq context, the patch set
> may save irq handling time. And the improvement can be observed on
> ARMv7(Pandaboard) with the chage, at average ~25us is saved about ehci irq
> handling under usbnet ping test case.

Are you aware that these changes directly contradict the advice in
Documentation/DMA-API.txt? That file says:


void
dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
enum dma_data_direction direction)

Unmaps the region previously mapped. All the parameters passed in
must be identical to those passed in (and returned) by the mapping
API.


If you are going to make a change like this then you have to change the
documentation too. But in fact I doubt that the proposed change will
work correctly in all circumstances. For example, if an IOMMU is
present.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/