Commit 2b3f2325 authored by Paolo Bonzini's avatar Paolo Bonzini

Merge tag 'kvm-x86-selftests-6.6-fixes' of https://github.com/kvm-x86/linux into HEAD

KVM selftests fixes for 6.6:

 - Play nice with %llx when formatting guest printf and assert statements.

 - Clean up stale test metadata.

 - Zero-initialize structures in memslot perf test to workaround a suspected
   "may be used uninitialized" false positives from GCC.
parents 88e4cd89 6313e096
/* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */
/* /*
* tools/testing/selftests/kvm/include/kvm_util.h
*
* Copyright (C) 2018, Google LLC. * Copyright (C) 2018, Google LLC.
*/ */
#ifndef SELFTEST_KVM_UCALL_COMMON_H #ifndef SELFTEST_KVM_UCALL_COMMON_H
......
...@@ -200,6 +200,13 @@ int guest_vsnprintf(char *buf, int n, const char *fmt, va_list args) ...@@ -200,6 +200,13 @@ int guest_vsnprintf(char *buf, int n, const char *fmt, va_list args)
++fmt; ++fmt;
} }
/*
* Play nice with %llu, %llx, etc. KVM selftests only support
* 64-bit builds, so just treat %ll* the same as %l*.
*/
if (qualifier == 'l' && *fmt == 'l')
++fmt;
/* default base */ /* default base */
base = 10; base = 10;
......
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* tools/testing/selftests/kvm/lib/x86_64/processor.c
*
* Copyright (C) 2021, Google LLC. * Copyright (C) 2021, Google LLC.
*/ */
......
...@@ -1033,9 +1033,8 @@ static bool test_loop(const struct test_data *data, ...@@ -1033,9 +1033,8 @@ static bool test_loop(const struct test_data *data,
struct test_result *rbestruntime) struct test_result *rbestruntime)
{ {
uint64_t maxslots; uint64_t maxslots;
struct test_result result; struct test_result result = {};
result.nloops = 0;
if (!test_execute(targs->nslots, &maxslots, targs->seconds, data, if (!test_execute(targs->nslots, &maxslots, targs->seconds, data,
&result.nloops, &result.nloops,
&result.slot_runtime, &result.guest_runtime)) { &result.slot_runtime, &result.guest_runtime)) {
...@@ -1089,7 +1088,7 @@ int main(int argc, char *argv[]) ...@@ -1089,7 +1088,7 @@ int main(int argc, char *argv[])
.seconds = 5, .seconds = 5,
.runs = 1, .runs = 1,
}; };
struct test_result rbestslottime; struct test_result rbestslottime = {};
int tctr; int tctr;
if (!check_memory_sizes()) if (!check_memory_sizes())
...@@ -1098,11 +1097,10 @@ int main(int argc, char *argv[]) ...@@ -1098,11 +1097,10 @@ int main(int argc, char *argv[])
if (!parse_args(argc, argv, &targs)) if (!parse_args(argc, argv, &targs))
return -1; return -1;
rbestslottime.slottimens = 0;
for (tctr = targs.tfirst; tctr <= targs.tlast; tctr++) { for (tctr = targs.tfirst; tctr <= targs.tlast; tctr++) {
const struct test_data *data = &tests[tctr]; const struct test_data *data = &tests[tctr];
unsigned int runctr; unsigned int runctr;
struct test_result rbestruntime; struct test_result rbestruntime = {};
if (tctr > targs.tfirst) if (tctr > targs.tfirst)
pr_info("\n"); pr_info("\n");
...@@ -1110,7 +1108,6 @@ int main(int argc, char *argv[]) ...@@ -1110,7 +1108,6 @@ int main(int argc, char *argv[])
pr_info("Testing %s performance with %i runs, %d seconds each\n", pr_info("Testing %s performance with %i runs, %d seconds each\n",
data->name, targs.runs, targs.seconds); data->name, targs.runs, targs.seconds);
rbestruntime.runtimens = 0;
for (runctr = 0; runctr < targs.runs; runctr++) for (runctr = 0; runctr < targs.runs; runctr++)
if (!test_loop(data, &targs, if (!test_loop(data, &targs,
&rbestslottime, &rbestruntime)) &rbestslottime, &rbestruntime))
......
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* KVM_GET/SET_* tests
*
* Copyright (C) 2022, Red Hat, Inc. * Copyright (C) 2022, Red Hat, Inc.
* *
* Tests for Hyper-V extensions to SVM. * Tests for Hyper-V extensions to SVM.
......
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* tools/testing/selftests/kvm/nx_huge_page_test.c
*
* Usage: to be run via nx_huge_page_test.sh, which does the necessary * Usage: to be run via nx_huge_page_test.sh, which does the necessary
* environment setup and teardown * environment setup and teardown
* *
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
# Wrapper script which performs setup and cleanup for nx_huge_pages_test. # Wrapper script which performs setup and cleanup for nx_huge_pages_test.
# Makes use of root privileges to set up huge pages and KVM module parameters. # Makes use of root privileges to set up huge pages and KVM module parameters.
# #
# tools/testing/selftests/kvm/nx_huge_page_test.sh
# Copyright (C) 2022, Google LLC. # Copyright (C) 2022, Google LLC.
set -e set -e
......
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* svm_vmcall_test
*
* Copyright © 2021 Amazon.com, Inc. or its affiliates. * Copyright © 2021 Amazon.com, Inc. or its affiliates.
*
* Xen shared_info / pvclock testing
*/ */
#include "test_util.h" #include "test_util.h"
......
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* svm_vmcall_test
*
* Copyright © 2021 Amazon.com, Inc. or its affiliates. * Copyright © 2021 Amazon.com, Inc. or its affiliates.
*
* Xen shared_info / pvclock testing
*/ */
#include "test_util.h" #include "test_util.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment