* [kvm-unit-tests GIT PULL] x86: Fixes, cleanups, and new sub-tests
@ 2022-11-14 21:03 Sean Christopherson
2022-11-17 13:52 ` Paolo Bonzini
0 siblings, 1 reply; 6+ messages in thread
From: Sean Christopherson @ 2022-11-14 21:03 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm
Please pull/merge a pile of x86 cleanups and fixes, most of which have been
waiting for review/merge for quite some time. The SEV-ES fix in particular
is semi-urgent as some Google folks spent a few days re-debugging the issue.
The big PMU cleanup is included here even though you had previously said it was
pulled, as there are/were superficial conflicts with the nSVM/nVMX exception
changes. I went with a slightly different resolution for the !PERFCTR_CORE AMD
PMU fix; it seemed more intuitive/correct to switch on PERFCTR_CORE before
querying v2. This is what I ended up with (and actually tested this time):
if (this_cpu_has(X86_FEATURE_PERFCTR_CORE)) {
/* Performance Monitoring Version 2 Supported */
if (this_cpu_has(X86_FEATURE_AMD_PMU_V2)) {
pmu.version = 2;
pmu.nr_gp_counters = cpuid(0x80000022).b & 0xf;
} else {
pmu.nr_gp_counters = AMD64_NUM_COUNTERS_CORE;
}
pmu.msr_gp_counter_base = MSR_F15H_PERF_CTR0;
pmu.msr_gp_event_select_base = MSR_F15H_PERF_CTL0;
} else {
pmu.nr_gp_counters = AMD64_NUM_COUNTERS;
pmu.msr_gp_counter_base = MSR_K7_PERFCTR0;
pmu.msr_gp_event_select_base = MSR_K7_EVNTSEL0;
}
The new "xapic" test will fail without the corresponding KVM fixes[*], but those
fixes are a bit overdue as well.
[*] https://lore.kernel.org/all/20221001005915.2041642-1-seanjc@google.com
The following changes since commit 73d9d850f1c2c9f0df321967e67acda0d2c305ea:
x86/pmu: Disable inlining of measure() (2022-11-02 18:37:16 +0100)
are available in the Git repository at:
https://github.com/kvm-x86/kvm-unit-tests tags/for_paolo
for you to fetch changes up to 952cf19c9143e307fe229af8bf909016a02fcc6c:
x86/pmu: Add AMD Guest PerfMonV2 testcases (2022-11-14 11:00:13 -0800)
----------------------------------------------------------------
x86 fixes, cleanups, and new sub-tests:
- PMU fixes and cleanups
- PMU support for AMD CPUs
- PMU PEBS tests
- APIC logical ID tests
- xAPIC ID aliasing test
- nSVM exception tests (and dedup of nVMX code)
- Bug fix for VMREAD/VMWRITE #PF tests
- MOV/POP SS code #DB test
- Bug fix for SEV-ES guests (#VC before IDT is configured)
----------------------------------------------------------------
Like Xu (22):
x86/pmu: Add PDCM check before accessing PERF_CAP register
x86/pmu: Test emulation instructions on full-width counters
x86/pmu: Pop up FW prefix to avoid out-of-context propagation
x86/pmu: Report SKIP when testing Intel LBR on AMD platforms
x86/pmu: Fix printed messages for emulated instruction test
x86/pmu: Introduce __start_event() to drop all of the manual zeroing
x86/pmu: Introduce multiple_{one, many}() to improve readability
x86/pmu: Reset the expected count of the fixed counter 0 when i386
x86: create pmu group for quick pmu-scope testing
x86/pmu: Refine info to clarify the current support
x86/pmu: Update rdpmc testcase to cover #GP path
x86/pmu: Rename PC_VECTOR to PMI_VECTOR for better readability
x86/pmu: Add lib/x86/pmu.[c.h] and move common code to header files
x86/pmu: Snapshot PMU perf_capabilities during BSP initialization
x86/pmu: Track GP counter and event select base MSRs in pmu_caps
x86/pmu: Add helper to get fixed counter MSR index
x86/pmu: Track global status/control/clear MSRs in pmu_caps
x86: Add tests for Guest Processor Event Based Sampling (PEBS)
x86/pmu: Add global helpers to cover Intel Arch PMU Version 1
x86/pmu: Add gp_events pointer to route different event tables
x86/pmu: Update testcases to cover AMD PMU
x86/pmu: Add AMD Guest PerfMonV2 testcases
Manali Shukla (4):
x86: nSVM: Add an exception test framework and tests
x86: nSVM: Move #BP test to exception test framework
x86: nSVM: Move #OF test to exception test framework
x86: nSVM: Move part of #NM test to exception test framework
Michal Luczaj (1):
x86/emulator: Test code breakpoint with MOV/POP-SS blocking active
Sean Christopherson (27):
x86/emulator: Delete unused declarations (copy-pasted from realmode.c)
x86/emulator: Move basic "MOV" test to its own helper function
x86/emulator: Make chunks of "emulator" test 32-bit friendly
x86/emulator: Convert remaining spaces to tabs (indentation)
x86: Handle all known exceptions with ASM_TRY()
nVMX: Use ASM_TRY() for VMREAD and VMWRITE page fault tests
nVMX: Dedup the bulk of the VMREAD/VMWRITE #PF tests
nVMX: Add "nop" after setting EFLAGS.TF to guarantee single-step #DB
x86: Move helpers to generate misc exceptions to processor.h
nVMX: Move #OF test to generic exceptions test
nVMX: Drop one-off INT3=>#BP test
nVMX: Move #NM test to generic exception test framework
nVMX: Expect #GP on VMXON with "generic" invalid CR0/CR4 bits
x86/apic: Add test config to allow running apic tests against SVM's AVIC
x86/apic: Replaces spaces with tabs to fix indentation in apic.c
x86/apic: Add helpers to query current APIC state, e.g. xAPIC vs. x2APIC
x86/apic: Assert that vCPU0's APIC is enabled at the start of the test
x86/apic: Restore APIC to original state after every sub-test
x86/apic: Enable IRQs on vCPU0 for all tests
x86/apic: Run tests that modify APIC ID and/or APIC_BASE after other tests
x86/apic: Add test for logical mode IPI delivery (cluster and flat)
x86/apic: Add test to verify aliased xAPIC IDs both receive IPI
x86: Add a helper for the BSP's final init sequence common to all flavors
x86/pmu: Snapshot CPUID.0xA PMU capabilities during BSP initialization
x86/pmu: Drop wrappers that just passthrough pmu_caps fields
x86/pmu: Reset GP and Fixed counters during pmu_init().
x86/pmu: Add pmu_caps flag to track if CPU is Intel (versus AMD)
Vasant Karasulli (1):
x86: efi: set up the IDT before accessing MSRs.
lib/x86/asm/setup.h | 1 +
lib/x86/desc.c | 10 +-
lib/x86/msr.h | 30 +++++
lib/x86/pmu.c | 69 +++++++++++
lib/x86/pmu.h | 187 +++++++++++++++++++++++++++++
lib/x86/processor.h | 120 ++++++++++++++-----
lib/x86/setup.c | 33 ++++--
x86/Makefile.common | 2 +
x86/Makefile.x86_64 | 3 +-
x86/apic.c | 940 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------------------
x86/cstart.S | 4 +-
x86/cstart64.S | 4 +-
x86/emulator.c | 921 +++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------
x86/emulator64.c | 464 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
x86/pmu.c | 360 ++++++++++++++++++++++++++++++++------------------------
x86/pmu_lbr.c | 24 +---
x86/pmu_pebs.c | 433 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
x86/svm_tests.c | 195 ++++++++++++++----------------
x86/unittests.cfg | 26 +++-
x86/vmx.c | 178 ++++++++++------------------
x86/vmx_tests.c | 215 +++++----------------------------
21 files changed, 2592 insertions(+), 1627 deletions(-)
create mode 100644 lib/x86/pmu.c
create mode 100644 lib/x86/pmu.h
create mode 100644 x86/emulator64.c
create mode 100644 x86/pmu_pebs.c
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [kvm-unit-tests GIT PULL] x86: Fixes, cleanups, and new sub-tests
2022-11-14 21:03 [kvm-unit-tests GIT PULL] x86: Fixes, cleanups, and new sub-tests Sean Christopherson
@ 2022-11-17 13:52 ` Paolo Bonzini
0 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2022-11-17 13:52 UTC (permalink / raw)
To: Sean Christopherson; +Cc: kvm
On 11/14/22 22:03, Sean Christopherson wrote:
> https://github.com/kvm-x86/kvm-unit-tests tags/for_paolo
Pulled, thanks (I checked the conflict resolution and the different AMD
fixup and they're fine indeed).
Paolo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [kvm-unit-tests GIT PULL] x86: Fixes, cleanups, and new sub-tests
2022-07-25 16:56 ` Sean Christopherson
@ 2022-07-25 20:35 ` Sean Christopherson
0 siblings, 0 replies; 6+ messages in thread
From: Sean Christopherson @ 2022-07-25 20:35 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, Yang Weijiang, Manali Shukla, Jim Mattson
On Mon, Jul 25, 2022, Sean Christopherson wrote:
> On Sat, Jul 23, 2022, Sean Christopherson wrote:
> > On Thu, Jul 21, 2022, Sean Christopherson wrote:
> > > Please pull/merge a pile of x86 cleanups and fixes, most of which have been
> > > waiting for review/merge for quite some time. The only non-trivial changes that
> > > haven't been posted are the massaged version of the PMU cleanup patches.
> > >
> > > Note, the very last commit will fail spectacularly on kvm/queue due to a KVM
> > > bug: https://lore.kernel.org/all/20220607213604.3346000-4-seanjc@google.com.
> > >
> > > Other than that, tested on Intel and AMD, both 64-bit and 32-bit.
> >
> > Argh, don't pull this.
> >
> > Commit b89a09f ("x86: Provide a common 64-bit AP entrypoint for EFI and non-EFI")
> > broke the SVM tests on Rome. I'll look into it next week and spin a new version.
>
> The APIC needs to be "reset" to put it back into xAPIC, otherwise pre_boot_apic_id()
> will return garbage when `svm_init_startup_test` is run and x2APIC is supported.
And of course that breaks EFI. Posted a small series to play nice with x2APIC and
provide a segue into the UEFI changes.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [kvm-unit-tests GIT PULL] x86: Fixes, cleanups, and new sub-tests
2022-07-23 1:14 ` Sean Christopherson
@ 2022-07-25 16:56 ` Sean Christopherson
2022-07-25 20:35 ` Sean Christopherson
0 siblings, 1 reply; 6+ messages in thread
From: Sean Christopherson @ 2022-07-25 16:56 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, Yang Weijiang, Manali Shukla, Jim Mattson
On Sat, Jul 23, 2022, Sean Christopherson wrote:
> On Thu, Jul 21, 2022, Sean Christopherson wrote:
> > Please pull/merge a pile of x86 cleanups and fixes, most of which have been
> > waiting for review/merge for quite some time. The only non-trivial changes that
> > haven't been posted are the massaged version of the PMU cleanup patches.
> >
> > Note, the very last commit will fail spectacularly on kvm/queue due to a KVM
> > bug: https://lore.kernel.org/all/20220607213604.3346000-4-seanjc@google.com.
> >
> > Other than that, tested on Intel and AMD, both 64-bit and 32-bit.
>
> Argh, don't pull this.
>
> Commit b89a09f ("x86: Provide a common 64-bit AP entrypoint for EFI and non-EFI")
> broke the SVM tests on Rome. I'll look into it next week and spin a new version.
The APIC needs to be "reset" to put it back into xAPIC, otherwise pre_boot_apic_id()
will return garbage when `svm_init_startup_test` is run and x2APIC is supported.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [kvm-unit-tests GIT PULL] x86: Fixes, cleanups, and new sub-tests
2022-07-21 21:13 Sean Christopherson
@ 2022-07-23 1:14 ` Sean Christopherson
2022-07-25 16:56 ` Sean Christopherson
0 siblings, 1 reply; 6+ messages in thread
From: Sean Christopherson @ 2022-07-23 1:14 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, Yang Weijiang, Manali Shukla, Jim Mattson
On Thu, Jul 21, 2022, Sean Christopherson wrote:
> Please pull/merge a pile of x86 cleanups and fixes, most of which have been
> waiting for review/merge for quite some time. The only non-trivial changes that
> haven't been posted are the massaged version of the PMU cleanup patches.
>
> Note, the very last commit will fail spectacularly on kvm/queue due to a KVM
> bug: https://lore.kernel.org/all/20220607213604.3346000-4-seanjc@google.com.
>
> Other than that, tested on Intel and AMD, both 64-bit and 32-bit.
Argh, don't pull this.
Commit b89a09f ("x86: Provide a common 64-bit AP entrypoint for EFI and non-EFI")
broke the SVM tests on Rome. I'll look into it next week and spin a new version.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [kvm-unit-tests GIT PULL] x86: Fixes, cleanups, and new sub-tests
@ 2022-07-21 21:13 Sean Christopherson
2022-07-23 1:14 ` Sean Christopherson
0 siblings, 1 reply; 6+ messages in thread
From: Sean Christopherson @ 2022-07-21 21:13 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, Yang Weijiang, Manali Shukla, Jim Mattson
Please pull/merge a pile of x86 cleanups and fixes, most of which have been
waiting for review/merge for quite some time. The only non-trivial changes that
haven't been posted are the massaged version of the PMU cleanup patches.
Note, the very last commit will fail spectacularly on kvm/queue due to a KVM
bug: https://lore.kernel.org/all/20220607213604.3346000-4-seanjc@google.com.
Other than that, tested on Intel and AMD, both 64-bit and 32-bit.
Thanks!
The following changes since commit 7b2e41767bb8caf91972ee32e4ca85ec630584e2:
Merge branch 's390x-next-2022-07' into 'master' (2022-07-21 14:41:56 +0000)
are available in the Git repository at:
https://github.com/sean-jc/kvm-unit-tests.git tags/for_paolo
for you to fetch changes up to ff081d8ad4a4e53a9d129cde1bc9f249d65cdf32:
nVMX: Add subtest to verify VMXON succeeds/#UDs on good/bad CR0/CR4 (2022-07-21 13:33:16 -0700)
----------------------------------------------------------------
x86 fixes, cleanups, and new sub-tests:
- Bug fix for the VMX-preemption timer expiration test
- Refactor SVM tests to split out NPT tests
- Add tests for MCE banks to MSR test
- Add SMP Support for x86 UEFI tests
- x86: nVMX: Add VMXON #UD test (and exception cleanup)
- PMU cleanup and related nVMX bug fixes
----------------------------------------------------------------
Jim Mattson (1):
x86: VMX: Fix the VMX-preemption timer expiration test
Manali Shukla (5):
x86: nSVM: Extract core functionality of main() to helper run_svm_tests()
x86: Add flags to control behavior of set_mmu_range()
x86: nSVM: Build up the nested page table dynamically
x86: nSVM: Correct indentation for svm.c
x86: nSVM: Correct indentation for svm_tests.c
Sean Christopherson (21):
x86: nSVM: Move all nNPT test cases from svm_tests.c to a separate file.
x86: nSVM: Run non-NPT nSVM tests with PT_USER_MASK enabled
x86: nSVM: Add macros to create SVM's NPT tests, reduce boilerplate code
x86: msr: Take the MSR index and name separately in low level helpers
x86: msr: Add tests for MCE bank MSRs
x86: Use an explicit magic string to detect that dummy.efi passes
x86: Rename ap_init() to bringup_aps()
x86: Add ap_online() to consolidate final "AP is alive!" code
x86: Use BIT() to define architectural bits
x86: Replace spaces with tables in processor.h
x86: Use "safe" terminology instead of "checking"
x86: Use "safe" helpers to implement unsafe CRs accessors
x86: Provide result of RDMSR from "safe" variant
nVMX: Check the results of VMXON/VMXOFF in feature control test
nVMX: Check result of VMXON in INIT/SIPI tests
nVMX: Wrap VMXON in ASM_TRY(), a.k.a. in exception fixup
nVMX: Simplify test_vmxon() by returning directly on failure
x86: Drop cpuid_osxsave(), just use this_cpu_has(X86_FEATURE_OSXSAVE)
nVMX: Move wrappers of this_cpu_has() to nVMX's VM-Exit test
nVMX: Rename monitor_support() to this_cpu_has_mwait(), drop #define
nVMX: Add subtest to verify VMXON succeeds/#UDs on good/bad CR0/CR4
Varad Gautam (10):
x86: Share realmode trampoline between i386 and x86_64
x86: Move ap_init() to smp.c
x86: Move load_idt() to desc.c
x86: desc: Split IDT entry setup into a generic helper
x86: Move load_gdt_tss() to desc.c
x86: efi: Provide a stack within testcase memory
x86: efi: Provide percpu storage
x86: Move 32-bit => 64-bit transition code to trampolines.S
x86: efi, smp: Transition APs from 16-bit to 32-bit mode
x86: Provide a common 64-bit AP entrypoint for EFI and non-EFI
Yang Weijiang (4):
x86: nVMX: Use report_skip() to print messages when VMX tests are skipped
x86: Use helpers to fetch supported perf capabilities
x86: Skip perf related tests when platform cannot support
x86: Check platform pmu capabilities before run lbr tests
lib/alloc_page.h | 3 +
lib/x86/apic.c | 2 -
lib/x86/asm/setup.h | 3 +
lib/x86/desc.c | 46 +-
lib/x86/desc.h | 5 +-
lib/x86/processor.h | 455 +++++++++++--------
lib/x86/setup.c | 82 +++-
lib/x86/smp.c | 150 ++++++-
lib/x86/smp.h | 11 +
lib/x86/vm.c | 22 +-
lib/x86/vm.h | 10 +
scripts/runtime.bash | 2 +-
x86/Makefile.common | 2 +
x86/Makefile.x86_64 | 2 +
x86/access.c | 8 +-
x86/cstart.S | 48 +-
x86/cstart64.S | 125 +-----
x86/dummy.c | 8 +
x86/efi/crt0-efi-x86_64.S | 3 +
x86/efi/efistart64.S | 79 ++--
x86/la57.c | 2 +-
x86/msr.c | 113 ++++-
x86/pcid.c | 28 +-
x86/pmu.c | 116 ++---
x86/pmu_lbr.c | 35 +-
x86/rdpru.c | 4 +-
x86/svm.c | 219 ++++-----
x86/svm.h | 5 +-
x86/svm_npt.c | 380 ++++++++++++++++
x86/svm_tests.c | 3365 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------
x86/trampolines.S | 129 ++++++
x86/unittests.cfg | 6 +
x86/vmexit.c | 12 +-
x86/vmx.c | 141 ++++--
x86/vmx.h | 31 +-
x86/vmx_tests.c | 136 +++---
x86/xsave.c | 31 +-
37 files changed, 3161 insertions(+), 2658 deletions(-)
create mode 100644 x86/svm_npt.c
create mode 100644 x86/trampolines.S
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-11-17 13:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 21:03 [kvm-unit-tests GIT PULL] x86: Fixes, cleanups, and new sub-tests Sean Christopherson
2022-11-17 13:52 ` Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
2022-07-21 21:13 Sean Christopherson
2022-07-23 1:14 ` Sean Christopherson
2022-07-25 16:56 ` Sean Christopherson
2022-07-25 20:35 ` Sean Christopherson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.