dma-mapping: benchmark: pretend DMA is transmitting
authorBarry Song <song.bao.hua@hisilicon.com>
Fri, 5 Feb 2021 11:33:25 +0000 (00:33 +1300)
committerChristoph Hellwig <hch@lst.de>
Fri, 5 Feb 2021 11:48:46 +0000 (12:48 +0100)
commit9dc00b25eadf2908ae76ac0607b55a9f4e0e0cdc
tree3a80c0139e2eca5de2fd134189c26900dae9824c
parent9f5f8ec50165630cfc49897410b30997d4d677b5
dma-mapping: benchmark: pretend DMA is transmitting

In a real dma mapping user case, after dma_map is done, data will be
transmit. Thus, in multi-threaded user scenario, IOMMU contention
should not be that severe. For example, if users enable multiple
threads to send network packets through 1G/10G/100Gbps NIC, usually
the steps will be: map -> transmission -> unmap.  Transmission delay
reduces the contention of IOMMU.

Here a delay is added to simulate the transmission between map and unmap
so that the tested result could be more accurate for TX and simple RX.
A typical TX transmission for NIC would be like: map -> TX -> unmap
since the socket buffers come from OS. Simple RX model eg. disk driver,
is also map -> RX -> unmap, but real RX model in a NIC could be more
complicated considering packets can come spontaneously and many drivers
are using pre-mapped buffers pool. This is in the TBD list.

Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
kernel/dma/map_benchmark.c
tools/testing/selftests/dma/dma_map_benchmark.c