> -----Original Message-----
> From: John Garry
> Sent: Monday, November 2, 2020 10:19 PM
> To: Song Bao Hua (Barry Song) <song.bao....@hisilicon.com>;
> iommu@lists.linux-foundation.org; h...@lst.de; robin.mur...@arm.com;
> m.szyprow...@samsung.com
> Cc: linux-kselft...@vger.kernel.org; Shuah Khan <sh...@kernel.org>; Joerg
> Roedel <j...@8bytes.org>; Linuxarm <linux...@huawei.com>; xuwei (O)
> <xuw...@huawei.com>; Will Deacon <w...@kernel.org>
> Subject: Re: [PATCH v3 1/2] dma-mapping: add benchmark support for
> streaming DMA APIs
> 
> On 02/11/2020 08:06, Barry Song wrote:
> > 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 patch enables the support. Users can run specified number of threads
> > to do dma_map_page and dma_unmap_page on a specific NUMA node with
> the
> > specified duration. Then dma_map_benchmark will calculate the average
> > latency for map and unmap.
> >
> > A difficulity for this benchmark is that dma_map/unmap APIs must run on
> > a particular device. Each device might have different backend of IOMMU or
> > non-IOMMU.
> >
> > So we use the driver_override to bind dma_map_benchmark to a particual
> > device by:
> > For platform devices:
> > echo dma_map_benchmark > /sys/bus/platform/devices/xxx/driver_override
> > echo xxx > /sys/bus/platform/drivers/xxx/unbind
> > echo xxx > /sys/bus/platform/drivers/dma_map_benchmark/bind
> >
> > For PCI devices:
> > echo dma_map_benchmark >
> /sys/bus/pci/devices/0000:00:01.0/driver_override
> > echo 0000:00:01.0 > /sys/bus/pci/drivers/xxx/unbind
> > echo 0000:00:01.0 > /sys/bus/pci/drivers/dma_map_benchmark/bind
> >
> > Cc: Joerg Roedel <j...@8bytes.org>
> > Cc: Will Deacon <w...@kernel.org>
> > Cc: Shuah Khan <sh...@kernel.org>
> > Cc: Christoph Hellwig <h...@lst.de>
> > Cc: Marek Szyprowski <m.szyprow...@samsung.com>
> > Cc: Robin Murphy <robin.mur...@arm.com>
> > Signed-off-by: Barry Song <song.bao....@hisilicon.com>
> > ---
> > -v3:
> >    * fix build issues reported by 0day kernel test robot
> > -v2:
> >    * add PCI support; v1 supported platform devices only
> >    * replace ssleep by msleep_interruptible() to permit users to exit
> >      benchmark before it is completed
> >    * many changes according to Robin's suggestions, thanks! Robin
> >      - add standard deviation output to reflect the worst case
> >      - check users' parameters strictly like the number of threads
> >      - make cache dirty before dma_map
> >      - fix unpaired dma_map_page and dma_unmap_single;
> >      - remove redundant "long long" before ktime_to_ns();
> >      - use devm_add_action()
> >
> >   kernel/dma/Kconfig         |   8 +
> >   kernel/dma/Makefile        |   1 +
> >   kernel/dma/map_benchmark.c | 296
> +++++++++++++++++++++++++++++++++++++
> >   3 files changed, 305 insertions(+)
> >   create mode 100644 kernel/dma/map_benchmark.c
> >
> > diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> > index c99de4a21458..949c53da5991 100644
> > --- a/kernel/dma/Kconfig
> > +++ b/kernel/dma/Kconfig
> > @@ -225,3 +225,11 @@ config DMA_API_DEBUG_SG
> >       is technically out-of-spec.
> >
> >       If unsure, say N.
> > +
> > +config DMA_MAP_BENCHMARK
> > +   bool "Enable benchmarking of streaming DMA mapping"
> > +   help
> > +     Provides /sys/kernel/debug/dma_map_benchmark that helps with
> testing
> > +     performance of dma_(un)map_page.
> 
> Since this is a driver, any reason for which it cannot be loadable? If
> so, it seems any functionality would depend on DEBUG FS, I figure that's
> just how we work for debugfs.

We depend on kthread_bind_mask which isn't an export_symbol.
Maybe worth to send a patch to export it?

> 
> Thanks,
> John
> 
> > +
> > +     See tools/testing/selftests/dma/dma_map_benchmark.c
> > diff --git a/kernel/dma/Makefile b/kernel/dma/Makefile
> > index dc755ab68aab..7aa6b26b1348 100644
> > --- a/kernel/dma/Makefile
> > +++ b/kernel/dma/Makefile

Thanks
Barry

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

Reply via email to