- Nov 26, 2021
-
-
Andrew Jones authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
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>
-
Sean Christopherson authored
Manually override the PMD in the effective permissions sub-test when splicing two walks together, this will eventually allow dropping the overrides from the main PTE insertion helper. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-18-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Make the PRESENT bit a higher order bit so that it isn't toggled on every iteration, which is a wee bit problematic when trying to expose bugs in KVM's TLB flushing since a fault is architecturally guaranteed to flush TLB entries for the faulting virtual address. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-17-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Preserve A/D bits for paging structure entries to avoid pointless writes to PTEs between test iterations, and more importantly to avoid triggering MMU syncs due to writing upper-level PTEs. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-16-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Avoid spurious PTE writes, KVM doesn't check if old==new when handling write-protected SPTEs and triggers an MMU sync when using shadow paging even if the SPTE is unchanged. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-15-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Pre-allocate the page tables for each test instead of allocating page tables on every. single. iteration. In addition to being abysmally slow, constantly allocating new page tables obliterates any hope of providing meaningful test coverage for shadow paging, as using a new upper level PTE for every iteration causes KVM to sync children, which prevents exposing TLB flushing bugs in KVM. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-14-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Print the index of a PTE in addition to its level. If there's a test bug that causes an unwanted collision, the index is critical information to understanding what has gone wrong. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-13-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Use the upper half of the virtual address space so that 5-level paging doesn't collide with the core infrastucture in the top-level PTE, which hides bugs, e.g. SMEP + 5-level, and is generally a nightmare to debug. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-12-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Rework the walker to clear the USER bit on the test's text region when enabling SMEP. The walk_pte library function assumes 4-level paging (see PAGE_LEVEL), and completely botches 5-level paging. Through sheer dumb luck, the test works with 5-level paging, likely because of an unintentional collision with the test's own PTEs. Punt on the library for the time being as the access test is obviously more than capable of walking page tables, and fixing the library properly will involve poking many more tests. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-11-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Assert that inserting PTEs doesn't encounter an unhandled level instead of silently ignoring the bug and shoving a not-present PTE into the page tables. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-10-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Rename variables in the page table walkers to get rid of the awful root and vroot terminology, which is obsolete/wrong for everything except the top-level entry. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-9-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Move the page table allocator above ac_test_init(), a future commit will handle all page table allocation during init. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-8-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Track the root page table level in the test environment, a future commit will use it to guage whether or not the number of page tables being allocated is reasonable. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-7-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Track the index instead of raw physical address in the page table pool to make the "enough room" check a bit less magical. Opportunistically append "_pa" to pt_pool to clarify that it's the base physical address of the pool. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-6-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Remove SMP "support", the test is not remotely SMP friendly. It can barely survive one CPU modifying page tables, two would be pure carnage. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-5-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Make unnecessarily confusing code less confusing. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-4-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Sean Christopherson authored
Add a shadow for CR3, which avoids a significant number of VM-Exits when KVM is using shadow paging. Signed-off-by:
Sean Christopherson <seanjc@google.com> Message-Id: <20211125012857.508243-3-seanjc@google.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-