Commit Graph

285 Commits

Author SHA1 Message Date
Henry Hrvoje Tonkovac
427c4de928 performance-metrics: trim qualified paths
Import the std modules used in the crate instead of spelling the full
paths at every use site, and drop the now-unnecessary crate-level
#![expect(clippy::absolute_paths)].

Signed-off-by: Henry Hrvoje Tonkovac <htonkovac@gmail.com>
Assisted-by: Claude:Opus-4.8
2026-06-17 17:28:07 +00:00
Tushar Khatri
bf68b35ab7 performance-metrics: reevaluate #[allow] attributes
Convert the still-needed #[allow] to #[expect] so it warns if the
lint stops firing.

Part of #8326.

Signed-off-by: Tushar Khatri <hello@tusharkhatri.in>
2026-06-17 17:14:00 +00:00
Rob Bradford
2bc968ba1d build: Deny clippy::absolute_paths
Removal of absolute paths is currently in progress. To avoid regressing
those changes add a clippy deny at the workspace level and at the crate
level override with #[expect(clippy::absolute_paths)]

See: #7670

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-06-17 14:38:25 +01:00
Rob Bradford
34e8e3dbf9 performance-metrics: Switch to QcowDisk
Switch from QcowFile to QcowDisk taking advantage of QcowTempDisk where
appropriate.

Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-06-08 13:19:32 +00:00
Philipp Schuster
4a6add8808 performance-metrics: remove unneeded #[allow(dead_code)]
On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-06-03 13:56:31 +00:00
Philipp Schuster
d840b6dca1 performance-metrics: remove unused dependencies
On-behalf-of: SAP philipp.schuster@sap.com
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2026-06-03 13:56:31 +00:00
Anatol Belski
2c8978bbf2 block: Remove qcow compat alias
Update external consumers to use formats::qcow::internal instead
of the top level qcow alias. Keep a crate private use for the
QcowError variant in lib.rs.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-05-28 11:58:58 +00:00
Anatol Belski
f8327faa33 block: Remove raw_disk compat alias
Update external consumers and internal test modules to use
formats::raw instead of the raw_disk alias, then remove the
re-export from lib.rs.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-05-28 11:58:58 +00:00
Anatol Belski
25afb8898c block: Move QCOW2 format files into formats/qcow/
Move QCOW2 format implementation into a structured directory layout:

  qcow/              -> formats/qcow/internal/  (filenames unchanged)
  qcow_disk.rs       -> formats/qcow/mod.rs               (QcowDisk)
  qcow_sync.rs       -> formats/qcow/worker/sync.rs       (QcowSync)
  qcow_async.rs      -> formats/qcow/worker/async_uring.rs (QcowAsync)
  qcow_common.rs     -> formats/qcow/common.rs

All internal cross references continue to resolve through
re-exports in lib.rs: formats::qcow::internal as qcow,
formats::qcow as qcow_disk, and
formats::qcow::common as qcow_common.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-05-28 11:58:58 +00:00
Dylan Reid
1b2326fde4 block: Remove legacy async I/O API
Drop the borrowed iovec AsyncIo entry points now that all callers use
owned operations. Rename the transitional owned batch and completion
methods to the final trait names and remove the borrowed submission
helpers from the queue wrappers.

This removes a bunch of known safety foot-guns so future-us don't
accidentally use them.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Dylan Reid <dgreid@fb.com>
2026-05-27 12:07:03 +00:00
Dylan Reid
1dfc642e9a performance-metrics: Use owned async block I/O
Switch the in-process block microbenchmarks to allocate prefaulted
GuestMemory regions and submit through the memory-target AsyncIo API.

This adds a few setup steps as the existing benchmarks relied on the
unsound iovec API. The new behavior is intended to be as close as
possible to the existing tests and the common path for running
cloud-hypervisor.

Assisted-by: Codex:GPT-5.5
Assisted-by: Claude:Opus-4.7
Signed-off-by: Dylan Reid <dgreid@fb.com>
2026-05-27 12:07:03 +00:00
Rob Bradford
55adcc27da tests: Replace last vestiges of focal use with jammy
Focal has served us well for many years but is now beyond EOL. Remove
all remaining use of focal images from the CI.

Signed-off-by: Rob Bradford <rbradford@meta.com>
2026-05-11 17:52:00 +00:00
Muminul Islam
ad03b1b250 performance-metrics: Use default_cpus() across all tests
Replace explicit --cpus boot=N arguments with .default_cpus()
in all performance test functions. For confidential guests,
nested=on is not supported, so using default_cpus() ensures
nested=off is correctly set for confidential VMs.

The net throughput, net latency, and block I/O tests now set
guest.num_cpu to the number of queues before calling
default_cpus(), ensuring the correct vCPU count is used.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-06 11:40:42 +00:00
Muminul Islam
a5adc7014c performance-metrics: Pass full control to guest constructor
Refactor performance_test_new_guest to accept the full
PerformanceTestControl reference instead of just GuestVmType.
This allows the function to also set guest.num_cpu from
control.num_boot_vcpus, ensuring the guest is configured
with the correct number of vCPUs for the test.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-06 11:40:42 +00:00
Muminul Islam
3df0579866 performance-metrics: avoid double ref in test selection
Use into_iter() for test_list when building tests_to_run.

This keeps the collected type as Vec<&PerformanceTest>.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-04 21:36:25 +00:00
Julian Schindel
032f29da29 misc: replace as <pointer> casts with safer alternatives
`as` casts can change mutability, which quickly leads to undefined
behavior.

Signed-off-by: Julian Schindel <mail@arctic-alpaca.de>
2026-05-03 08:38:31 +00:00
Muminul Islam
89cae74ddd performance-metrics: Use default_kernel_cmdline helper
Replace explicit --kernel and --cmdline arguments with the
default_kernel_cmdline() helper in performance_net_throughput,
performance_net_latency, and performance_block_io. This
simplifies the code and ensures consistency with how the
kernel command line is configured across tests.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-01 09:36:58 +00:00
Muminul Islam
3440802c99 performance-metrics: CVM not supported on AArch64
Confidential VMs (CVM) are not currently supported on the
AArch64 architecture. Add an early check in the performance
metrics binary to exit with a clear error message when CVM
mode is selected on AArch64.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-01 09:36:58 +00:00
Muminul Islam
7d684e3add performance-metrics: Add --vm-type CLI argument
Add a --vm-type command-line argument to allow users to select
between 'regular' (default) and 'confidential' (CVM) VM types
when running performance tests.

Example: --vm-type confidential

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-01 09:36:58 +00:00
Muminul Islam
ab7749a5ce performance-metrics: Apply vm_type override in run()
Apply the vm_type override from PerformanceTestOverrides to the
effective_control used during test execution, alongside the
existing test_timeout override.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-01 09:36:58 +00:00
Muminul Islam
56a986145e performance-metrics: Add vm_type to PerformanceTestOverrides
Add an optional vm_type field to PerformanceTestOverrides to
allow overriding the VM type at runtime. Include vm_type in
the Display output for override logging.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-01 09:36:58 +00:00
Muminul Islam
55e2700fbc performance-metrics: Use control.vm_type in all tests
Replace hardcoded GuestVmType::Regular with control.vm_type
in all performance test functions to support CVM benchmarking:
net_throughput, net_latency, boot_time, boot_time_pmem,
block_io, and restore_latency.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-01 09:36:58 +00:00
Muminul Islam
938db39e26 performance-metrics: Add vm_type param to new_guest
Update performance_test_new_guest() to accept a GuestVmType
parameter. When set to Confidential, configure the guest with
CVM-specific settings: vm_type, boot_timeout, and nested
virtualization disabled.

All callers pass GuestVmType::Regular to preserve existing
behavior.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-01 09:36:58 +00:00
Muminul Islam
82a0dc7252 performance-metrics: Add vm_type to PerformanceTestControl
Add a vm_type field of type GuestVmType to PerformanceTestControl,
defaulting to GuestVmType::Regular. Include vm_type in the Display
output for test control logging.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-01 09:36:58 +00:00
Muminul Islam
4b4845eb4d performance-metrics: Refactor run() to use effective_control
Consolidate override application into a single effective_control
variable built once before the test loop. This removes duplicated
timeout override logic from both warmup and measurement iterations.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
2026-05-01 09:36:58 +00:00
Anatol Belski
65c98ca157 performance-metrics: Use QcowDisk for QCOW2 benchmarks
Replace QcowDiskSync and QcowDiskAsync with QcowDisk in all QCOW2
benchmark helpers. The sync helpers pass use_io_uring=false, the
async helpers pass use_io_uring=true.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-27 11:19:37 +00:00
Anatol Belski
556cb6be46 performance-metrics: Use RawDisk for AIO micro benchmark
Replace direct RawFileAsyncAio construction with RawDisk
and create_async_io, consistent with the unified API.

Assisted-by: Claude:Opus-4.6
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-23 20:15:49 +00:00
Anatol Belski
21cd13df01 block: Rename AsyncDiskFile::new_async_io to create_async_io
The new_ prefix in Rust conventionally denotes constructors that return
Self (e.g. Vec::new(), File::new()). AsyncDiskFile::new_async_io does
not return Self. It is a factory method that constructs and returns a
Box<dyn AsyncIo> worker bound to the disk file descriptor and
metadata. The create_ prefix communicates this: the caller receives
a freshly constructed object of a different type.

This rename touches every format backend in block plus two external
callers in virtio-devices and performance-metrics. Every change is a
mechanical s/new_async_io/create_async_io/ substitution. No functional
change.

Ref: #7877 (task 3.2.8)
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-21 10:36:52 +00:00
Anatol Belski
a597c74385 performance-metrics: Replace pkill cleanup with ProcessRegistry
Use thread::Builder to give the test thread a name matching the
test so Guest picks it up automatically.  After every test, call
ProcessRegistry::cleanup() to kill the process group instead of
the old pkill based cleanup_stale_processes().

Remove cleanup_stale_processes() and its call sites.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-20 18:09:02 +00:00
Anatol Belski
1ab877882d performance-metrics: Add QCOW2 batch write micro benchmark
Add micro_bench_qcow_batch_write which builds a batch of num_ops
write requests and submits them all at once through
submit_batch_requests. Writes in QcowAsync are synchronous (COW
path), so this measures whether batching reduces per-request
overhead compared to individual write_vectored calls.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
8052c5a66b performance-metrics: Add QCOW2 async L2 cache miss micro benchmark
Add micro_bench_qcow_async_l2_cache_miss which reads one cluster
from each of num_ops distinct L2 tables through the QcowAsync
io_uring path, forcing L2 cache eviction on nearly every read.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
3804968eef performance-metrics: Add sparse async QCOW2 tempfile helper
Add sparse_qcow_async_tempfile which creates a sparse QCOW2 image
with one cluster per L2 table and opens it via QcowDiskAsync.
Mirrors the existing sparse_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
1d5d13eb7b performance-metrics: Add QCOW2 async write micro benchmark
Add micro_bench_qcow_async_write which writes clusters into an
empty QCOW2 image through the QcowAsync io_uring path. Writes
in QcowAsync are synchronous due to COW metadata allocation, so
this measures the write path overhead through the async code path.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
1069505151 performance-metrics: Add empty async QCOW2 tempfile helper
Add empty_qcow_async_tempfile which creates an empty QCOW2 image
and opens it via QcowDiskAsync. Mirrors the existing
empty_qcow_tempfile for io_uring write benchmarks.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
Anatol Belski
fca6429e9b performance-metrics: Add QCOW2 async compressed read micro benchmark
Add micro_bench_qcow_async_compressed_read which reads from a
zlib compressed QCOW2 image through the QcowAsync io_uring path.
Compressed clusters take the sync fallback since they require
decompression.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2026-04-16 17:27:38 +00:00
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