From: Paolo Bonzini Date: Tue, 16 Nov 2021 12:44:13 +0000 (-0500) Subject: Merge branch 'kvm-selftest' into kvm-master X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=e5bc4d4602b8e0e63c9d00d210120d6bcfaea590;p=linux.git Merge branch 'kvm-selftest' into kvm-master - Cleanups for the perf test infrastructure and mapping hugepages - Avoid contention on mmap_sem when the guests start to run - Add event channel upcall support to xen_shinfo_test --- e5bc4d4602b8e0e63c9d00d210120d6bcfaea590 diff --cc tools/testing/selftests/kvm/lib/kvm_util.c index 14bb4d5b6bb7d,1f6a01c33dce5..8f2e0bb1ef96a --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@@ -22,28 -22,6 +22,19 @@@ static int vcpu_mmap_sz(void); - /* Aligns x up to the next multiple of size. Size must be a power of 2. */ - static void *align(void *x, size_t size) - { - size_t mask = size - 1; - TEST_ASSERT(size != 0 && !(size & (size - 1)), - "size not a power of 2: %lu", size); - return (void *) (((size_t) x + mask) & ~mask); - } - +int open_path_or_exit(const char *path, int flags) +{ + int fd; + + fd = open(path, flags); + if (fd < 0) { + print_skip("%s not available (errno: %d)", path, errno); + exit(KSFT_SKIP); + } + + return fd; +} + /* * Open KVM_DEV_PATH if available, otherwise exit the entire program. *