From: David Matlack <dmatlack@google.com>
To: Aaron Lewis <aaronlewis@google.com>
Cc: kvm@vger.kernel.org, alex@shazbot.org, jgg@nvidia.com
Subject: Re: [PATCH v3 2/4] vfio: selftests: Introduce vfio_dma_mapping_perf_test
Date: Thu, 8 Oct 2026 09:48:40 +0000 [thread overview]
Message-ID: <asdm-NDNja-LxQem@google.com> (raw)
In-Reply-To: <20260910153326.3085937-3-aaronlewis@google.com>
On 2026-09-10 03:33 PM, Aaron Lewis wrote:
> Introduce vfio_dma_mapping_perf_test to aid in latency testing. Rather
> than a traditional pass/fail test, which tends to be flaky when
> enforcing latency bounds, this test directly reports the latency of
> various stages in the mapping and unmapping process.
>
> Start with a basic test that performs a simple DMA map/unmap and tracks
> the duration of each operation. The test reports the following metrics:
>
> 1. Time taken by mmap().
> 2. Time taken to map a DMA region.
> 3. Time taken to unmap a DMA region.
> 4. Time taken by munmap().
>
> Subsequent commits in this series will introduce more features to allow
> for a wider variety of testing.
>
> To ensure consistent DMA mapping times, the test uses MAP_POPULATE when
> calling mmap(). This forces page faults to be handled upfront, isolating
> the DMA mapping times from them.
>
> Signed-off-by: Aaron Lewis <aaronlewis@google.com>
Aside from the nit,
Reviewed-by: David Matlack <dmatlack@google.com>
> ---
> tools/testing/selftests/vfio/Makefile | 1 +
> .../selftests/vfio/lib/include/libvfio.h | 31 +++++++
> .../vfio/vfio_dma_mapping_perf_test.c | 90 +++++++++++++++++++
> 3 files changed, 122 insertions(+)
> create mode 100644 tools/testing/selftests/vfio/vfio_dma_mapping_perf_test.c
>
> diff --git a/tools/testing/selftests/vfio/Makefile b/tools/testing/selftests/vfio/Makefile
> index 2c32c48db509..ed5856af5f9a 100644
> --- a/tools/testing/selftests/vfio/Makefile
> +++ b/tools/testing/selftests/vfio/Makefile
> @@ -8,6 +8,7 @@ else
> CFLAGS = $(KHDR_INCLUDES)
> TEST_GEN_PROGS += vfio_dma_mapping_test
> TEST_GEN_PROGS += vfio_dma_mapping_mmio_test
> +TEST_GEN_PROGS += vfio_dma_mapping_perf_test
> TEST_GEN_PROGS += vfio_iommufd_setup_test
> TEST_GEN_PROGS += vfio_pci_device_test
> TEST_GEN_PROGS += vfio_pci_device_init_perf_test
> diff --git a/tools/testing/selftests/vfio/lib/include/libvfio.h b/tools/testing/selftests/vfio/lib/include/libvfio.h
> index 07862b470777..8496b8b4da3c 100644
> --- a/tools/testing/selftests/vfio/lib/include/libvfio.h
> +++ b/tools/testing/selftests/vfio/lib/include/libvfio.h
> @@ -9,6 +9,37 @@
> #include <libvfio/vfio_pci_device.h>
> #include <libvfio/vfio_pci_driver.h>
>
> +#include <stdint.h>
> +#include <time.h>
> +#include <linux/time64.h>
> +
> +static inline void timer_start(struct timespec *start)
> +{
> + clock_gettime(CLOCK_MONOTONIC, start);
> +}
> +
> +static inline uint64_t timer_elapsed_ns(struct timespec start)
> +{
> + struct timespec end;
> +
> + clock_gettime(CLOCK_MONOTONIC, &end);
Maybe rename timer_start() to timer_get() and re-use it here.
next prev parent reply other threads:[~2026-10-08 9:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 15:33 [PATCH v3 0/4] Introduce vfio_dma_mapping_perf_test Aaron Lewis
2026-09-10 15:33 ` [PATCH v3 1/4] vfio: selftests: Assert the region was unmapped in iommu_unmap() Aaron Lewis
2026-09-10 15:33 ` [PATCH v3 2/4] vfio: selftests: Introduce vfio_dma_mapping_perf_test Aaron Lewis
2026-10-08 9:48 ` David Matlack [this message]
2026-09-10 15:33 ` [PATCH v3 3/4] vfio: selftests: Add memfd test to vfio_dma_mapping_perf_test Aaron Lewis
2026-10-08 10:03 ` David Matlack
2026-09-10 15:33 ` [PATCH v3 4/4] vfio: selftests: Allow a size for vfio_dma_mapping_perf_test Aaron Lewis
2026-09-10 15:41 ` sashiko-bot
2026-10-08 10:27 ` David Matlack
2026-10-08 10:30 ` [PATCH v3 0/4] Introduce vfio_dma_mapping_perf_test David Matlack
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=asdm-NDNja-LxQem@google.com \
--to=dmatlack@google.com \
--cc=aaronlewis@google.com \
--cc=alex@shazbot.org \
--cc=jgg@nvidia.com \
--cc=kvm@vger.kernel.org \
/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.