Skip to content

Commit c33e05d

Browse files
dmatlackbonzini
authored andcommitted
KVM: selftests: Introduce access_tracking_perf_test
This test measures the performance effects of KVM's access tracking. Access tracking is driven by the MMU notifiers test_young, clear_young, and clear_flush_young. These notifiers do not have a direct userspace API, however the clear_young notifier can be triggered by marking a pages as idle in /sys/kernel/mm/page_idle/bitmap. This test leverages that mechanism to enable access tracking on guest memory. To measure performance this test runs a VM with a configurable number of vCPUs that each touch every page in disjoint regions of memory. Performance is measured in the time it takes all vCPUs to finish touching their predefined region. Example invocation: $ ./access_tracking_perf_test -v 8 Testing guest mode: PA-bits:ANY, VA-bits:48, 4K pages guest physical test memory offset: 0xffdfffff000 Populating memory : 1.337752570s Writing to populated memory : 0.010177640s Reading from populated memory : 0.009548239s Mark memory idle : 23.973131748s Writing to idle memory : 0.063584496s Mark memory idle : 24.924652964s Reading from idle memory : 0.062042814s Breaking down the results: * "Populating memory": The time it takes for all vCPUs to perform the first write to every page in their region. * "Writing to populated memory" / "Reading from populated memory": The time it takes for all vCPUs to write and read to every page in their region after it has been populated. This serves as a control for the later results. * "Mark memory idle": The time it takes for every vCPU to mark every page in their region as idle through page_idle. * "Writing to idle memory" / "Reading from idle memory": The time it takes for all vCPUs to write and read to every page in their region after it has been marked idle. This test should be portable across architectures but it is only enabled for x86_64 since that's all I have tested. Reviewed-by: Ben Gardon <[email protected]> Signed-off-by: David Matlack <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 15b7b73 commit c33e05d

File tree

3 files changed

+431
-0
lines changed

3 files changed

+431
-0
lines changed

tools/testing/selftests/kvm/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
/x86_64/xen_vmcall_test
3939
/x86_64/xss_msr_test
4040
/x86_64/vmx_pmu_msrs_test
41+
/access_tracking_perf_test
4142
/demand_paging_test
4243
/dirty_log_test
4344
/dirty_log_perf_test

tools/testing/selftests/kvm/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/tsc_msrs_test
7171
TEST_GEN_PROGS_x86_64 += x86_64/vmx_pmu_msrs_test
7272
TEST_GEN_PROGS_x86_64 += x86_64/xen_shinfo_test
7373
TEST_GEN_PROGS_x86_64 += x86_64/xen_vmcall_test
74+
TEST_GEN_PROGS_x86_64 += access_tracking_perf_test
7475
TEST_GEN_PROGS_x86_64 += demand_paging_test
7576
TEST_GEN_PROGS_x86_64 += dirty_log_test
7677
TEST_GEN_PROGS_x86_64 += dirty_log_perf_test

0 commit comments

Comments
 (0)