Commit Graph

250 Commits

Author SHA1 Message Date
Anatol Belski
4bf3672fad performance-metrics: Add compressed async QCOW2 tempfile helper
Add compressed_qcow_async_tempfile which creates a zlib compressed
QCOW2 image via qemu-img and opens it via QcowDiskAsync. Mirrors
the existing compressed_qcow_tempfile for io_uring benchmarks.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
324f16861d performance-metrics: Add QCOW2 async backing file read micro benchmark
Add micro_bench_qcow_async_backing_read which reads clusters from
a QCOW2 overlay through the QcowAsync io_uring path. All reads
fall through to the backing file, exercising the sync fallback
path in QcowAsync.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
c8fee5953f performance-metrics: Add async QCOW2 overlay tempfile helper
Add qcow_async_overlay_tempfile which creates a QCOW2 overlay
backed by a RAW file and opens it via QcowDiskAsync. Mirrors
the existing qcow_overlay_tempfile for io_uring benchmarks.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
2041ba5a91 performance-metrics: Add QCOW2 async multicluster read micro benchmark
Add micro_bench_qcow_async_multi_cluster_read which reads 8
contiguous clusters (512 KiB) per request through the QcowAsync
io_uring path. With coalesced mappings this can hit the io_uring
fast path for a single Readv SQE.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
377c260196 performance-metrics: Add QCOW2 async random read micro benchmark
Add micro_bench_qcow_async_random_read which reads clusters in
random order through the QcowAsync io_uring path. This mirrors
the existing sync random read benchmark and measures io_uring
completion handling under random access patterns.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
e9d1ffd24f performance-metrics: Add QCOW2 batch read micro benchmark
Add micro_bench_qcow_batch_read which builds a batch of num_ops
read requests and submits them all at once through
submit_batch_requests. This exercises the io_uring batch
submission path added in qcow_async, where multiple SQEs are
packed into a single io_uring_enter call.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
f8dbec0abb performance-metrics: Add QCOW2 async read micro benchmark
Add micro_bench_qcow_async_read which reads clusters through the
QcowDiskAsync io_uring backend. Single allocated cluster reads go
through io_uring for true asynchronous completion, unlike the sync
benchmarks which use QcowDiskSync with blocking I/O.

Workloads: 128 and 256 clusters.
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
3cb116fcfc performance-metrics: Add async drain completions helper
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
faf6f7b635 performance-metrics: Add QCOW2 L2 cache cold miss micro benchmark
Add micro_bench_qcow_l2_cache_miss which reads one cluster from each
of num_ops distinct L2 tables in a sparsely allocated image.  Clusters
are spaced L2_ENTRIES_PER_TABLE apart so every read touches a different
L2 table, forcing eviction when num_ops exceeds the cache capacity.

Workloads: 128 and 256 L2 tables.
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
73d99c044c performance-metrics: Add sparse QCOW2 tempfile helper
Add sparse_qcow_tempfile() which creates a QCOW2 image with one
allocated cluster per L2 table, spread across num_l2_tables distinct
L2 tables.  Reading these clusters in sequence forces L2 cache misses
when the count exceeds the cache capacity.

Also add the L2_ENTRIES_PER_TABLE constant, 8192 for 64 KiB clusters.

To be used by the L2 cache cold miss benchmark.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
94f78edcf0 performance-metrics: Add QCOW2 multi-cluster read micro benchmark
Add micro_bench_qcow_multi_cluster_read which issues large reads
spanning 8 contiguous clusters (512 KiB) per read_vectored call.
This exercises the mapping coalesce path where multiple L2 entries
are merged into fewer host I/O operations.

Workloads: 128 and 256 total clusters (16 and 32 reads).
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
7dd1978fce performance-metrics: Add QCOW2 compressed read micro benchmark
Add micro_bench_qcow_compressed_read which reads clusters from a
zlib compressed QCOW2 image. Every cluster triggers decompression,
isolating the decompression overhead from the normal allocated cluster
read path.

Workloads: 128 and 256 clusters.
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
aca64ced8f performance-metrics: Add compressed QCOW2 tempfile helper
Add compressed_qcow_tempfile() which creates a zlib compressed QCOW2
image by populating a RAW tempfile with data and converting it via
qemu-img convert -c.  Every cluster in the resulting image is stored
compressed so reads exercise the decompression path.

