All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Subject: [kvm-unit-tests GIT PULL] x86: Fixes, cleanups, and new sub-tests
Date: Mon, 14 Nov 2022 21:03:16 +0000	[thread overview]
Message-ID: <Y3KtFCBIQFHl1uOJ@google.com> (raw)

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

             reply	other threads:[~2022-11-14 21:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 21:03 Sean Christopherson [this message]
2022-11-17 13:52 ` [kvm-unit-tests GIT PULL] x86: Fixes, cleanups, and new sub-tests 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y3KtFCBIQFHl1uOJ@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.