[kvm-unit-tests GIT PULL] x86: Fixes, cleanups, and new sub-tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx

 
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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux