aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kvm/include/test_util.h
AgeCommit message (Collapse)AuthorFilesLines
2020-11-08KVM: selftests: Introduce the dirty log perf testBen Gardon1-0/+1
The dirty log perf test will time verious dirty logging operations (enabling dirty logging, dirtying memory, getting the dirty log, clearing the dirty log, and disabling dirty logging) in order to quantify dirty logging performance. This test can be used to inform future performance improvements to KVM's dirty logging infrastructure. This series was tested by running the following invocations on an Intel Skylake machine: dirty_log_perf_test -b 20m -i 100 -v 64 dirty_log_perf_test -b 20g -i 5 -v 4 dirty_log_perf_test -b 4g -i 5 -v 32 demand_paging_test -b 20m -v 64 demand_paging_test -b 20g -v 4 demand_paging_test -b 4g -v 32 All behaved as expected. Signed-off-by: Ben Gardon <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2020-11-08KVM: selftests: Simplify demand_paging_test with timespec_diff_nowBen Gardon1-0/+1
Add a helper function to get the current time and return the time since a given start time. Use that function to simplify the timekeeping in the demand paging test. This series was tested by running the following invocations on an Intel Skylake machine: dirty_log_perf_test -b 20m -i 100 -v 64 dirty_log_perf_test -b 20g -i 5 -v 4 dirty_log_perf_test -b 4g -i 5 -v 32 demand_paging_test -b 20m -v 64 demand_paging_test -b 20g -v 4 demand_paging_test -b 4g -v 32 All behaved as expected. Signed-off-by: Ben Gardon <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2020-03-18KVM: selftests: Rework timespec functions and usageAndrew Jones1-1/+2
The steal_time test's timespec stop condition was wrong and should have used the timespec functions instead to avoid being wrong, but timespec_diff had a strange interface. Rework all the timespec API and its use. Signed-off-by: Andrew Jones <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2020-03-16selftests: kvm: Introduce the TEST_FAIL macroWainer dos Santos Moschetta1-0/+3
Some tests/utilities use the TEST_ASSERT(false, ...) pattern to indicate a failure and stop execution. This change introduces the TEST_FAIL macro which is a wrap around TEST_ASSERT(false, ...) and so provides a direct alternative for failing a test. Signed-off-by: Wainer dos Santos Moschetta <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2020-03-16KVM: selftests: Introduce steal-time testAndrew Jones1-0/+1
The steal-time test confirms what is reported to the guest as stolen time is consistent with the run_delay reported for the VCPU thread on the host. Both x86_64 and AArch64 have the concept of steal/stolen time so this test is introduced for both architectures. While adding the test we ensure .gitignore has all tests listed (it was missing s390x/resets) and that the Makefile has all tests listed in alphabetical order (not really necessary, but it almost was already...). We also extend the common API with a new num-guest- pages call and a new timespec call. Signed-off-by: Andrew Jones <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2020-03-16KVM: selftests: Use consistent message for test skippingAndrew Jones1-0/+2
Signed-off-by: Andrew Jones <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2020-03-16KVM: selftests: Enable printf format warnings for TEST_ASSERTAndrew Jones1-1/+2
Use the format attribute to enable printf format warnings, and then fix them all. Signed-off-by: Andrew Jones <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2020-03-16KVM: selftests: Rework debug message printingAndrew Jones1-0/+13
There were a few problems with the way we output "debug" messages. The first is that we used DEBUG() which is defined when NDEBUG is not defined, but NDEBUG will never be defined for kselftests because it relies too much on assert(). The next is that most of the DEBUG() messages were actually "info" messages, which users may want to turn off if they just want a silent test that either completes or asserts. Finally, a debug message output from a library function, and thus for all tests, was annoying when its information wasn't interesting for a test. Rework these messages so debug messages only output when DEBUG is defined and info messages output unless QUIET is defined. Also name the functions pr_debug and pr_info and make sure that when they're disabled we eat all the inputs. The later avoids unused variable warnings when the variables were only defined for the purpose of printing. Signed-off-by: Andrew Jones <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2020-03-16KVM: selftests: Time guest demand pagingBen Gardon1-0/+3
In order to quantify demand paging performance, time guest execution during demand paging. Signed-off-by: Ben Gardon <[email protected]> [Move timespec-diff to test_util.h] Signed-off-by: Andrew Jones <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2020-03-16KVM: selftests: Add memory size parameter to the demand paging testBen Gardon1-0/+2
Add an argument to allow the demand paging test to work on larger and smaller guest sizes. Signed-off-by: Ben Gardon <[email protected]> [Rewrote parse_size() to simplify and provide user more flexibility as to how sizes are input. Also fixed size overflow assert.] Signed-off-by: Andrew Jones <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 482Thomas Gleixner1-3/+1
Based on 1 normalized pattern(s): this work is licensed under the terms of the gnu gpl version 2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 48 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Allison Randal <[email protected]> Reviewed-by: Enrico Weigelt <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-10-17kvm: selftests: move arch-specific files to arch-specific locationsAndrew Jones1-3/+3
Signed-off-by: Andrew Jones <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2018-08-22kvm: selftest: include the tools headersPeter Xu1-2/+0
Let the kvm selftest include the tools headers, then we can start to use things there like bitmap operations. Signed-off-by: Peter Xu <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2018-05-11KVM: selftests: exit with 0 status code when tests cannot be runPaolo Bonzini1-0/+1
Right now, skipped tests are returning a failure exit code if /dev/kvm does not exists. Consistently return a zero status code so that various scripts over the interwebs do not complain. Also return a zero status code if the KVM_CAP_SYNC_REGS capability is not present, and hardcode in the test the register kinds that are covered (rather than just using whatever value of KVM_SYNC_X86_VALID_FIELDS is provided by the kernel headers). Signed-off-by: Paolo Bonzini <[email protected]>
2018-04-04kvm: selftests: add API testing infrastructurePaolo Bonzini1-0/+45
Testsuite contributed by Google and cleaned up by myself for inclusion in Linux. Signed-off-by: Ken Hofsass <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>