To be used by the compressed read benchmark.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
b2430d701b performance-metrics: Add QCOW2 copy-on-write write micro benchmark
Add micro_bench_qcow_cow_write which writes clusters into a QCOW2
overlay backed by a raw file.  Each write triggers copy-on-write:
cluster allocation, L2 and refcount table updates, then the data
write.  This measures COW allocation overhead compared to writing
into a plain empty image.

Workloads: 128 and 256 clusters.
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
79b58c0faf performance-metrics: Add QCOW2 backing file read micro benchmark
Add micro_bench_qcow_backing_read which reads clusters from a QCOW2
overlay where all data lives in a raw backing file.  Every read falls
through the L2 lookup to the backing file, exercising the backing
chain read path.

Workloads: 128 and 256 clusters.
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
bdce007aac performance-metrics: Add QCOW2 overlay tempfile helper
Add qcow_overlay_tempfile() which creates a raw backing file with
pre-populated data and a QCOW2 overlay on top with no allocated
clusters.  The overlay is opened with backing file support via
QcowDiskSync so reads fall through to the backing file.

To be used by backing file read and copy-on-write write
benchmarks.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
99b4320279 performance-metrics: Add qcow2 random read micro benchmark
Add micro_bench_qcow_random_read which reads clusters from a
prepopulated qcow2 image in a deterministic pseudo-random order.
Unlike the sequential read benchmark, this exercises L2 cache miss
and eviction behaviour under random access patterns.

Uses Fisher-Yates shuffle with DefaultHasher for reproducible
permutation across runs.

Two TEST_LIST entries: micro_block_qcow_random_read_128_us and
micro_block_qcow_random_read_256_us with 128 and 256 cluster
workloads.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
638cb3d7f2 performance-metrics: Add deterministic permutation helper
Add deterministic_permutation() which produces a reproducible
pseudo random permutation of [0, n) using a Fisher-Yates shuffle
seeded by DefaultHasher. This is used by the random read micro
benchmarks to generate a fixed access pattern that is identical
across runs.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
e802c0d8b9 performance-metrics: Add qcow2 fsync micro benchmark
Add micro_bench_qcow_fsync which writes num_ops clusters into an
empty qcow2 image to dirty L2 and refcount metadata then times a
single fsync call that flushes all dirty tables to disk. This
isolates the metadata flush cost which scales with the number of
dirty L2 table entries and refcount blocks.

Two TEST_LIST entries: micro_block_qcow_fsync_64_us and
micro_block_qcow_fsync_256_us with 64 and 256 cluster workloads.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
c3312dca3f performance-metrics: Add qcow2 punch hole micro benchmark
Add micro_bench_qcow_punch_hole which times punch_hole calls through
QcowSync on a prepopulated qcow2 image. Each call deallocates one
cluster exercising deallocate_bytes with refcount decrement and
fallocate punch_hole on the host file.

Two TEST_LIST entries: micro_block_qcow_punch_hole_64_us and
micro_block_qcow_punch_hole_256_us with 64 and 256 cluster workloads.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
f7e40eec9a performance-metrics: Add QCOW2 write micro benchmark
Add micro_bench_qcow_write which times write_vectored calls through
QcowSync on an empty QCOW2 image. Each write allocates a new cluster
exercising map_cluster_for_write with L2 entry allocation and refcount
updates followed by pwrite_all.

Two TEST_LIST entries: micro_block_qcow_write_128_us and
micro_block_qcow_write_256_us with 128 and 256 cluster workloads.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
9f317895b5 performance-metrics: Add submit_writes helper
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
0854c3e082 performance-metrics: Add empty QCOW2 tempfile helper
Add empty_qcow_tempfile() which creates a QCOW2 v3 image with no
allocated clusters so every write triggers the full cluster allocation
path including L2 entry allocation and refcount updates.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
6cd3395a55 performance-metrics: Add QCOW2 read micro benchmark
Add micro_bench_qcow_read which times read_vectored calls through
QcowSync on a prepopulated QCOW2 image. This exercises the hot
read path including L2 lookup, pread64 for allocated clusters and
iovec scatter.

