KVM: selftests: Introduce steal-time test

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 <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Andrew Jones
2020-03-13 16:56:44 +01:00
committed by Paolo Bonzini
parent beca54702d
commit 94c4b76b88
7 changed files with 385 additions and 5 deletions

View File

@@ -71,6 +71,21 @@ struct timespec timespec_diff(struct timespec start, struct timespec end)
return temp;
}
struct timespec timespec_add_ns(struct timespec ts, int64_t ns)
{
struct timespec res;
res.tv_sec = ts.tv_sec;
res.tv_nsec = ts.tv_nsec + ns;
if (res.tv_nsec > 1000000000UL) {
res.tv_sec += 1;
res.tv_nsec -= 1000000000UL;
}
return res;
}
void print_skip(const char *fmt, ...)
{
va_list ap;