public inbox for iommu@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH 0/2] dma-mapping: provide a benchmark for streaming DMA mapping
@ 2020-10-27  3:53 Barry Song
  2020-10-27  3:53 ` [PATCH 1/2] dma-mapping: add benchmark support for streaming DMA APIs Barry Song
  2020-10-27  3:53 ` [PATCH 2/2] selftests/dma: add test application for DMA_MAP_BENCHMARK Barry Song
  0 siblings, 2 replies; 8+ messages in thread
From: Barry Song @ 2020-10-27  3:53 UTC (permalink / raw)
  To: iommu, hch, m.szyprowski, robin.murphy
  Cc: will, linuxarm, linux-kselftest, shuah

Nowadays, there are increasing requirements to benchmark the performance
of dma_map and dma_unmap particually while the device is attached to an
IOMMU.

This patchset provides the benchmark infrastruture for streaming DMA
mapping. The architecture of the code is pretty much similar with GUP
benchmark:
* mm/gup_benchmark.c provides kernel interface;
* tools/testing/selftests/vm/gup_benchmark.c provides user program to
call the interface provided by mm/gup_benchmark.c.

In our case, kernel/dma/map_benchmark.c is like mm/gup_benchmark.c;
tools/testing/selftests/dma/dma_map_benchmark.c is like tools/testing/
selftests/vm/gup_benchmark.c

A major difference with GUP benchmark is DMA_MAP benchmark needs to run
on a device. Considering one board with below devices and IOMMUs
device A  ------- IOMMU 1
device B  ------- IOMMU 2
device C  ------- non-IOMMU

Different devices might attach to different IOMMU or non-IOMMU. To make
benchmark run, we can either
* create a virtual device and hack the kernel code to attach the virtual
device to IOMMU1, IOMMU2 or non-IOMMU.
* use the existing driver_override mechinism, unbind device A,B, or c from
their original driver and bind them to "dma_map_benchmark" platform_driver
or pci_driver for benchmarking.

In this patchset, I prefer to use the driver_override and avoid the various
hack in kernel. We can dynamically switch devices behind different IOMMUs
to get the performance of dma map on IOMMU or non-IOMMU.

Barry Song (2):
  dma-mapping: add benchmark support for streaming DMA APIs
  selftests/dma: add test application for DMA_MAP_BENCHMARK

 MAINTAINERS                                   |   6 +
 kernel/dma/Kconfig                            |   8 +
 kernel/dma/Makefile                           |   1 +
 kernel/dma/map_benchmark.c                    | 202 ++++++++++++++++++
 tools/testing/selftests/dma/Makefile          |   6 +
 tools/testing/selftests/dma/config            |   1 +
 .../testing/selftests/dma/dma_map_benchmark.c |  72 +++++++
 7 files changed, 296 insertions(+)
 create mode 100644 kernel/dma/map_benchmark.c
 create mode 100644 tools/testing/selftests/dma/Makefile
 create mode 100644 tools/testing/selftests/dma/config
 create mode 100644 tools/testing/selftests/dma/dma_map_benchmark.c

-- 
2.25.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-31 21:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-27  3:53 [PATCH 0/2] dma-mapping: provide a benchmark for streaming DMA mapping Barry Song
2020-10-27  3:53 ` [PATCH 1/2] dma-mapping: add benchmark support for streaming DMA APIs Barry Song
2020-10-29 19:38   ` Robin Murphy
2020-10-29 21:39     ` Song Bao Hua (Barry Song)
2020-10-30 15:48       ` Robin Murphy
2020-10-31  9:44         ` Song Bao Hua (Barry Song)
2020-10-31 21:42           ` Song Bao Hua (Barry Song)
2020-10-27  3:53 ` [PATCH 2/2] selftests/dma: add test application for DMA_MAP_BENCHMARK Barry Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox