Re: [PATCH 17/17] KVM: selftests: Add nested transition benchmark
From: sashiko-bot
Date: Sun Sep 20 2026 - 17:52:49 EST
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] kvm: selftests: mismatch between commit message (100k) and code (10k) iterations
--
commit fe906ec5562df5e882aa5dfe67e35c886ebd82f2
Author: David Woodhouse <dwmw@xxxxxxxxxxxx>
KVM: selftests: Add nested transition benchmark
This commit adds a benchmark to measure L1 to L2 nested virtualization
transition costs. It tests the reflected-exit phase and an MSR-intercept
phase on SVM, reporting performance metrics from L1's perspective.
> Measure L1<->L2 transition costs from L1's viewpoint, in TSC cycles:
> a reflected-exit phase (cpuid in L2, forwarded to L1: the full
> emulated vmexit->vmentry round trip, exercising the vmcb12/vmcs12
> access paths), and on SVM an MSR-intercept phase (rdmsr in L2 with
> INTERCEPT_MSR_PROT: exercises the per-intercept lookup in L1's MSR
> permissions map). Reports min/avg/p50/p99/max over 100k iterations.
[Severity: Medium]
Is the iteration count in the commit message accurate? The message states
the benchmark reports over 100k iterations, but the code defines N_ITERS
as 10000 and explicitly notes that 10k samples is sufficient:
> diff --git a/tools/testing/selftests/kvm/x86/nested_transition_bench.c b/tools/testing/selftests/kvm/x86/nested_transition_bench.c
> --- /dev/null
> +++ b/tools/testing/selftests/kvm/x86/nested_transition_bench.c
[ ... ]
> +/*
> + * Keep the iteration count modest: every timed iteration includes a
> + * ucall round trip to userspace to report its sample, which on a
> + * debug (KASAN) kernel costs milliseconds. 10k samples still give a
> + * stable p99.
> + */
> +#define N_WARMUP 1000
> +#define N_ITERS 10000
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260920211920.928306-1-dwmw2@xxxxxxxxxxxxx?part=17