#
00de073e |
|
11-Jan-2024 |
Nina Schoetterl-Glausch <nsg@linux.ibm.com> |
KVM: s390: selftest: memop: Fix undefined behavior If an integer's type has x bits, shifting the integer left by x or more is undefined behavior. This can happen in the rotate function when attempting to do a rotation of the whole value by 0. Fixes: 0dd714bfd200 ("KVM: s390: selftest: memop: Add cmpxchg tests") Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com> Link: https://lore.kernel.org/r/20240111094805.363047-1-nsg@linux.ibm.com Acked-by: Janosch Frank <frankja@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Message-Id: <20240111094805.363047-1-nsg@linux.ibm.com>
|
#
559a1462 |
|
20-Feb-2024 |
Eric Farman <farman@linux.ibm.com> |
KVM: s390: selftests: memop: add a simple AR test There is a selftest that checks for an (expected) error when an invalid AR is specified, but not one that exercises the AR path. Add a simple test that mirrors the vanilla write/read test while providing an AR. An AR that contains zero will direct the CPU to use the primary address space normally used anyway. AR[1] is selected for this test because the host AR[1] is usually non-zero, and KVM needs to correctly swap those values. Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com> Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com> Signed-off-by: Eric Farman <farman@linux.ibm.com> Link: https://lore.kernel.org/r/20240220211211.3102609-3-farman@linux.ibm.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
|
#
7ce7f8e7 |
|
28-Jul-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Rip out old, param-based guest assert macros Drop the param-based guest assert macros and enable the printf versions for all selftests. Note! This change can affect tests even if they don't use directly use guest asserts! E.g. via library code, or due to the compiler making different optimization decisions. Link: https://lore.kernel.org/r/20230729003643.1053367-33-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
428c76c7 |
|
28-Jul-2023 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Convert s390's memop test to printf style GUEST_ASSERT Convert s390's memop test to printf-based GUEST_ASSERT, and opportunistically use GUEST_FAIL() to report invalid sizes. Link: https://lore.kernel.org/r/20230729003643.1053367-17-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
6d85f51a |
|
12-Jul-2023 |
Thomas Huth <thuth@redhat.com> |
KVM: selftests: Rename the ASSERT_EQ macro There is already an ASSERT_EQ macro in the file tools/testing/selftests/kselftest_harness.h, so currently KVM selftests can't include test_util.h from the KVM selftests together with that file. Rename the macro in the KVM selftests to TEST_ASSERT_EQ to avoid the problem - it is also more similar to the other macros in test_util.h that way. Suggested-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Link: https://lore.kernel.org/r/20230712075910.22480-2-thuth@redhat.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
0dd714bf |
|
07-Feb-2023 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftest: memop: Add cmpxchg tests Test successful exchange, unsuccessful exchange, storage key protection and invalid arguments. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Acked-by: Janosch Frank <frankja@linux.ibm.com> Link: https://lore.kernel.org/r/20230207164225.2114706-1-scgl@linux.ibm.com Message-Id: <20230207164225.2114706-1-scgl@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
#
dc55ceae |
|
06-Feb-2023 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftest: memop: Fix integer literal The address is a 64 bit value, specifying a 32 bit value can crash the guest. In this case things worked out with -O2 but not -O0. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Fixes: 1bb873495a9e ("KVM: s390: selftests: Add more copy memop tests") Reviewed-by: Thomas Huth <thuth@redhat.com> Link: https://lore.kernel.org/r/20230206164602.138068-8-scgl@linux.ibm.com Message-Id: <20230206164602.138068-8-scgl@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
#
12c12a99 |
|
06-Feb-2023 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftest: memop: Fix wrong address being used in test The guest code sets the key for mem1 only. In order to provoke a protection exception the test codes needs to address mem1. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by: Nico Boehr <nrb@linux.ibm.com> Link: https://lore.kernel.org/r/20230206164602.138068-7-scgl@linux.ibm.com Message-Id: <20230206164602.138068-7-scgl@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
#
76a2ee43 |
|
06-Feb-2023 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftest: memop: Fix typo "acceeded" isn't a word, should be "exceeded". Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Nico Boehr <nrb@linux.ibm.com> Link: https://lore.kernel.org/r/20230206164602.138068-6-scgl@linux.ibm.com Message-Id: <20230206164602.138068-6-scgl@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
#
06e5da81 |
|
06-Feb-2023 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftest: memop: Add bad address test Add a test that tries a real write to a bad address. The existing CHECK_ONLY test doesn't cover all paths. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by: Nico Boehr <nrb@linux.ibm.com> Reviewed-by: Janosch Frank <frankja@linux.ibm.com> Link: https://lore.kernel.org/r/20230206164602.138068-5-scgl@linux.ibm.com Message-Id: <20230206164602.138068-5-scgl@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
#
de14e014 |
|
06-Feb-2023 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftest: memop: Move testlist into main This allows checking if the necessary requirements for a test case are met via an arbitrary expression. In particular, it is easy to check if certain bits are set in the memop extension capability. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Janosch Frank <frankja@linux.ibm.com> Link: https://lore.kernel.org/r/20230206164602.138068-4-scgl@linux.ibm.com Message-Id: <20230206164602.138068-4-scgl@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
#
12d27074 |
|
06-Feb-2023 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftest: memop: Replace macros by functions Replace the DEFAULT_* test helpers by functions, as they don't need the extra flexibility. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Acked-by: Janosch Frank <frankja@linux.ibm.com> Link: https://lore.kernel.org/r/20230206164602.138068-3-scgl@linux.ibm.com Message-Id: <20230206164602.138068-3-scgl@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
#
7d42b38d |
|
06-Feb-2023 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftest: memop: Pass mop_desc via pointer The struct is quite large, so this seems nicer. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Janosch Frank <frankja@linux.ibm.com> Link: https://lore.kernel.org/r/20230206164602.138068-2-scgl@linux.ibm.com Message-Id: <20230206164602.138068-2-scgl@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
#
197ebb71 |
|
15-Nov-2022 |
Vishal Annapurve <vannapurve@google.com> |
KVM: selftests: move common startup logic to kvm_util.c Consolidate common startup logic in one place by implementing a single setup function with __attribute((constructor)) for all selftests within kvm_util.c. This allows moving logic like: /* Tell stdout not to buffer its content */ setbuf(stdout, NULL); to a single file for all selftests. This will also allow any required setup at entry in future to be done in common main function. Link: https://lore.kernel.org/lkml/Ywa9T+jKUpaHLu%2Fl@google.com Suggested-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Andrew Jones <andrew.jones@linux.dev> Reviewed-by: Peter Gonda <pgonda@google.com> Signed-off-by: Vishal Annapurve <vannapurve@google.com> Link: https://lore.kernel.org/r/20221115213845.3348210-2-vannapurve@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
|
#
37f80a7c |
|
14-Jun-2022 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftests: Fix memop extension capability check Fix the inverted logic of the memop extension capability check. Fixes: 97da92c0ff92 ("KVM: s390: selftests: Use TAP interface in the memop test") Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Message-Id: <20220614162635.3445019-1-scgl@linux.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
7ed397d1 |
|
27-May-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Add TEST_REQUIRE macros to reduce skipping copy+paste Add TEST_REQUIRE() and __TEST_REQUIRE() to replace the myriad open coded instances of selftests exiting with KSFT_SKIP after printing an informational message. In addition to reducing the amount of boilerplate code in selftests, the UPPERCASE macro names make it easier to visually identify a test's requirements. Convert usage that erroneously uses something other than print_skip() and/or "exits" with '0' or some other non-KSFT_SKIP value. Intentionally drop a kvm_vm_free() in aarch64/debug-exceptions.c as part of the conversion. All memory and file descriptors are freed on process exit, so the explicit free is superfluous. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
768e9a61 |
|
02-Jun-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Purge vm+vcpu_id == vcpu silliness Take a vCPU directly instead of a VM+vcpu pair in all vCPU-scoped helpers and ioctls. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
5241904f |
|
16-Feb-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Convert memop away from VCPU_ID Pass around a 'struct kvm_vcpu' object instead of a vCPU ID in s390's memop test. Pass NULL for the vCPU instead of a magic '-1' ID to indicate that an ioctl/test should be done at VM scope. Rename "struct test_vcpu vcpu" to "struct test_info info" in order to avoid naming collisions (this is the bulk of the diff :-( ). Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
2b38a739 |
|
15-Feb-2022 |
Sean Christopherson <seanjc@google.com> |
KVM: selftests: Add another underscore to inner ioctl() helpers Add a second underscore to inner ioctl() helpers to better align with commonly accepted kernel coding style, and to allow using a single underscore variant in the future for macro shenanigans. Signed-off-by: Sean Christopherson <seanjc@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
97da92c0 |
|
30-May-2022 |
Thomas Huth <thuth@redhat.com> |
KVM: s390: selftests: Use TAP interface in the memop test The memop test currently does not have any output (unless one of the TEST_ASSERT statement fails), so it's hard to say for a user whether a certain new sub-test has been included in the binary or not. Let's make this a little bit more user-friendly and include some TAP output via the kselftests.h interface. Reviewed-by: Janosch Frank <frankja@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com> Link: https://lore.kernel.org/r/20220531101554.36844-2-thuth@redhat.com Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
|
#
c7115964 |
|
12-May-2022 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftest: Test suppression indication on key prot exception Check that suppression is not indicated on injection of a key checked protection exception caused by a memop after it already modified guest memory, as that violates the definition of suppression. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com> Link: https://lore.kernel.org/r/20220512131019.2594948-3-scgl@linux.ibm.com Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
|
#
3bcc372c |
|
08-Mar-2022 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftests: Add error memop tests Test that errors occur if key protection disallows access, including tests for storage and fetch protection override. Perform tests for both logical vcpu and absolute vm ioctls. Also extend the existing tests to the vm ioctl. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Link: https://lore.kernel.org/r/20220308125841.3271721-6-scgl@linux.ibm.com Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
|
#
1bb87349 |
|
08-Mar-2022 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftests: Add more copy memop tests Do not just test the actual copy, but also that success is indicated when using the check only flag. Add copy test with storage key checking enabled, including tests for storage and fetch protection override. These test cover both logical vcpu ioctls as well as absolute vm ioctls. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Link: https://lore.kernel.org/r/20220308125841.3271721-5-scgl@linux.ibm.com Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
|
#
c4816a1b |
|
08-Mar-2022 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftests: Add named stages for memop test The stages synchronize guest and host execution. This helps the reader and constraits the execution of the test -- if the observed staging differs from the expected the test fails. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Link: https://lore.kernel.org/r/20220308125841.3271721-4-scgl@linux.ibm.com Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
|
#
4eb562ab |
|
08-Mar-2022 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftests: Add macro as abstraction for MEM_OP In order to achieve good test coverage we need to be able to invoke the MEM_OP ioctl with all possible parametrizations. However, for a given test, we want to be concise and not specify a long list of default values for parameters not relevant for the test, so the readers attention is not needlessly diverted. Add a macro that enables this and convert the existing test to use it. The macro emulates named arguments and hides some of the ioctl's redundancy, e.g. sets the key flag if an access key is specified. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Link: https://lore.kernel.org/r/20220308125841.3271721-3-scgl@linux.ibm.com Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
|
#
70e2f9f0 |
|
08-Mar-2022 |
Janis Schoetterl-Glausch <scgl@linux.ibm.com> |
KVM: s390: selftests: Split memop tests Split success case/copy test from error test, making them independent. This means they do not share state and are easier to understand. Also, new test can be added in the same manner without affecting the old ones. In order to make that simpler, introduce functionality for the setup of commonly used variables. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Link: https://lore.kernel.org/r/20220308125841.3271721-2-scgl@linux.ibm.com Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
|
#
05515d34 |
|
15-Feb-2022 |
Thomas Huth <thuth@redhat.com> |
selftests: kvm: Check whether SIDA memop fails for normal guests Commit 2c212e1baedc ("KVM: s390: Return error on SIDA memop on normal guest") fixed the behavior of the SIDA memops for normal guests. It would be nice to have a way to test whether the current kernel has the fix applied or not. Thus add a check to the KVM selftests for these two memops. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org> Link: https://lore.kernel.org/r/20220215074824.188440-1-thuth@redhat.com Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
|
#
d0aac332 |
|
10-Mar-2020 |
Andrew Jones <drjones@redhat.com> |
KVM: selftests: Use consistent message for test skipping Signed-off-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
#
be6f55a6 |
|
29-Aug-2019 |
Thomas Huth <thuth@redhat.com> |
KVM: selftests: Add a test for the KVM_S390_MEM_OP ioctl Check that we can write and read the guest memory with this s390x ioctl, and that some error cases are handled correctly. Signed-off-by: Thomas Huth <thuth@redhat.com> Link: https://lkml.kernel.org/r/20190829130732.580-1-thuth@redhat.com Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
|