Two TEST_LIST entries: micro_block_qcow_read_128_us and
micro_block_qcow_read_256_us with 128 and 256 cluster workloads.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
beaa98728c performance-metrics: Add iovec construction helpers
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
f8deeb8a1c performance-metrics: Add submit_reads helper
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
97b109bc89 performance-metrics: Add sync drain completions helper
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
ab1dddb62a performance-metrics: Add QCOW2 tempfile helpers
Add qcow_tempfile() which creates a QCOW2 v3 image with all clusters
allocated via QcowFile::new plus sequential writes, then reopens it
as QcowDiskSync. Add QCOW_CLUSTER_SIZE constant for the default
64 KiB cluster size.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
4a607ed82d performance-metrics: Enable io_uring feature on block crate
Enable the io_uring feature so that QcowDiskAsync and QcowAsync are
available for async path micro benchmarks.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anirudh Rayabharam
c7a152ee79 performance-metrics: fix overly broad process cleanup
Drop the -f flag from the process termination command in
cleanup_stale_processes() so it matches by process name only, not the
full command line. This prevents terminating unrelated processes whose
arguments happen to contain target strings (e.g., the test runner
invoked with --report-file /cloud-hypervisor/report.json).

Use the truncated name 'cloud-hyperviso' because Linux limits process
names to 15 characters.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
2026-04-16 14:12:48 +01:00
Anirudh Rayabharam
fd2d33e8ab performance-metrics: Add --continue-on-failure flag and status tracking
Add a --continue-on-failure CLI flag that allows the test harness to
continue executing remaining tests after encountering a failure, instead
of aborting immediately. When set, failed tests are recorded with zeroed
metrics and a "FAILED" status, the report file is always generated, and
the process exits with a non-zero code if any test failed.

Without the flag, the existing fail-fast behavior is preserved.

Also add a "status" field ("PASSED"/"FAILED") to PerformanceTestResult
so report consumers can distinguish successful tests from failed ones.

Signed-off-by: Anirudh Rayabharam <anrayabh@microsoft.com>
2026-04-13 09:53:26 +00:00
Muminul Islam
1b479e40ea performance-metrics: Remove duplicate remote_command
Remove the local remote_command() function from
performance_tests.rs. The identical function is now
available from test_infra via the existing glob import.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-02 14:39:21 +00:00
Muminul Islam
1400e614cb performance-metrics: Remove duplicate x86_64 FOCAL_IMAGE_NAME
Remove the local x86_64 FOCAL_IMAGE_NAME constant from
performance_tests.rs. The identical public constant from
test_infra is already available via wildcard import.

The aarch64 definition is kept as it differs from test_infra:
performance-metrics uses a specific image with the
'-update-tool' suffix.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-02 14:39:21 +00:00
Muminul Islam
4cf10737e4 performance-metrics: Remove duplicate DIRECT_KERNEL_BOOT_CMDLINE
Remove the local DIRECT_KERNEL_BOOT_CMDLINE constant from
performance_tests.rs. The identical public constant from
test_infra is already available via wildcard import.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-02 14:39:21 +00:00
Muminul Islam
488927a5ea performance-metrics: Remove duplicate direct_kernel_boot_path()
Remove the local direct_kernel_boot_path() function and unused
PathBuf import from performance_tests.rs. The identical public
function from test_infra is already available via wildcard
import.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-04-02 14:39:21 +00:00
Anatol Belski
0e7b2d68fc performance-metrics: Add test exclude filter support
Add a --test-exclude flag that excludes tests matching the provided
keywords. Both --test-filter and --test-exclude are now applied before
--list-tests, so listing respects the active filters.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-18 09:43:06 +00:00
Anatol Belski
00957fa9db performance-metrics: Add AIO completion drain micro benchmark
Add micro_block_raw_aio_drain_128_us and
micro_block_raw_aio_drain_256_us tests that submit N AIO writes
to a temporary file, wait for the eventfd signal, then time how
long it takes to drain all completions via next_completed_request().

This measures per completion syscall overhead and provides a
baseline before any batching optimizations.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-17 22:12:50 +00:00
Anatol Belski
be6f63a740 performance-metrics: Add util module with shared micro benchmark helpers
These factor out common setup and synchronization patterns used by block
layer micro benchmarks.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-17 22:12:50 +00:00
Anatol Belski
b12620cf25 performance-metrics: Add num_ops field to PerformanceTestControl
Add an optional num_ops parameter for micro benchmarks to configure
workload size (e.g. number of AIO operations to submit). A warning
is emitted if it is accidentally set on a non micro test where it
has no effect.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-17 22:12:50 +00:00
Anatol Belski
c42cc478fe performance-metrics: Add micro benchmark support
Introduce support for in process micro benchmarks alongside the
existing VM level performance tests. Micro benchmarks are
integrated into the same PerformanceTest/TEST_LIST infrastructure
and follow the same iteration, timeout, and reporting pipeline.
They are distinguished by a micro_* name prefix.

The test dispatch loop is refactored to pre filter the test list
and gate init/cleanup behind a flag, so that pure micro benchmark
runs skip the expensive VM lifecycle entirely.  Mixed runs
(VM + micro) continue to work correctly.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-17 22:12:50 +00:00
Anatol Belski
6850b04fa6 performance-metrics: Set image_type=qcow2 for remaining qcow2 test disks
Without it the VMM autodetects the format and logs
warnings that specifying image_type will become mandatory
for non raw images in the future.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-12 12:27:24 +00:00
Anatol Belski
766f4206c9 performance-metrics: Set image_type=raw for block I/O test image
Without explicit image_type fio first sequential write hits
sector 0 and gets VIRTIO_BLK_S_IOERR. fio then hangs, causing
block_write_MiBps and all other write tests using
BLK_IO_TEST_IMG to time out.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-12 12:27:24 +00:00
Anatol Belski
c0a81bc903 performance-metrics: Settle host before each test
Flush host writeback queues, drop the page cache and sleep 1s
for kernel housekeeping before each test run.

The cloud-hypervisor block backend does buffered I/O on the host
side, so dirty pages from prior write tests can accumulate and
compete for I/O bandwidth with subsequent tests. Dropping caches
ensures cold read tests get a consistent baseline rather than
benefiting from data cached by prior tests. The brief cooldown
lets the kernel finish tearing down KVM state and freeing pages
from the previous VM before the next one starts.

Requires root, which the metrics container provides. Silently
fails otherwise.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-12 12:27:24 +00:00
Anatol Belski
57e64a0848 performance-metrics: Kill stale processes on test timeout
When a test times out, the spawned thread containing the
cloud-hypervisor child process, iperf3/ethr sub processes,
and all associated resources (TAP devices, file descriptors,
hugepage reservations) is abandoned without cleanup. This
attaches a cleanup routine that kills cloud-hypervisor,
iperf3, and ethr processes on timeout, then waits
briefly for the kernel to reclaim their resources. This
prevents leaked processes from interfering with subsequent
tests.

Removes the existing TODO comment.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-03-12 12:27:24 +00:00
Anatol Belski
ec5374cd99 performance-metrics: Set image_type for backing file tests
Add explicit image_type=qcow2 along backing_files=on
for the relevant QCOW2 perf tests.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-02-22 21:05:25 +00:00
Anatol Belski
16d6a16e5c performance-metrics: Add standalone qcow2 perf tests
Add performance tests for standalone qcow2 images without backing
files - uncompressed, zlib and zstd compressed. Each variant
includes single queue and multiqueue tests for sequential
read, random read and warmed up sequential read.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-02-16 11:50:23 +00:00
Anatol Belski
333db1acb3 performance-metrics: Add multi-queue overlay block I/O tests
Add multiqueue num_queues=4 performance tests for qcow2 overlay
images with both qcow2 and raw backing files - sequential read,
random read, and warm read variants.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-02-16 11:50:23 +00:00
Anatol Belski
ecb971a491 performance-metrics: Add backing_files=on for overlay tests
The backing_files option defaults to false, so qcow2 overlay
tests fail with MaxNestingDepthExceeded. Pass backing_files=on
when the test file is an overlay.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-02-15 12:31:32 +00:00
Muminul Islam
6042eb969e tests: remove timeout argument
Now Guest struct has an option to set timeout.
No need to pass timeout while booting the guest.
If no timeout is set, default is used.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-02-06 06:37:26 +00:00
Anatol Belski
cde7856d9e performance-metrics: Add warmup support for warm cache testing
Add warmup_iterations field to run iterations before measuring
performance. This complements existing cold start tests
by separating cache effects from steady state throughput.

New tests with 2 warmup iterations:
- block_qcow2_backing_qcow2_read_warm_MiBps
- block_qcow2_backing_raw_read_warm_MiBps

Results show warm cache is much faster and more consistent:
- QCOW2: 1766 MiB/s (4% variance) vs cold 960 MiB/s (73% variance)
- RAW: 1822 MiB/s (6% variance) vs cold 1300 MiB/s (55% variance)

RAW backing is 3% faster than QCOW2 in steady state.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-01-16 18:54:22 +00:00