x86: Fixes, cleanups and new testscases
Sean Christopherson
reviewerPlease pull a variety of (mostly) x86 changes. There's one non-x86 change to fix a bug in processing "check" entries in unittests.cfg files. The majority of the x86 changes revolve around nSVM, PMU, and emulator tests.
The following changes since commit 02d8befe99f8205d4caea402d8b0800354255681:
pretty_print_stacks: modify relative path calculation (2023-04-20 10:26:06 +0200)
are available in the Git repository at:
https://github.com/kvm-x86/kvm-unit-tests.git tags/kvm-x86-2023.06.22
for you to fetch changes up to e3a9b2f5490e854dfcccdde4bcc712fe928b02b4:
x86/emulator64: Test non-canonical memory access exceptions (2023-06-12 11:06:19 -0700)
----------------------------------------------------------------
x86 fixes, cleanups, and new testcases, and a few generic changes
- Fix a bug in runtime.bash that caused it to mishandle "check" strings with multiple entries, e.g. a test that depends on multiple module params
- Make the PMU tests depend on vPMU support being enabled in KVM
- Fix PMU's forced emulation test on CPUs with full-width writes
- Add a PMU testcase for measuring TSX transactional cycles
- Nested SVM testcase for virtual NMIs
- Fix linker warnings about an executable stack
- Move a pile of code to ASM_TRY() and "safe" helpers
- Set up the guest stack in the LBRV tests so that the tests don't fail if the compiler decides to generate function calls in guest code
- Ignore the "mispredict" flag in nSVM's LBRV tests to fix false failures
- Clean up usage of helpers that disable interrupts, e.g. stop inserting unnecessary nops
- Add helpers to dedup code for programming the APIC timer
----------------------------------------------------------------
Like Xu (2):
x86/pmu: Add Intel Guest Transactional (commited) cycles testcase x86/pmu: Wrap the written counter value with gp_counter_width
Mathias Krause (15):
x86: Drop types.h
x86: Use symbolic names in exception_mnemonic()
x86: Add vendor specific exception vectors x86/cet: Use symbolic name for #CP
x86/access: Use 'bool' type as defined via libcflat.h x86/run_in_user: Preserve exception handler x86/run_in_user: Relax register constraints of inline asm x86/run_in_user: Reload SS after successful return x86/fault_test: Preserve exception handler x86/emulator64: Relax register constraints for usr_gs_mov() x86/emulator64: Switch test_sreg() to ASM_TRY() x86/emulator64: Add non-null selector test x86/emulator64: Switch test_jmp_noncanonical() to ASM_TRY() x86/emulator64: Switch test_mmx_movq_mf() to ASM_TRY() x86/emulator64: Test non-canonical memory access exceptions
Maxim Levitsky (8):
x86: replace irq_{enable|disable}() with sti()/cli()
x86: introduce sti_nop() and sti_nop_cli()
x86: add few helper functions for apic local timer
x86: nSVM: Remove nop after stgi/clgi
x86: nSVM: make svm_intr_intercept_mix_if/gif test a bit more robust
x86: nSVM: use apic_start_timer/apic_stop_timer instead of open coding it
x86: nSVM: Add nested shutdown interception test
x86: nSVM: Remove defunct get_npt_pte() declaration
Santosh Shukla (1):
x86: nSVM: Add support for VNMI test
Sean Christopherson (15):
nSVM: Add helper to report fatal errors in guest
x86: Link with "-z noexecstack" to suppress irrelevant linker warnings
x86: Add macros to wrap ASM_TRY() for single instructions
x86: Convert inputs-only "safe" instruction helpers to asm_safe()
x86: Add macros to wrap ASM_TRY() for single instructions with output(s)
x86: Move invpcid_safe() to processor.h and convert to asm_safe()
x86: Move XSETBV and XGETBV "safe" helpers to processor.h
x86: nSVM: Set up a guest stack in LBRV tests
lib: Expose a subset of VMX's assertion macros
x86: Add defines for the various LBR record bit definitions
x86: nSVM: Ignore mispredict bit in LBR records
x86: nSVM: Replace check_dbgctl() with TEST_EXPECT_EQ() in LBRV test
x86: nSVM: Print out RIP and LBRs from VMCB if LBRV guest test fails
runtime: Convert "check" from string to array so that iterating works x86/pmu: Make PMU testcases dependent on vPMU being enabled in KVM
lib/util.h | 31 ++++ lib/x86/apic.c | 38 ++++ lib/x86/apic.h | 6 + lib/x86/desc.c | 43 +++-- lib/x86/desc.h | 48 ++++++ lib/x86/fault_test.c | 4 +- lib/x86/msr.h | 11 ++ lib/x86/processor.h | 137 +++++++++------ lib/x86/smp.c | 2 +- lib/x86/usermode.c | 38 ++-- scripts/runtime.bash | 1 + x86/Makefile.common | 2 +- x86/access.c | 11 +- x86/apic.c | 6 +- x86/asyncpf.c | 6 +- x86/cet.c | 2 +- x86/cmpxchg8b.c | 1 - x86/emulator.c | 1 - x86/emulator64.c | 105 +++++++----- x86/eventinj.c | 22 +-- x86/hyperv_connections.c | 2 +- x86/hyperv_stimer.c | 4 +- x86/hyperv_synic.c | 6 +- x86/intel-iommu.c | 2 +- x86/ioapic.c | 15 +- x86/memory.c | 60 ++----- x86/pcid.c | 8 - x86/pmu.c | 52 +++++- x86/pmu_pebs.c | 1 - x86/svm.c | 17 +- x86/svm.h | 11 +- x86/svm_tests.c | 429 +++++++++++++++++++++++----------------------- x86/taskswitch2.c | 4 +- x86/tscdeadline_latency.c | 4 +- x86/types.h | 21 --- x86/unittests.cfg | 7 +- x86/vmexit.c | 18 +- x86/vmx.h | 32 +--- x86/vmx_tests.c | 48 ++---- x86/xsave.c | 31 +--- 40 files changed, 709 insertions(+), 578 deletions(-) delete mode 100644 x86/types.h
Quoted 10 lines · Sean Christopherson
Please pull a variety of (mostly) x86 changes. There's one non-x86 change to fix a bug in processing "check" entries in unittests.cfg files. The majority of the x86 changes revolve around nSVM, PMU, and emulator tests.
The following changes since commit
02d8befe99f8205d4caea402d8b0800354255681:
pretty_print_stacks: modify relative path calculation (2023-04-20 10:26:06 +0200)are available in the Git repository at:
Quoted 8 lines
https://github.com/kvm-x86/kvm-unit-tests.git tags/kvm-x86-2023.06.22
for you to fetch changes up to
e3a9b2f5490e854dfcccdde4bcc712fe928b02b4:x86/emulator64: Test non-canonical memory access exceptions (2023-06-12 11:06:19 -0700)
----------------------------------------------------------------
[...]
Ping! What happened to this one? Doesn't seem to be merged for over a month now.
Thanks,
Mathias
Sean Christopherson
reviewerQuoted 13 lines · Mathias Krause
Quoted 12 lines · Sean Christopherson
Please pull a variety of (mostly) x86 changes. There's one non-x86 change to fix a bug in processing "check" entries in unittests.cfg files. The majority of the x86 changes revolve around nSVM, PMU, and emulator tests.
The following changes since commit
02d8befe99f8205d4caea402d8b0800354255681:
pretty_print_stacks: modify relative path calculation (2023-04-20 10:26:06 +0200)are available in the Git repository at:
https://github.com/kvm-x86/kvm-unit-tests.git tags/kvm-x86-2023.06.22
Quoted 8 lines
Quoted 6 lines
for you to fetch changes up to
e3a9b2f5490e854dfcccdde4bcc712fe928b02b4:x86/emulator64: Test non-canonical memory access exceptions (2023-06-12 11:06:19 -0700)
----------------------------------------------------------------
[...]Ping! What happened to this one?
Got ignored for so long that it became stale[*] :-/
I'll work on generating a new pull request this week.
Quoted 16 lines · Sean Christopherson
Quoted 15 lines · Mathias Krause
Quoted 14 lines · Sean Christopherson
Please pull a variety of (mostly) x86 changes. There's one non-x86 change to fix a bug in processing "check" entries in unittests.cfg files. The majority of the x86 changes revolve around nSVM, PMU, and emulator tests.
The following changes since commit
02d8befe99f8205d4caea402d8b0800354255681:
pretty_print_stacks: modify relative path calculation (2023-04-20 10:26:06 +0200)are available in the Git repository at:
https://github.com/kvm-x86/kvm-unit-tests.git tags/kvm-x86-2023.06.22
for you to fetch changes up to
e3a9b2f5490e854dfcccdde4bcc712fe928b02b4:
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
x86/emulator64: Test non-canonical memory access exceptions (2023-06-12 11:06:19 -0700)
----------------------------------------------------------------
[...]Ping! What happened to this one?
Got ignored for so long that it became stale[*] :-/
:(
Quoted 3 lines
I'll work on generating a new pull request this week.
Looks like, all that's needed is to drop commit 5f15933dccae ("x86: Link with "-z noexecstack" to suppress irrelevant linker warnings"), as it was handled more generic in 63707aafb908 ("Link with "-z noexecstack" to avoid warning from newer versions of ld").
Thanks,
Mathias