All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>
To: John Garry <john.garry@huawei.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>, "hch@lst.de" <hch@lst.de>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>
Cc: "linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"Shuah Khan" <shuah@kernel.org>, Joerg Roedel <joro@8bytes.org>,
	Linuxarm <linuxarm@huawei.com>, "xuwei (O)" <xuwei5@huawei.com>,
	Will Deacon <will@kernel.org>
Subject: RE: [PATCH v3 1/2] dma-mapping: add benchmark support for streaming DMA APIs
Date: Mon, 2 Nov 2020 09:37:33 +0000	[thread overview]
Message-ID: <dc5be517e0ac4eaca50a5f8e3dc28170@hisilicon.com> (raw)
In-Reply-To: <184797b8-512e-e3da-fae7-25c7d662648b@huawei.com>



> -----Original Message-----
> From: John Garry
> Sent: Monday, November 2, 2020 10:19 PM
> To: Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>;
> iommu@lists.linux-foundation.org; hch@lst.de; robin.murphy@arm.com;
> m.szyprowski@samsung.com
> Cc: linux-kselftest@vger.kernel.org; Shuah Khan <shuah@kernel.org>; Joerg
> Roedel <joro@8bytes.org>; Linuxarm <linuxarm@huawei.com>; xuwei (O)
> <xuwei5@huawei.com>; Will Deacon <will@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 <joro@8bytes.org>
> > Cc: Will Deacon <will@kernel.org>
> > Cc: Shuah Khan <shuah@kernel.org>
> > Cc: Christoph Hellwig <hch@lst.de>
> > Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> > Cc: Robin Murphy <robin.murphy@arm.com>
> > Signed-off-by: Barry Song <song.bao.hua@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


WARNING: multiple messages have this Message-ID (diff)
From: "Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>
To: John Garry <john.garry@huawei.com>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>, "hch@lst.de" <hch@lst.de>,
	"robin.murphy@arm.com" <robin.murphy@arm.com>,
	"m.szyprowski@samsung.com" <m.szyprowski@samsung.com>
Cc: "linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>, Shuah Khan <shuah@kernel.org>,
	Linuxarm <linuxarm@huawei.com>, "xuwei \(O\)" <xuwei5@huawei.com>,
	Will Deacon <will@kernel.org>
Subject: RE: [PATCH v3 1/2] dma-mapping: add benchmark support for streaming DMA APIs
Date: Mon, 2 Nov 2020 09:37:33 +0000	[thread overview]
Message-ID: <dc5be517e0ac4eaca50a5f8e3dc28170@hisilicon.com> (raw)
In-Reply-To: <184797b8-512e-e3da-fae7-25c7d662648b@huawei.com>



> -----Original Message-----
> From: John Garry
> Sent: Monday, November 2, 2020 10:19 PM
> To: Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>;
> iommu@lists.linux-foundation.org; hch@lst.de; robin.murphy@arm.com;
> m.szyprowski@samsung.com
> Cc: linux-kselftest@vger.kernel.org; Shuah Khan <shuah@kernel.org>; Joerg
> Roedel <joro@8bytes.org>; Linuxarm <linuxarm@huawei.com>; xuwei (O)
> <xuwei5@huawei.com>; Will Deacon <will@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 <joro@8bytes.org>
> > Cc: Will Deacon <will@kernel.org>
> > Cc: Shuah Khan <shuah@kernel.org>
> > Cc: Christoph Hellwig <hch@lst.de>
> > Cc: Marek Szyprowski <m.szyprowski@samsung.com>
> > Cc: Robin Murphy <robin.murphy@arm.com>
> > Signed-off-by: Barry Song <song.bao.hua@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	other threads:[~2020-11-02  9:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02  8:06 [PATCH v3 0/2] dma-mapping: provide a benchmark for streaming DMA mapping Barry Song
2020-11-02  8:06 ` Barry Song
2020-11-02  8:06 ` [PATCH v3 1/2] dma-mapping: add benchmark support for streaming DMA APIs Barry Song
2020-11-02  8:06   ` Barry Song
2020-11-02  9:18   ` John Garry
2020-11-02  9:18     ` John Garry
2020-11-02  9:37     ` Song Bao Hua (Barry Song) [this message]
2020-11-02  9:37       ` Song Bao Hua (Barry Song)
2020-11-10  8:10   ` Song Bao Hua (Barry Song)
2020-11-10  8:10     ` Song Bao Hua (Barry Song)
2020-11-10  8:38     ` John Garry
2020-11-10  8:38       ` John Garry
2020-11-11  1:29       ` Song Bao Hua (Barry Song)
2020-11-11  1:29         ` Song Bao Hua (Barry Song)
     [not found]         ` <51f0c148-e2e3-e084-4021-ec5883919436@huawei.com>
2020-11-11  9:42           ` Song Bao Hua (Barry Song)
2020-11-11  9:42             ` Song Bao Hua (Barry Song)
2020-11-14 16:53   ` Christoph Hellwig
2020-11-14 16:53     ` Christoph Hellwig
2020-11-15  0:11     ` Song Bao Hua (Barry Song)
2020-11-15  0:11       ` Song Bao Hua (Barry Song)
2020-11-15  8:45       ` Christoph Hellwig
2020-11-15  8:45         ` Christoph Hellwig
2020-11-15 21:54         ` Song Bao Hua (Barry Song)
2020-11-15 21:54           ` Song Bao Hua (Barry Song)
2020-11-02  8:06 ` [PATCH v3 2/2] selftests/dma: add test application for DMA_MAP_BENCHMARK Barry Song
2020-11-02  8:06   ` Barry Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dc5be517e0ac4eaca50a5f8e3dc28170@hisilicon.com \
    --to=song.bao.hua@hisilicon.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=john.garry@huawei.com \
    --cc=joro@8bytes.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    --cc=shuah@kernel.org \
    --cc=will@kernel.org \
    --cc=xuwei5@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.