- Dec 14, 2021
-
-
Alex Bennée authored
These tests are not really aimed at KVM at all but exist to stretch QEMU's TCG code generator. In particular these exercise the ability of the TCG to: * Chain TranslationBlocks together (tight) * Handle heavy usage of the tb_jump_cache (paged) * Pathological case of computed local jumps (computed) In addition the tests can be varied by adding IPI IRQs or SMC sequences into the mix to stress the tcg_exit and invalidation mechanisms. To explicitly stress the tb_flush() mechanism you can use the mod/rounds parameters to force more frequent tb invalidation. Combined with setting -tb-size 1 in QEMU to limit the code generation buffer size. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Message-Id: <20211202115352.951548-10-alex.bennee@linaro.org> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
Alex Bennée authored
This adds a framework for adding simple barrier litmus tests against ARM. The litmus tests aren't as comprehensive as the academic exercises which will attempt to do all sorts of things to keep racing CPUs synced up. These tests do honour the "sync" parameter to do a poor-mans equivalent. The two litmus tests are: - message passing - store-after-load They both have case that should fail (although won't on single-threaded TCG setups). If barriers aren't working properly the store-after-load test will fail even on an x86 backend as x86 allows re-ording of non aliased stores. I've imported a few more of the barrier primatives from the Linux source tree so we consistently use macros. The arm64 barrier primitives trip up on -Wstrict-aliasing so this is disabled in the Makefile. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> CC: Will Deacon <will@kernel.org> Message-Id: <20211202115352.951548-8-alex.bennee@linaro.org> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
Alex Bennée authored
This test has been written mainly to stress multi-threaded TCG behaviour but will demonstrate failure by default on real hardware. The test takes the following parameters: - "lock" use GCC's locking semantics - "atomic" use GCC's __atomic primitives - "wfelock" use WaitForEvent sleep - "excl" use load/store exclusive semantics Also two more options allow the test to be tweaked - "noshuffle" disables the memory shuffling - "count=%ld" set your own per-CPU increment count Note: This patch replaces arm/spinlock-test with arm/locking-test. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> [Added a note about replacing spinlock-test in the commit message.] Message-Id: <20211202115352.951548-7-alex.bennee@linaro.org> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
Alex Bennée authored
This adds a fairly brain dead torture test for TLB flushes intended for stressing the MTTCG QEMU build. It takes the usual -smp option for multiple CPUs. By default it CPU0 will do a TLBIALL flush after each cycle. You can pass options via -append to control additional aspects of the test: - "page" flush each page in turn (one per function) - "self" do the flush after each computation cycle - "verbose" report progress on each computation cycle Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> CC: Mark Rutland <mark.rutland@arm.com> Message-Id: <20211202115352.951548-6-alex.bennee@linaro.org> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
Alex Bennée authored
It's often useful to introduce some sort of random variation when testing several racing CPU conditions. Instead of each test implementing some half-arsed PRNG bring in a a decent one which has good statistical randomness. Obviously it is deterministic for a given seed value which is likely the behaviour you want. I've pulled in the ISAAC library from CCAN: http://ccodearchive.net/info/isaac.html I shaved off the float related stuff which is less useful for unit testing and re-indented to fit the style. The original license was CC0 (Public Domain) which is compatible with the LGPL v2 of kvm-unit-tests. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> CC: Timothy B. Terriberry <tterribe@xiph.org> Acked-by:
Andrew Jones <drjones@redhat.com> Acked-by:
Thomas Huth <thuth@redhat.com> Message-Id: <20211202115352.951548-5-alex.bennee@linaro.org> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
Alex Bennée authored
This will allow TCG tests to alter things such as tb-size. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Message-Id: <20211202115352.951548-9-alex.bennee@linaro.org> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
Alex Bennée authored
It is useful to keep the debug in the .elf file so we can debug and it doesn't get copied across to the final .flat file. Of course we still need to ensure we apply the offset when we load the symbols based on where QEMU decided to load the kernel. (gdb) symbol-file ./builds/arm64/arm/tlbflush-data.elf -o 0x40080000 Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Message-Id: <20211202115352.951548-3-alex.bennee@linaro.org> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
Alex Bennée authored
Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Acked-by:
Andrew Jones <drjones@redhat.com> Message-Id: <20211202115352.951548-2-alex.bennee@linaro.org> Acked-by:
Thomas Huth <thuth@redhat.com> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
Alex Bennée authored
All the errata checking looks at the current host kernel version. For TCG runs this is entirely irrelevant as the host kernel has no impact on the behaviour of the guest. In fact we should set ERRATA_FORCE to ensure we run those tests as QEMU doesn't attempt to model non-confirming architectures. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> [Removed unnecessary eval from the export ERRATA_FORCE line.] Message-Id: <20211112114734.3058678-4-alex.bennee@linaro.org> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
Alex Bennée authored
With the support for TCG emulated GIC we can also test these now. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Reviewed-by:
Eric Auger <eric.auger@redhat.com> Reviewed-by:
Andrew Jones <drjones@redhat.com> Cc: Shashi Mallela <shashi.mallela@linaro.org> Message-Id: <20210525172628.2088-4-alex.bennee@linaro.org> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
Alex Bennée authored
While an IRQ is not "guaranteed to be visible until an appropriate invalidation" it doesn't stop the actual implementation delivering it earlier if it wants to. This is the case for QEMU's TCG and as tests should only be checking architectural compliance this check is invalid. Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Reviewed-by:
Eric Auger <eric.auger@redhat.com> Cc: Shashi Mallela <shashi.mallela@linaro.org> Message-Id: <20210525172628.2088-2-alex.bennee@linaro.org> Signed-off-by:
Andrew Jones <drjones@redhat.com>
-
- Dec 09, 2021
-
-
Thomas Huth authored
s390x: I/O allocation fixes and firq test See merge request kvm-unit-tests/kvm-unit-tests!21
-
- Dec 07, 2021
-
-
We had a KVM BUG fixed by kernel commit a3e03bc1368c ("KVM: s390: index kvm->arch.idle_mask by vcpu_idx"), whereby a floating interrupt might get stuck forever because a CPU in the wait state would not get woken up. The issue can be triggered when CPUs are created in a nonlinear fashion, such that the CPU address ("core-id") and the KVM cpu id don't match. So let's start with a floating interrupt test that will trigger a floating interrupt (via SCLP) to be delivered to a CPU in the wait state. Signed-off-by:
David Hildenbrand <david@redhat.com> Reviewed-by:
Thomas Huth <thuth@redhat.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Message-Id: <20211202123553.96412-3-david@redhat.com> Signed-off-by:
Claudio Imbrenda <imbrenda@linux.ibm.com>
-
Properly return "0" on success so callers can check if the setup was successful. The return value is yet unused, which is why this wasn't noticed so far. Reviewed-by:
Thomas Huth <thuth@redhat.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Janosch Frank <frankja@linux.ibm.com> Signed-off-by:
David Hildenbrand <david@redhat.com> Message-Id: <20211202123553.96412-2-david@redhat.com> Signed-off-by:
Claudio Imbrenda <imbrenda@linux.ibm.com>
-
The allocator allocates pages, so the size must be rounded up to whole pages before the allocation. Fixes: b0fe3988 "s390x: define UV compatible I/O allocation" Signed-off-by:
Pierre Morel <pmorel@linux.ibm.com> Reviewed-by:
Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by:
Janosch Frank <frankja@linux.ibm.com> Message-Id: <20211111100153.86088-1-pmorel@linux.ibm.com> Signed-off-by:
Claudio Imbrenda <imbrenda@linux.ibm.com>
-
- Nov 26, 2021
-
-
Groups are space separated, so we can remove the 'grep -w', which has caused problems in the past with testnames, see b3733048 ("scripts: Fix the check whether testname is in the only_tests list") and use find_word. Signed-off-by:
Andrew Jones <drjones@redhat.com> Message-Id: <20211112133739.103327-3-drjones@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
As specified in the comment blocks at the tops of the unittests.cfg files, multiple groups assigned to 'groups' should be space separated. Currently any nonword character works for the deliminator, but the implementation may change. Stick to the specs. Signed-off-by:
Andrew Jones <drjones@redhat.com> Message-Id: <20211112133739.103327-2-drjones@redhat.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
TCG does not emulate the PMU nor the intricacies of the VMware backdoor I/O port. Disable those tests unless running on KVM. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Add three variants of the #PF interception access test to handle TLB invalidations by relying on VPID rules. Intercept the access test's INVLPG and perform invalidation by: 1. Implicity flush on VM-Enter by disabling VPID 2. Explicitly perform INVVPID on the target address 3. Implicitly "flush" by moving to a new VPID Case #3 exposes a bug where KVM fails to update unsync SPTEs when using shadow paging and L1 changes the VPID it uses for L2, i.e. vmcs12->vpid. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-40-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Add a helper to check for VPID support to deduplicate code, now and in the future. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-39-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Rename ctrl to is_ctrl_valid in several tests. The variables are bools that, *** drum roll ***, track if a control setting is valid. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-38-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Eliminate a now-pointless and horribly name boolean in the EPT test. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-37-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Add a helper to check if a given memtype can be used for EPT structures, and use the helper to clean up the EPT test code. An informational message is lost along the way, but that's not necessarily a bad thing. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-36-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Rename EPT_CAP_WT to EPT_CAP_EXEC_ONLY. In x86, "WT" generally refers to write-through memtype, and is especially confusing considering that EPT capabilities also report UC and WB memtypes. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-35-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Add helpers to check for 4-level and 5-level EPT support. Yet another baby step toward removing unnecessary RDMSRs... Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-34-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Use the existing helper to check for EPT A/D support instead of rereading the capabilities MSR and open-coding the check. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-33-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Deduplicate some clever/interesting code for retrieving the first supported INVVPID type, and opportunistically avoid RDMSR on every test. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-32-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Add a helper to check for basic INVVPID, it will gain more users in the future. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-31-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Add a helper to deduplicate code, now and in the future, and to avoid a RDMSR every time a VPID test wants to do a basic functionality check. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-30-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Yank out the old INVVPID and drop the version info from the new test, which is a complete superset. That, and the old test was apparently trying to win an obfuscated C contest. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-29-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Drop vpid_sync(), it's unused. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-28-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Move the EPT capability helpers to vmx.h, ept_vpid is available and there's no reason to hide the trivial implementations. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-27-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Drop ept_sync(), it's nothing more than a wrapper to invept() with open-coded "assertions" that the desired flavor of INVEPT is supported. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-26-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Assert if INVEPT or INVVPID fails instead of silently ignoring potential problems and hoping they'll show up later. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-25-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Add a version of VMX's TEST_ASSERT that doesn't report. The output of basic assertions is annoying, and other than inflating the number of tests to make KUT look good, there's no value in reporting that KUT is working as intended. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-24-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Move VMX's assert macros to the top of vmx.h so that they can be used in inlined helpers. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-23-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
EPT can technically be supported without INVEPT(SINGLE_CONTEXT), skip the EPT tests if SINGLE_CONTEXT isn't supported as it's heavily used (without the result being checked, yay). Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-22-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
The access test now takes less than 5 seconds when TDP is enabled, and is well under the default 90 second timeout when TDP is disabled. Ditto for VMX's #PF interception variant, which is no longer being penalized by unnecessary CR exits and other general stupidity. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-21-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Drop the now-unused overrides from the PTE insertion helper. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-20-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Drop the overrides from the check_pfec_on_prefetch_pte() test now that pre-allocating page tables will naturally have them use the same PUD and PMD entries. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-19-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-