linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] KVM: x86 pull requests for 6.6
@ 2023-08-30  0:06 Sean Christopherson
  2023-08-30  0:06 ` [GIT PULL] KVM: Non-x86 changes " Sean Christopherson
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: Sean Christopherson @ 2023-08-30  0:06 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson

Adding a cover letter of sorts this time around to try and make your life a bit
easier.  You should see a total of 7 pull requests:

  [GIT PULL] KVM: Non-x86 changes for 6.6
  [GIT PULL] KVM: x86: Misc changes for 6.6
  [GIT PULL] KVM: x86: MMU changes for 6.6
  [GIT PULL] KVM: x86: PMU changes for 6.6
  [GIT PULL] KVM: x86: Selftests changes for 6.6
  [GIT PULL] KVM: x86: SVM changes for 6.6
  [GIT PULL] KVM: x86: VMX changes for 6.6

There is a trivial conflict between "Non-x86" and "MMU", and a less trivial one
between "Misc" and "SVM".  FWIW, I recommend pulling "Misc" after "SVM", I found
the conflict that's generated by merging "Misc" before "SVM" to be terribly
confusing.  Details in the "Non-x86" and "Misc" requests respectively.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [GIT PULL] KVM: Non-x86 changes for 6.6
  2023-08-30  0:06 [GIT PULL] KVM: x86 pull requests for 6.6 Sean Christopherson
@ 2023-08-30  0:06 ` Sean Christopherson
  2023-08-31 17:20   ` Paolo Bonzini
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: Misc " Sean Christopherson
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Sean Christopherson @ 2023-08-30  0:06 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson

Please pull a few smallish KVM-wide changes.  This will conflict with the MMU
pull request, which changed a WARN_ON() to a WARN_ON_ONCE().  The resolution
is pretty straightfoward.

diff --cc arch/x86/kvm/mmu/tdp_mmu.c
index 6250bd3d20c1,b5629bc60e36..6c63f2d1675f
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@@ -1241,7 -1241,7 +1241,7 @@@ static bool set_spte_gfn(struct kvm *kv
        u64 new_spte;
  
        /* Huge pages aren't expected to be modified without first being zapped. */
-       WARN_ON(pte_huge(range->arg.pte) || range->start + 1 != range->end);
 -      WARN_ON_ONCE(pte_huge(range->pte) || range->start + 1 != range->end);
++      WARN_ON_ONCE(pte_huge(range->arg.pte) || range->start + 1 != range->end);
  
        if (iter->level != PG_LEVEL_4K ||
            !is_shadow_present_pte(iter->old_spte))

The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:

  Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)

are available in the Git repository at:

  https://github.com/kvm-x86/linux.git tags/kvm-x86-generic-6.6

for you to fetch changes up to 458933d33af2cb3663bd8c0080c1efd1f9483db4:

  KVM: Remove unused kvm_make_cpus_request_mask() declaration (2023-08-17 11:59:43 -0700)

----------------------------------------------------------------
Common KVM changes for 6.6:

 - Wrap kvm_{gfn,hva}_range.pte in a union to allow mmu_notifier events to pass
   action specific data without needing to constantly update the main handlers.

 - Drop unused function declarations

----------------------------------------------------------------
Sean Christopherson (1):
      KVM: Wrap kvm_{gfn,hva}_range.pte in a per-action union

Yue Haibing (2):
      KVM: Remove unused kvm_device_{get,put}() declarations
      KVM: Remove unused kvm_make_cpus_request_mask() declaration

 arch/arm64/kvm/mmu.c       |  2 +-
 arch/mips/kvm/mmu.c        |  2 +-
 arch/riscv/kvm/mmu.c       |  2 +-
 arch/x86/kvm/mmu/mmu.c     |  2 +-
 arch/x86/kvm/mmu/tdp_mmu.c |  6 +++---
 include/linux/kvm_host.h   | 10 +++++-----
 virt/kvm/kvm_main.c        | 19 ++++++++++---------
 7 files changed, 22 insertions(+), 21 deletions(-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [GIT PULL] KVM: x86: Misc changes for 6.6
  2023-08-30  0:06 [GIT PULL] KVM: x86 pull requests for 6.6 Sean Christopherson
  2023-08-30  0:06 ` [GIT PULL] KVM: Non-x86 changes " Sean Christopherson
@ 2023-08-30  0:06 ` Sean Christopherson
  2023-08-31 17:39   ` Paolo Bonzini
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Sean Christopherson @ 2023-08-30  0:06 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson

Please pull common/misc x86 changes.  The two highlights are overhauling the
emergency reboot code and adding a framework to allow querying if the guest can
use a feature via guest_can_use(vcpu, X86_FEATURE_*) without having to search
through guest CPUID at runtime.

The guest_can_use() changes conflict with LBR virtualization cleanups from the
SVM pull request.  Below is the resolution I've been using.  FWIW, I've been
merging this "misc" branch last in all of my merges to kvm-x86/next, trying to
merge "svm" after "misc" yields a truly ugly conflict (IMO).

diff --cc arch/x86/kvm/svm/svm.c
index 5cf2380c89dd,226b3a780d0f..b21253c9ceb4
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@@ -1004,10 -1017,16 +1040,10 @@@ static struct vmcb *svm_get_lbr_vmcb(st
  void svm_update_lbrv(struct kvm_vcpu *vcpu)
  {
        struct vcpu_svm *svm = to_svm(vcpu);
 -
 -      bool enable_lbrv = svm_get_lbr_msr(svm, MSR_IA32_DEBUGCTLMSR) &
 -                                         DEBUGCTLMSR_LBR;
 -
 -      bool current_enable_lbrv = !!(svm->vmcb->control.virt_ext &
 -                                    LBR_CTL_ENABLE_MASK);
 -
 -      if (unlikely(is_guest_mode(vcpu) && guest_can_use(vcpu, X86_FEATURE_LBRV)))
 -              if (unlikely(svm->nested.ctl.virt_ext & LBR_CTL_ENABLE_MASK))
 -                      enable_lbrv = true;
 +      bool current_enable_lbrv = svm->vmcb->control.virt_ext & LBR_CTL_ENABLE_MASK;
 +      bool enable_lbrv = (svm_get_lbr_vmcb(svm)->save.dbgctl & DEBUGCTLMSR_LBR) ||
-                          (is_guest_mode(vcpu) && svm->lbrv_enabled &&
++                         (is_guest_mode(vcpu) && guest_can_use(vcpu, X86_FEATURE_LBRV) &&
 +                          (svm->nested.ctl.virt_ext & LBR_CTL_ENABLE_MASK));
  
        if (enable_lbrv == current_enable_lbrv)
                return;


The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:

  Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)

are available in the Git repository at:

  https://github.com/kvm-x86/linux.git tags/kvm-x86-misc-6.6

for you to fetch changes up to 9717efbe5ba3f52d4b3cc637c7f7f6149ea264bb:

  KVM: x86: Disallow guest CPUID lookups when IRQs are disabled (2023-08-17 11:43:32 -0700)

----------------------------------------------------------------
KVM x86 changes for 6.6:

 - Misc cleanups

 - Retry APIC optimized recalculation if a vCPU is added/enabled

 - Overhaul emergency reboot code to bring SVM up to par with VMX, tie the
   "emergency disabling" behavior to KVM actually being loaded, and move all of
   the logic within KVM

 - Fix user triggerable WARNs in SVM where KVM incorrectly assumes the TSC
   ratio MSR can diverge from the default iff TSC scaling is enabled, and clean
   up related code

 - Add a framework to allow "caching" feature flags so that KVM can check if
   the guest can use a feature without needing to search guest CPUID

----------------------------------------------------------------
Li zeming (1):
      x86: kvm: x86: Remove unnecessary initial values of variables

Like Xu (2):
      KVM: x86: Use sysfs_emit() instead of sprintf()
      KVM: x86: Remove break statements that will never be executed

Michal Luczaj (1):
      KVM: x86: Remove x86_emulate_ops::guest_has_long_mode

Sean Christopherson (44):
      KVM: x86: Snapshot host's MSR_IA32_ARCH_CAPABILITIES
      KVM: VMX: Drop unnecessary vmx_fb_clear_ctrl_available "cache"
      KVM: x86: Retry APIC optimized map recalc if vCPU is added/enabled
      x86/reboot: VMCLEAR active VMCSes before emergency reboot
      x86/reboot: Harden virtualization hooks for emergency reboot
      x86/reboot: KVM: Handle VMXOFF in KVM's reboot callback
      x86/reboot: KVM: Disable SVM during reboot via virt/KVM reboot callback
      x86/reboot: Assert that IRQs are disabled when turning off virtualization
      x86/reboot: Hoist "disable virt" helpers above "emergency reboot" path
      x86/reboot: Disable virtualization during reboot iff callback is registered
      x86/reboot: Expose VMCS crash hooks if and only if KVM_{INTEL,AMD} is enabled
      x86/virt: KVM: Open code cpu_has_vmx() in KVM VMX
      x86/virt: KVM: Move VMXOFF helpers into KVM VMX
      KVM: SVM: Make KVM_AMD depend on CPU_SUP_AMD or CPU_SUP_HYGON
      x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm()
      x86/virt: KVM: Open code cpu_has_svm() into kvm_is_svm_supported()
      KVM: SVM: Check that the current CPU supports SVM in kvm_is_svm_supported()
      KVM: VMX: Ensure CPU is stable when probing basic VMX support
      x86/virt: KVM: Move "disable SVM" helper into KVM SVM
      KVM: x86: Force kvm_rebooting=true during emergency reboot/crash
      KVM: SVM: Use "standard" stgi() helper when disabling SVM
      KVM: VMX: Skip VMCLEAR logic during emergency reboots if CR4.VMXE=0
      KVM: nSVM: Check instead of asserting on nested TSC scaling support
      KVM: nSVM: Load L1's TSC multiplier based on L1 state, not L2 state
      KVM: nSVM: Use the "outer" helper for writing multiplier to MSR_AMD64_TSC_RATIO
      KVM: SVM: Clean up preemption toggling related to MSR_AMD64_TSC_RATIO
      KVM: x86: Always write vCPU's current TSC offset/ratio in vendor hooks
      KVM: nSVM: Skip writes to MSR_AMD64_TSC_RATIO if guest state isn't loaded
      KVM: x86: Remove WARN sanity check on hypervisor timer vs. UNINITIALIZED vCPU
      KVM: x86: Add a framework for enabling KVM-governed x86 features
      KVM: x86/mmu: Use KVM-governed feature framework to track "GBPAGES enabled"
      KVM: VMX: Recompute "XSAVES enabled" only after CPUID update
      KVM: VMX: Check KVM CPU caps, not just VMX MSR support, for XSAVE enabling
      KVM: VMX: Rename XSAVES control to follow KVM's preferred "ENABLE_XYZ"
      KVM: x86: Use KVM-governed feature framework to track "XSAVES enabled"
      KVM: nVMX: Use KVM-governed feature framework to track "nested VMX enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "NRIPS enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "TSC scaling enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "vVM{SAVE,LOAD} enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "LBRv enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "Pause Filter enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "vGIF enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "vNMI enabled"
      KVM: x86: Disallow guest CPUID lookups when IRQs are disabled

Takahiro Itazuri (1):
      KVM: x86: Advertise host CPUID 0x80000005 in KVM_GET_SUPPORTED_CPUID

Tao Su (1):
      KVM: x86: Advertise AMX-COMPLEX CPUID to userspace

 arch/x86/include/asm/kexec.h     |   2 -
 arch/x86/include/asm/kvm_host.h  |  24 ++++-
 arch/x86/include/asm/reboot.h    |   7 ++
 arch/x86/include/asm/virtext.h   | 154 -------------------------------
 arch/x86/include/asm/vmx.h       |   2 +-
 arch/x86/kernel/crash.c          |  31 -------
 arch/x86/kernel/reboot.c         |  66 ++++++++++----
 arch/x86/kvm/Kconfig             |   2 +-
 arch/x86/kvm/cpuid.c             |  40 ++++++++-
 arch/x86/kvm/cpuid.h             |  46 ++++++++++
 arch/x86/kvm/emulate.c           |   2 -
 arch/x86/kvm/governed_features.h |  21 +++++
 arch/x86/kvm/hyperv.c            |   1 -
 arch/x86/kvm/kvm_emulate.h       |   1 -
 arch/x86/kvm/lapic.c             |  29 +++++-
 arch/x86/kvm/mmu/mmu.c           |  22 +----
 arch/x86/kvm/reverse_cpuid.h     |   1 +
 arch/x86/kvm/svm/nested.c        |  57 +++++++-----
 arch/x86/kvm/svm/svm.c           | 150 +++++++++++++++++++++----------
 arch/x86/kvm/svm/svm.h           |  18 ++--
 arch/x86/kvm/vmx/capabilities.h  |   2 +-
 arch/x86/kvm/vmx/hyperv.c        |   2 +-
 arch/x86/kvm/vmx/nested.c        |  13 +--
 arch/x86/kvm/vmx/nested.h        |   2 +-
 arch/x86/kvm/vmx/vmx.c           | 190 ++++++++++++++++++++-------------------
 arch/x86/kvm/vmx/vmx.h           |   3 +-
 arch/x86/kvm/x86.c               |  46 +++++-----
 arch/x86/kvm/x86.h               |   1 +
 28 files changed, 490 insertions(+), 445 deletions(-)
 delete mode 100644 arch/x86/include/asm/virtext.h
 create mode 100644 arch/x86/kvm/governed_features.h

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [GIT PULL] KVM: x86: MMU changes for 6.6
  2023-08-30  0:06 [GIT PULL] KVM: x86 pull requests for 6.6 Sean Christopherson
  2023-08-30  0:06 ` [GIT PULL] KVM: Non-x86 changes " Sean Christopherson
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: Misc " Sean Christopherson
@ 2023-08-30  0:06 ` Sean Christopherson
  2023-08-31 17:27   ` Sean Christopherson
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: PMU " Sean Christopherson
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Sean Christopherson @ 2023-08-30  0:06 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson

Please pull MMU changes for 6.6, with a healthy dose of KVMGT cleanups mixed in.
The other highlight is finally purging the old MMU_DEBUG code and replacing it
with CONFIG_KVM_PROVE_MMU.

All KVMGT patches have been reviewed/acked and tested by KVMGT folks.  A *huge*
thanks to them for all the reviews and testing, and to Yan in particular.

If you have time, please take a closer look at commit a328a359d99b ("KVM:
x86/mmu: Use dummy root, backed by zero page, for !visible guest roots"), it's
held up in (limited) testing, but I'd love more eyeballs on it.

The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:

  Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)

are available in the Git repository at:

  https://github.com/kvm-x86/linux.git tags/kvm-x86-mmu-6.6

for you to fetch changes up to bfd926291c585600ace63ea3b6eb1458aa067f4f:

  KVM: x86/mmu: Include mmu.h in spte.h (2023-08-25 09:03:51 -0700)

----------------------------------------------------------------
KVM x86 MMU changes for 6.6:

 - Rip out the ancient MMU_DEBUG crud and replace the useful bits with
   CONFIG_KVM_PROVE_MMU

 - Overhaul KVM's page-track APIs, and KVMGT's usage, to reduce the API surface
   that is needed by external users (currently only KVMGT), and fix a variety
   of issues in the process

 - Fix KVM's handling of !visible guest roots to avoid premature triple fault
   injection by loading a dummy root backed by the zero page

----------------------------------------------------------------
Like Xu (1):
      KVM: x86/mmu: Move the lockdep_assert of mmu_lock to inside clear_dirty_pt_masked()

Mingwei Zhang (1):
      KVM: x86/mmu: Plumb "struct kvm" all the way to pte_list_remove()

Sean Christopherson (42):
      KVM: x86/mmu: Guard against collision with KVM-defined PFERR_IMPLICIT_ACCESS
      KVM: x86/mmu: Delete pgprintk() and all its usage
      KVM: x86/mmu: Delete rmap_printk() and all its usage
      KVM: x86/mmu: Delete the "dbg" module param
      KVM: x86/mmu: Avoid pointer arithmetic when iterating over SPTEs
      KVM: x86/mmu: Cleanup sanity check of SPTEs at SP free
      KVM: x86/mmu: Rename MMU_WARN_ON() to KVM_MMU_WARN_ON()
      KVM: x86/mmu: Convert "runtime" WARN_ON() assertions to WARN_ON_ONCE()
      KVM: x86/mmu: Bug the VM if a vCPU ends up in long mode without PAE enabled
      KVM: x86/mmu: Replace MMU_DEBUG with proper KVM_PROVE_MMU Kconfig
      KVM: x86/mmu: Use BUILD_BUG_ON_INVALID() for KVM_MMU_WARN_ON() stub
      KVM: x86/mmu: BUG() in rmap helpers iff CONFIG_BUG_ON_DATA_CORRUPTION=y
      drm/i915/gvt: Verify pfn is "valid" before dereferencing "struct page"
      drm/i915/gvt: Verify hugepages are contiguous in physical address space
      drm/i915/gvt: Put the page reference obtained by KVM's gfn_to_pfn()
      drm/i915/gvt: Explicitly check that vGPU is attached before shadowing
      drm/i915/gvt: Error out on an attempt to shadowing an unknown GTT entry type
      drm/i915/gvt: Don't rely on KVM's gfn_to_pfn() to query possible 2M GTT
      drm/i915/gvt: Use an "unsigned long" to iterate over memslot gfns
      drm/i915/gvt: Drop unused helper intel_vgpu_reset_gtt()
      drm/i915/gvt: Protect gfn hash table with vgpu_lock
      KVM: x86/mmu: Move kvm_arch_flush_shadow_{all,memslot}() to mmu.c
      KVM: x86/mmu: Don't rely on page-track mechanism to flush on memslot change
      KVM: x86/mmu: Don't bounce through page-track mechanism for guest PTEs
      KVM: drm/i915/gvt: Drop @vcpu from KVM's ->track_write() hook
      KVM: x86: Reject memslot MOVE operations if KVMGT is attached
      drm/i915/gvt: Don't bother removing write-protection on to-be-deleted slot
      KVM: x86/mmu: Move KVM-only page-track declarations to internal header
      KVM: x86/mmu: Use page-track notifiers iff there are external users
      KVM: x86/mmu: Drop infrastructure for multiple page-track modes
      KVM: x86/mmu: Rename page-track APIs to reflect the new reality
      KVM: x86/mmu: Assert that correct locks are held for page write-tracking
      KVM: x86/mmu: Bug the VM if write-tracking is used but not enabled
      KVM: x86/mmu: Drop @slot param from exported/external page-track APIs
      KVM: x86/mmu: Handle KVM bookkeeping in page-track APIs, not callers
      drm/i915/gvt: Drop final dependencies on KVM internal details
      KVM: x86/mmu: Add helper to convert root hpa to shadow page
      KVM: x86/mmu: Harden new PGD against roots without shadow pages
      KVM: x86/mmu: Harden TDP MMU iteration against root w/o shadow page
      KVM: x86/mmu: Disallow guest from using !visible slots for page tables
      KVM: x86/mmu: Use dummy root, backed by zero page, for !visible guest roots
      KVM: x86/mmu: Include mmu.h in spte.h

Yan Zhao (5):
      drm/i915/gvt: remove interface intel_gvt_is_valid_gfn
      drm/i915/gvt: Don't try to unpin an empty page range
      KVM: x86: Add a new page-track hook to handle memslot deletion
      drm/i915/gvt: switch from ->track_flush_slot() to ->track_remove_region()
      KVM: x86: Remove the unused page-track hook track_flush_slot()

 arch/x86/include/asm/kvm_host.h       |  16 +-
 arch/x86/include/asm/kvm_page_track.h |  73 +++-----
 arch/x86/kvm/Kconfig                  |  13 ++
 arch/x86/kvm/mmu.h                    |   2 +
 arch/x86/kvm/mmu/mmu.c                | 319 ++++++++++++++++------------------
 arch/x86/kvm/mmu/mmu_internal.h       |  24 +--
 arch/x86/kvm/mmu/page_track.c         | 258 +++++++++++++--------------
 arch/x86/kvm/mmu/page_track.h         |  58 +++++++
 arch/x86/kvm/mmu/paging_tmpl.h        |  41 +++--
 arch/x86/kvm/mmu/spte.c               |   6 +-
 arch/x86/kvm/mmu/spte.h               |  21 ++-
 arch/x86/kvm/mmu/tdp_iter.c           |  11 +-
 arch/x86/kvm/mmu/tdp_mmu.c            |  33 ++--
 arch/x86/kvm/x86.c                    |  22 +--
 drivers/gpu/drm/i915/gvt/gtt.c        | 102 ++---------
 drivers/gpu/drm/i915/gvt/gtt.h        |   1 -
 drivers/gpu/drm/i915/gvt/gvt.h        |   3 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c      | 120 +++++--------
 drivers/gpu/drm/i915/gvt/page_track.c |  10 +-
 include/linux/kvm_host.h              |  19 ++
 20 files changed, 568 insertions(+), 584 deletions(-)
 create mode 100644 arch/x86/kvm/mmu/page_track.h

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [GIT PULL] KVM: x86: PMU changes for 6.6
  2023-08-30  0:06 [GIT PULL] KVM: x86 pull requests for 6.6 Sean Christopherson
                   ` (2 preceding siblings ...)
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
@ 2023-08-30  0:06 ` Sean Christopherson
  2023-08-31 17:31   ` Paolo Bonzini
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: Selftests " Sean Christopherson
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Sean Christopherson @ 2023-08-30  0:06 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson

Please pull a light round of PMU changes for 6.6.  Basically just a single
cleanup.  Note, there's a counter truncation fix that I have been neglecting
for a few weeks[*], I'm planning on getting back to that after the merge window.

[*] https://lore.kernel.org/all/20230504120042.785651-1-rkagan@amazon.de

The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:

  Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)

are available in the Git repository at:

  https://github.com/kvm-x86/linux.git tags/kvm-x86-pmu-6.6

for you to fetch changes up to 6de2ccc169683bf81feba163834dae7cdebdd826:

  KVM: x86/pmu: Move .hw_event_available() check out of PMC filter helper (2023-08-02 16:44:36 -0700)

----------------------------------------------------------------
KVM x86 PMU changes for 6.6:

 - Clean up KVM's handling of Intel architectural events

----------------------------------------------------------------
Sean Christopherson (4):
      KVM: x86/pmu: Use enums instead of hardcoded magic for arch event indices
      KVM: x86/pmu: Simplify intel_hw_event_available()
      KVM: x86/pmu: Require nr fixed_pmc_events to match nr max fixed counters
      KVM: x86/pmu: Move .hw_event_available() check out of PMC filter helper

 arch/x86/kvm/pmu.c           |  4 +--
 arch/x86/kvm/vmx/pmu_intel.c | 81 ++++++++++++++++++++++++++++++--------------
 2 files changed, 56 insertions(+), 29 deletions(-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [GIT PULL] KVM: x86: Selftests changes for 6.6
  2023-08-30  0:06 [GIT PULL] KVM: x86 pull requests for 6.6 Sean Christopherson
                   ` (3 preceding siblings ...)
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: PMU " Sean Christopherson
@ 2023-08-30  0:06 ` Sean Christopherson
  2023-08-31 17:21   ` Paolo Bonzini
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Sean Christopherson @ 2023-08-30  0:06 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson

Selftests changes for 6.6.  The big highlight (and really the highlight of all
the x86 pull requests IMO) is the addition of printf() support in guest code,
courtesy of Aaron.

Speaking of which, the vast majority of this has been merged into the s390 tree,
i.e. if you do the s390 pull request first you'll already have most of this.
The immutable tag I created has waaaay more stuff than was strictly needed by
the s390 folks, but I forgot to create the tag earlier and I wasn't sure if
they had already merged kvm-x86/selftests, so I went with the approach I was
most confident wouldn't throw a wrench in s390 or delay their pull request, even
though the result is rather gross.

The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:

  Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)

are available in the Git repository at:

  https://github.com/kvm-x86/linux.git tags/kvm-x86-selftests-6.6

for you to fetch changes up to c92b922a8c526e1bb11945a703cba9f85976de7e:

  KVM: x86: Update MAINTAINTERS to include selftests (2023-08-25 09:04:34 -0700)

----------------------------------------------------------------
KVM: x86: Selftests changes for 6.6:

 - Add testcases to x86's sync_regs_test for detecting KVM TOCTOU bugs

 - Add support for printf() in guest code and covert all guest asserts to use
   printf-based reporting

 - Clean up the PMU event filter test and add new testcases

 - Include x86 selftests in the KVM x86 MAINTAINERS entry

----------------------------------------------------------------
Aaron Lewis (5):
      KVM: selftests: Add strnlen() to the string overrides
      KVM: selftests: Add guest_snprintf() to KVM selftests
      KVM: selftests: Add additional pages to the guest to accommodate ucall
      KVM: selftests: Add string formatting options to ucall
      KVM: selftests: Add a selftest for guest prints and formatted asserts

Bibo Mao (1):
      KVM: selftests: use unified time type for comparison

Jinrong Liang (6):
      KVM: selftests: Add x86 properties for Intel PMU in processor.h
      KVM: selftests: Drop the return of remove_event()
      KVM: selftests: Introduce "struct __kvm_pmu_event_filter" to manipulate filter
      KVM: selftests: Add test cases for unsupported PMU event filter input values
      KVM: selftests: Test if event filter meets expectations on fixed counters
      KVM: selftests: Test gp event filters don't affect fixed event filters

Michal Luczaj (4):
      KVM: x86: Fix KVM_CAP_SYNC_REGS's sync_regs() TOCTOU issues
      KVM: selftests: Extend x86's sync_regs_test to check for CR4 races
      KVM: selftests: Extend x86's sync_regs_test to check for event vector races
      KVM: selftests: Extend x86's sync_regs_test to check for exception races

Minjie Du (1):
      KVM: selftests: Remove superfluous variable assignment

Sean Christopherson (33):
      KVM: selftests: Make TEST_ASSERT_EQ() output look like normal TEST_ASSERT()
      KVM: selftests: Add a shameful hack to preserve/clobber GPRs across ucall
      KVM: selftests: Add formatted guest assert support in ucall framework
      KVM: selftests: Add arch ucall.h and inline simple arch hooks
      KVM: selftests: Add #define of expected KVM exit reason for ucall
      KVM: selftests: Convert aarch_timer to printf style GUEST_ASSERT
      KVM: selftests: Convert debug-exceptions to printf style GUEST_ASSERT
      KVM: selftests: Convert ARM's hypercalls test to printf style GUEST_ASSERT
      KVM: selftests: Convert ARM's page fault test to printf style GUEST_ASSERT
      KVM: selftests: Convert ARM's vGIC IRQ test to printf style GUEST_ASSERT
      KVM: selftests: Convert the memslot performance test to printf guest asserts
      KVM: selftests: Convert s390's memop test to printf style GUEST_ASSERT
      KVM: selftests: Convert s390's tprot test to printf style GUEST_ASSERT
      KVM: selftests: Convert set_memory_region_test to printf-based GUEST_ASSERT
      KVM: selftests: Convert steal_time test to printf style GUEST_ASSERT
      KVM: selftests: Convert x86's CPUID test to printf style GUEST_ASSERT
      KVM: selftests: Convert the Hyper-V extended hypercalls test to printf asserts
      KVM: selftests: Convert the Hyper-V feature test to printf style GUEST_ASSERT
      KVM: selftests: Convert x86's KVM paravirt test to printf style GUEST_ASSERT
      KVM: selftests: Convert the MONITOR/MWAIT test to use printf guest asserts
      KVM: selftests: Convert x86's nested exceptions test to printf guest asserts
      KVM: selftests: Convert x86's set BSP ID test to printf style guest asserts
      KVM: selftests: Convert the nSVM software interrupt test to printf guest asserts
      KVM: selftests: Convert x86's TSC MSRs test to use printf guest asserts
      KVM: selftests: Convert the x86 userspace I/O test to printf guest assert
      KVM: selftests: Convert VMX's PMU capabilities test to printf guest asserts
      KVM: selftests: Convert x86's XCR0 test to use printf-based guest asserts
      KVM: selftests: Rip out old, param-based guest assert macros
      KVM: selftests: Print out guest RIP on unhandled exception
      KVM: selftests: Use GUEST_FAIL() in ARM's arch timer helpers
      KVM: selftests: Reload "good" vCPU state if vCPU hits shutdown
      KVM: selftests: Explicit set #UD when *potentially* injecting exception
      KVM: x86: Update MAINTAINTERS to include selftests

Thomas Huth (1):
      KVM: selftests: Rename the ASSERT_EQ macro

 MAINTAINERS                                        |   2 +
 arch/x86/kvm/x86.c                                 |  13 +-
 tools/testing/selftests/kvm/Makefile               |   6 +
 .../selftests/kvm/aarch64/aarch32_id_regs.c        |   8 +-
 tools/testing/selftests/kvm/aarch64/arch_timer.c   |  22 +-
 .../selftests/kvm/aarch64/debug-exceptions.c       |   8 +-
 tools/testing/selftests/kvm/aarch64/hypercalls.c   |  20 +-
 .../selftests/kvm/aarch64/page_fault_test.c        |  17 +-
 tools/testing/selftests/kvm/aarch64/vgic_irq.c     |   3 +-
 tools/testing/selftests/kvm/guest_print_test.c     | 219 ++++++++++++++
 .../selftests/kvm/include/aarch64/arch_timer.h     |  12 +-
 .../testing/selftests/kvm/include/aarch64/ucall.h  |  20 ++
 tools/testing/selftests/kvm/include/riscv/ucall.h  |  20 ++
 tools/testing/selftests/kvm/include/s390x/ucall.h  |  19 ++
 tools/testing/selftests/kvm/include/test_util.h    |  18 +-
 tools/testing/selftests/kvm/include/ucall_common.h |  98 +++----
 .../selftests/kvm/include/x86_64/processor.h       |   5 +
 tools/testing/selftests/kvm/include/x86_64/ucall.h |  13 +
 tools/testing/selftests/kvm/kvm_page_table_test.c  |   8 +-
 tools/testing/selftests/kvm/lib/aarch64/ucall.c    |  11 +-
 tools/testing/selftests/kvm/lib/guest_sprintf.c    | 307 ++++++++++++++++++++
 tools/testing/selftests/kvm/lib/kvm_util.c         |   6 +-
 tools/testing/selftests/kvm/lib/riscv/ucall.c      |  11 -
 tools/testing/selftests/kvm/lib/s390x/ucall.c      |  10 -
 tools/testing/selftests/kvm/lib/sparsebit.c        |   1 -
 tools/testing/selftests/kvm/lib/string_override.c  |   9 +
 tools/testing/selftests/kvm/lib/ucall_common.c     |  44 +++
 tools/testing/selftests/kvm/lib/x86_64/processor.c |  18 +-
 tools/testing/selftests/kvm/lib/x86_64/ucall.c     |  36 ++-
 .../testing/selftests/kvm/max_guest_memory_test.c  |   2 +-
 tools/testing/selftests/kvm/memslot_perf_test.c    |   4 +-
 tools/testing/selftests/kvm/s390x/cmma_test.c      |  62 ++--
 tools/testing/selftests/kvm/s390x/memop.c          |  13 +-
 tools/testing/selftests/kvm/s390x/tprot.c          |  11 +-
 .../testing/selftests/kvm/set_memory_region_test.c |  21 +-
 tools/testing/selftests/kvm/steal_time.c           |  20 +-
 tools/testing/selftests/kvm/x86_64/cpuid_test.c    |  12 +-
 .../kvm/x86_64/dirty_log_page_splitting_test.c     |  18 +-
 .../kvm/x86_64/exit_on_emulation_failure_test.c    |   2 +-
 .../kvm/x86_64/hyperv_extended_hypercalls.c        |   3 +-
 .../testing/selftests/kvm/x86_64/hyperv_features.c |  29 +-
 tools/testing/selftests/kvm/x86_64/kvm_pv_test.c   |   8 +-
 .../selftests/kvm/x86_64/monitor_mwait_test.c      |  35 ++-
 .../selftests/kvm/x86_64/nested_exceptions_test.c  |  16 +-
 .../selftests/kvm/x86_64/pmu_event_filter_test.c   | 317 +++++++++++++++------
 .../selftests/kvm/x86_64/recalc_apic_map_test.c    |   6 +-
 .../testing/selftests/kvm/x86_64/set_boot_cpu_id.c |   6 +-
 .../kvm/x86_64/svm_nested_soft_inject_test.c       |  22 +-
 .../testing/selftests/kvm/x86_64/sync_regs_test.c  | 132 +++++++++
 tools/testing/selftests/kvm/x86_64/tsc_msrs_test.c |  34 +--
 .../selftests/kvm/x86_64/userspace_io_test.c       |  10 +-
 .../vmx_exception_with_invalid_guest_state.c       |   2 +-
 .../selftests/kvm/x86_64/vmx_pmu_caps_test.c       |  31 +-
 .../selftests/kvm/x86_64/xapic_state_test.c        |   8 +-
 .../testing/selftests/kvm/x86_64/xcr0_cpuid_test.c |  29 +-
 .../testing/selftests/kvm/x86_64/xen_vmcall_test.c |  20 +-
 56 files changed, 1389 insertions(+), 468 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/guest_print_test.c
 create mode 100644 tools/testing/selftests/kvm/include/aarch64/ucall.h
 create mode 100644 tools/testing/selftests/kvm/include/riscv/ucall.h
 create mode 100644 tools/testing/selftests/kvm/include/s390x/ucall.h
 create mode 100644 tools/testing/selftests/kvm/include/x86_64/ucall.h
 create mode 100644 tools/testing/selftests/kvm/lib/guest_sprintf.c

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [GIT PULL] KVM: x86: SVM changes for 6.6
  2023-08-30  0:06 [GIT PULL] KVM: x86 pull requests for 6.6 Sean Christopherson
                   ` (4 preceding siblings ...)
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: Selftests " Sean Christopherson
@ 2023-08-30  0:06 ` Sean Christopherson
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: VMX " Sean Christopherson
  2023-08-31 17:30 ` [GIT PULL] KVM: x86 pull requests " Paolo Bonzini
  7 siblings, 0 replies; 20+ messages in thread
From: Sean Christopherson @ 2023-08-30  0:06 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson

Please pull SVM changes for 6.6.  The highlight is the addition of support for
enabling DebugSwap for SEV-ES (and later) guests, i.e. to allow SEV-ES guests
to utilize hardware breakpoints.

The SEV and SEV-ES fixes from me are a bit late to the party, but they've gotten
as much testing from -next as their going to get.

As mentioned in the "misc" pull request, there's a rather annoying conflict
between the LBR virtualization cleanups and the guest_can_use() framework.

The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:

  Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)

are available in the Git repository at:

  https://github.com/kvm-x86/linux.git tags/kvm-x86-svm-6.6

for you to fetch changes up to 80d0f521d59e08eeaa0bc5d624da139448fb99b8:

  KVM: SVM: Require nrips support for SEV guests (and beyond) (2023-08-25 09:00:40 -0700)

----------------------------------------------------------------
KVM: x86: SVM changes for 6.6:

 - Add support for SEV-ES DebugSwap, i.e. allow SEV-ES guests to use debug
   registers and generate/handle #DBs

 - Clean up LBR virtualization code

 - Fix a bug where KVM fails to set the target pCPU during an IRTE update

 - Fix fatal bugs in SEV-ES intrahost migration

 - Fix a bug where the recent (architecturally correct) change to reinject
   #BP and skip INT3 broke SEV guests (can't decode INT3 to skip it)

----------------------------------------------------------------
Alexey Kardashevskiy (6):
      KVM: SEV: move set_dr_intercepts/clr_dr_intercepts from the header
      KVM: SEV: Move SEV's GP_VECTOR intercept setup to SEV
      KVM: SEV-ES: explicitly disable debug
      KVM: SVM/SEV/SEV-ES: Rework intercepts
      KVM: SEV: Enable data breakpoints in SEV-ES
      KVM: SEV-ES: Eliminate #DB intercept when DebugSwap enabled

Manali Shukla (1):
      KVM: SVM: correct the size of spec_ctrl field in VMCB save area

Sean Christopherson (12):
      KVM: SVM: Rewrite sev_es_prepare_switch_to_guest()'s comment about swap types
      KVM: SVM: Don't defer NMI unblocking until next exit for SEV-ES guests
      KVM: SVM: Don't try to pointlessly single-step SEV-ES guests for NMI window
      KVM: SVM: Fix dead KVM_BUG() code in LBR MSR virtualization
      KVM: SVM: Clean up handling of LBR virtualization enabled
      KVM: SVM: Use svm_get_lbr_vmcb() helper to handle writes to DEBUGCTL
      KVM: SVM: Take and hold ir_list_lock when updating vCPU's Physical ID entry
      KVM: SVM: Set target pCPU during IRTE update if target vCPU is running
      KVM: SVM: Get source vCPUs from source VM for SEV-ES intrahost migration
      KVM: SVM: Skip VMSA init in sev_es_init_vmcb() if pointer is NULL
      KVM: SVM: Don't inject #UD if KVM attempts to skip SEV guest insn
      KVM: SVM: Require nrips support for SEV guests (and beyond)

 arch/x86/include/asm/cpufeatures.h       |   1 +
 arch/x86/include/asm/svm.h               |   5 +-
 arch/x86/kvm/svm/avic.c                  |  59 ++++++++--
 arch/x86/kvm/svm/sev.c                   | 100 ++++++++++++++---
 arch/x86/kvm/svm/svm.c                   | 179 +++++++++++++++++++------------
 arch/x86/kvm/svm/svm.h                   |  43 +-------
 tools/arch/x86/include/asm/cpufeatures.h |   1 +
 7 files changed, 252 insertions(+), 136 deletions(-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [GIT PULL] KVM: x86: VMX changes for 6.6
  2023-08-30  0:06 [GIT PULL] KVM: x86 pull requests for 6.6 Sean Christopherson
                   ` (5 preceding siblings ...)
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
@ 2023-08-30  0:06 ` Sean Christopherson
  2023-08-31 17:32   ` Paolo Bonzini
  2023-08-31 17:30 ` [GIT PULL] KVM: x86 pull requests " Paolo Bonzini
  7 siblings, 1 reply; 20+ messages in thread
From: Sean Christopherson @ 2023-08-30  0:06 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Sean Christopherson

VMX changes for 6.6.  Nothing mindblowing, by far the most interesting change
is the super late fix for NMI VM-Exits that you've already looked at.

The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:

  Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)

are available in the Git repository at:

  https://github.com/kvm-x86/linux.git tags/kvm-x86-vmx-6.6

for you to fetch changes up to 50011c2a245792993f2756e5b5b571512bfa409e:

  KVM: VMX: Refresh available regs and IDT vectoring info before NMI handling (2023-08-28 20:07:43 -0700)

----------------------------------------------------------------
KVM: x86: VMX changes for 6.6:

 - Misc cleanups

 - Fix a bug where KVM reads a stale vmcs.IDT_VECTORING_INFO_FIELD when trying
   to handle NMI VM-Exits

----------------------------------------------------------------
Sean Christopherson (3):
      KVM: VMX: Drop manual TLB flush when migrating vmcs.APIC_ACCESS_ADDR
      KVM: VMX: Delete ancient pr_warn() about KVM_SET_TSS_ADDR not being set
      KVM: VMX: Refresh available regs and IDT vectoring info before NMI handling

Shiyuan Gao (1):
      KVM: VMX: Rename vmx_get_max_tdp_level() to vmx_get_max_ept_level()

 arch/x86/kvm/vmx/vmx.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: Non-x86 changes for 6.6
  2023-08-30  0:06 ` [GIT PULL] KVM: Non-x86 changes " Sean Christopherson
@ 2023-08-31 17:20   ` Paolo Bonzini
  0 siblings, 0 replies; 20+ messages in thread
From: Paolo Bonzini @ 2023-08-31 17:20 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm, linux-kernel

On Wed, Aug 30, 2023 at 2:06 AM Sean Christopherson <seanjc@google.com> wrote:
>
> Please pull a few smallish KVM-wide changes.  This will conflict with the MMU
> pull request, which changed a WARN_ON() to a WARN_ON_ONCE().  The resolution
> is pretty straightfoward.
>
> diff --cc arch/x86/kvm/mmu/tdp_mmu.c
> index 6250bd3d20c1,b5629bc60e36..6c63f2d1675f
> --- a/arch/x86/kvm/mmu/tdp_mmu.c
> +++ b/arch/x86/kvm/mmu/tdp_mmu.c
> @@@ -1241,7 -1241,7 +1241,7 @@@ static bool set_spte_gfn(struct kvm *kv
>         u64 new_spte;
>
>         /* Huge pages aren't expected to be modified without first being zapped. */
> -       WARN_ON(pte_huge(range->arg.pte) || range->start + 1 != range->end);
>  -      WARN_ON_ONCE(pte_huge(range->pte) || range->start + 1 != range->end);
> ++      WARN_ON_ONCE(pte_huge(range->arg.pte) || range->start + 1 != range->end);
>
>         if (iter->level != PG_LEVEL_4K ||
>             !is_shadow_present_pte(iter->old_spte))
>
> The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:
>
>   Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)
>
> are available in the Git repository at:
>
>   https://github.com/kvm-x86/linux.git tags/kvm-x86-generic-6.6
>
> for you to fetch changes up to 458933d33af2cb3663bd8c0080c1efd1f9483db4:
>
>   KVM: Remove unused kvm_make_cpus_request_mask() declaration (2023-08-17 11:59:43 -0700)

Pulled, thanks.

Paolo

> ----------------------------------------------------------------
> Common KVM changes for 6.6:
>
>  - Wrap kvm_{gfn,hva}_range.pte in a union to allow mmu_notifier events to pass
>    action specific data without needing to constantly update the main handlers.
>
>  - Drop unused function declarations
>
> ----------------------------------------------------------------
> Sean Christopherson (1):
>       KVM: Wrap kvm_{gfn,hva}_range.pte in a per-action union
>
> Yue Haibing (2):
>       KVM: Remove unused kvm_device_{get,put}() declarations
>       KVM: Remove unused kvm_make_cpus_request_mask() declaration
>
>  arch/arm64/kvm/mmu.c       |  2 +-
>  arch/mips/kvm/mmu.c        |  2 +-
>  arch/riscv/kvm/mmu.c       |  2 +-
>  arch/x86/kvm/mmu/mmu.c     |  2 +-
>  arch/x86/kvm/mmu/tdp_mmu.c |  6 +++---
>  include/linux/kvm_host.h   | 10 +++++-----
>  virt/kvm/kvm_main.c        | 19 ++++++++++---------
>  7 files changed, 22 insertions(+), 21 deletions(-)
>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: x86: Selftests changes for 6.6
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: Selftests " Sean Christopherson
@ 2023-08-31 17:21   ` Paolo Bonzini
  0 siblings, 0 replies; 20+ messages in thread
From: Paolo Bonzini @ 2023-08-31 17:21 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm, linux-kernel

On Wed, Aug 30, 2023 at 2:07 AM Sean Christopherson <seanjc@google.com> wrote:
>
> Selftests changes for 6.6.  The big highlight (and really the highlight of all
> the x86 pull requests IMO) is the addition of printf() support in guest code,
> courtesy of Aaron.
>
> Speaking of which, the vast majority of this has been merged into the s390 tree,
> i.e. if you do the s390 pull request first you'll already have most of this.
> The immutable tag I created has waaaay more stuff than was strictly needed by
> the s390 folks, but I forgot to create the tag earlier and I wasn't sure if
> they had already merged kvm-x86/selftests, so I went with the approach I was
> most confident wouldn't throw a wrench in s390 or delay their pull request, even
> though the result is rather gross.

Pulling this first for exactly this reason, thanks.

Paolo

> The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:
>
>   Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)
>
> are available in the Git repository at:
>
>   https://github.com/kvm-x86/linux.git tags/kvm-x86-selftests-6.6
>
> for you to fetch changes up to c92b922a8c526e1bb11945a703cba9f85976de7e:
>
>   KVM: x86: Update MAINTAINTERS to include selftests (2023-08-25 09:04:34 -0700)
>
> ----------------------------------------------------------------
> KVM: x86: Selftests changes for 6.6:
>
>  - Add testcases to x86's sync_regs_test for detecting KVM TOCTOU bugs
>
>  - Add support for printf() in guest code and covert all guest asserts to use
>    printf-based reporting
>
>  - Clean up the PMU event filter test and add new testcases
>
>  - Include x86 selftests in the KVM x86 MAINTAINERS entry
>
> ----------------------------------------------------------------
> Aaron Lewis (5):
>       KVM: selftests: Add strnlen() to the string overrides
>       KVM: selftests: Add guest_snprintf() to KVM selftests
>       KVM: selftests: Add additional pages to the guest to accommodate ucall
>       KVM: selftests: Add string formatting options to ucall
>       KVM: selftests: Add a selftest for guest prints and formatted asserts
>
> Bibo Mao (1):
>       KVM: selftests: use unified time type for comparison
>
> Jinrong Liang (6):
>       KVM: selftests: Add x86 properties for Intel PMU in processor.h
>       KVM: selftests: Drop the return of remove_event()
>       KVM: selftests: Introduce "struct __kvm_pmu_event_filter" to manipulate filter
>       KVM: selftests: Add test cases for unsupported PMU event filter input values
>       KVM: selftests: Test if event filter meets expectations on fixed counters
>       KVM: selftests: Test gp event filters don't affect fixed event filters
>
> Michal Luczaj (4):
>       KVM: x86: Fix KVM_CAP_SYNC_REGS's sync_regs() TOCTOU issues
>       KVM: selftests: Extend x86's sync_regs_test to check for CR4 races
>       KVM: selftests: Extend x86's sync_regs_test to check for event vector races
>       KVM: selftests: Extend x86's sync_regs_test to check for exception races
>
> Minjie Du (1):
>       KVM: selftests: Remove superfluous variable assignment
>
> Sean Christopherson (33):
>       KVM: selftests: Make TEST_ASSERT_EQ() output look like normal TEST_ASSERT()
>       KVM: selftests: Add a shameful hack to preserve/clobber GPRs across ucall
>       KVM: selftests: Add formatted guest assert support in ucall framework
>       KVM: selftests: Add arch ucall.h and inline simple arch hooks
>       KVM: selftests: Add #define of expected KVM exit reason for ucall
>       KVM: selftests: Convert aarch_timer to printf style GUEST_ASSERT
>       KVM: selftests: Convert debug-exceptions to printf style GUEST_ASSERT
>       KVM: selftests: Convert ARM's hypercalls test to printf style GUEST_ASSERT
>       KVM: selftests: Convert ARM's page fault test to printf style GUEST_ASSERT
>       KVM: selftests: Convert ARM's vGIC IRQ test to printf style GUEST_ASSERT
>       KVM: selftests: Convert the memslot performance test to printf guest asserts
>       KVM: selftests: Convert s390's memop test to printf style GUEST_ASSERT
>       KVM: selftests: Convert s390's tprot test to printf style GUEST_ASSERT
>       KVM: selftests: Convert set_memory_region_test to printf-based GUEST_ASSERT
>       KVM: selftests: Convert steal_time test to printf style GUEST_ASSERT
>       KVM: selftests: Convert x86's CPUID test to printf style GUEST_ASSERT
>       KVM: selftests: Convert the Hyper-V extended hypercalls test to printf asserts
>       KVM: selftests: Convert the Hyper-V feature test to printf style GUEST_ASSERT
>       KVM: selftests: Convert x86's KVM paravirt test to printf style GUEST_ASSERT
>       KVM: selftests: Convert the MONITOR/MWAIT test to use printf guest asserts
>       KVM: selftests: Convert x86's nested exceptions test to printf guest asserts
>       KVM: selftests: Convert x86's set BSP ID test to printf style guest asserts
>       KVM: selftests: Convert the nSVM software interrupt test to printf guest asserts
>       KVM: selftests: Convert x86's TSC MSRs test to use printf guest asserts
>       KVM: selftests: Convert the x86 userspace I/O test to printf guest assert
>       KVM: selftests: Convert VMX's PMU capabilities test to printf guest asserts
>       KVM: selftests: Convert x86's XCR0 test to use printf-based guest asserts
>       KVM: selftests: Rip out old, param-based guest assert macros
>       KVM: selftests: Print out guest RIP on unhandled exception
>       KVM: selftests: Use GUEST_FAIL() in ARM's arch timer helpers
>       KVM: selftests: Reload "good" vCPU state if vCPU hits shutdown
>       KVM: selftests: Explicit set #UD when *potentially* injecting exception
>       KVM: x86: Update MAINTAINTERS to include selftests
>
> Thomas Huth (1):
>       KVM: selftests: Rename the ASSERT_EQ macro
>
>  MAINTAINERS                                        |   2 +
>  arch/x86/kvm/x86.c                                 |  13 +-
>  tools/testing/selftests/kvm/Makefile               |   6 +
>  .../selftests/kvm/aarch64/aarch32_id_regs.c        |   8 +-
>  tools/testing/selftests/kvm/aarch64/arch_timer.c   |  22 +-
>  .../selftests/kvm/aarch64/debug-exceptions.c       |   8 +-
>  tools/testing/selftests/kvm/aarch64/hypercalls.c   |  20 +-
>  .../selftests/kvm/aarch64/page_fault_test.c        |  17 +-
>  tools/testing/selftests/kvm/aarch64/vgic_irq.c     |   3 +-
>  tools/testing/selftests/kvm/guest_print_test.c     | 219 ++++++++++++++
>  .../selftests/kvm/include/aarch64/arch_timer.h     |  12 +-
>  .../testing/selftests/kvm/include/aarch64/ucall.h  |  20 ++
>  tools/testing/selftests/kvm/include/riscv/ucall.h  |  20 ++
>  tools/testing/selftests/kvm/include/s390x/ucall.h  |  19 ++
>  tools/testing/selftests/kvm/include/test_util.h    |  18 +-
>  tools/testing/selftests/kvm/include/ucall_common.h |  98 +++----
>  .../selftests/kvm/include/x86_64/processor.h       |   5 +
>  tools/testing/selftests/kvm/include/x86_64/ucall.h |  13 +
>  tools/testing/selftests/kvm/kvm_page_table_test.c  |   8 +-
>  tools/testing/selftests/kvm/lib/aarch64/ucall.c    |  11 +-
>  tools/testing/selftests/kvm/lib/guest_sprintf.c    | 307 ++++++++++++++++++++
>  tools/testing/selftests/kvm/lib/kvm_util.c         |   6 +-
>  tools/testing/selftests/kvm/lib/riscv/ucall.c      |  11 -
>  tools/testing/selftests/kvm/lib/s390x/ucall.c      |  10 -
>  tools/testing/selftests/kvm/lib/sparsebit.c        |   1 -
>  tools/testing/selftests/kvm/lib/string_override.c  |   9 +
>  tools/testing/selftests/kvm/lib/ucall_common.c     |  44 +++
>  tools/testing/selftests/kvm/lib/x86_64/processor.c |  18 +-
>  tools/testing/selftests/kvm/lib/x86_64/ucall.c     |  36 ++-
>  .../testing/selftests/kvm/max_guest_memory_test.c  |   2 +-
>  tools/testing/selftests/kvm/memslot_perf_test.c    |   4 +-
>  tools/testing/selftests/kvm/s390x/cmma_test.c      |  62 ++--
>  tools/testing/selftests/kvm/s390x/memop.c          |  13 +-
>  tools/testing/selftests/kvm/s390x/tprot.c          |  11 +-
>  .../testing/selftests/kvm/set_memory_region_test.c |  21 +-
>  tools/testing/selftests/kvm/steal_time.c           |  20 +-
>  tools/testing/selftests/kvm/x86_64/cpuid_test.c    |  12 +-
>  .../kvm/x86_64/dirty_log_page_splitting_test.c     |  18 +-
>  .../kvm/x86_64/exit_on_emulation_failure_test.c    |   2 +-
>  .../kvm/x86_64/hyperv_extended_hypercalls.c        |   3 +-
>  .../testing/selftests/kvm/x86_64/hyperv_features.c |  29 +-
>  tools/testing/selftests/kvm/x86_64/kvm_pv_test.c   |   8 +-
>  .../selftests/kvm/x86_64/monitor_mwait_test.c      |  35 ++-
>  .../selftests/kvm/x86_64/nested_exceptions_test.c  |  16 +-
>  .../selftests/kvm/x86_64/pmu_event_filter_test.c   | 317 +++++++++++++++------
>  .../selftests/kvm/x86_64/recalc_apic_map_test.c    |   6 +-
>  .../testing/selftests/kvm/x86_64/set_boot_cpu_id.c |   6 +-
>  .../kvm/x86_64/svm_nested_soft_inject_test.c       |  22 +-
>  .../testing/selftests/kvm/x86_64/sync_regs_test.c  | 132 +++++++++
>  tools/testing/selftests/kvm/x86_64/tsc_msrs_test.c |  34 +--
>  .../selftests/kvm/x86_64/userspace_io_test.c       |  10 +-
>  .../vmx_exception_with_invalid_guest_state.c       |   2 +-
>  .../selftests/kvm/x86_64/vmx_pmu_caps_test.c       |  31 +-
>  .../selftests/kvm/x86_64/xapic_state_test.c        |   8 +-
>  .../testing/selftests/kvm/x86_64/xcr0_cpuid_test.c |  29 +-
>  .../testing/selftests/kvm/x86_64/xen_vmcall_test.c |  20 +-
>  56 files changed, 1389 insertions(+), 468 deletions(-)
>  create mode 100644 tools/testing/selftests/kvm/guest_print_test.c
>  create mode 100644 tools/testing/selftests/kvm/include/aarch64/ucall.h
>  create mode 100644 tools/testing/selftests/kvm/include/riscv/ucall.h
>  create mode 100644 tools/testing/selftests/kvm/include/s390x/ucall.h
>  create mode 100644 tools/testing/selftests/kvm/include/x86_64/ucall.h
>  create mode 100644 tools/testing/selftests/kvm/lib/guest_sprintf.c
>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: x86: MMU changes for 6.6
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
@ 2023-08-31 17:27   ` Sean Christopherson
  2023-08-31 17:43     ` Paolo Bonzini
  0 siblings, 1 reply; 20+ messages in thread
From: Sean Christopherson @ 2023-08-31 17:27 UTC (permalink / raw)
  To: Paolo Bonzini, kvm, linux-kernel; +Cc: Like Xu

+Like

On Tue, Aug 29, 2023, Sean Christopherson wrote:
> Please pull MMU changes for 6.6, with a healthy dose of KVMGT cleanups mixed in.
> The other highlight is finally purging the old MMU_DEBUG code and replacing it
> with CONFIG_KVM_PROVE_MMU.
> 
> All KVMGT patches have been reviewed/acked and tested by KVMGT folks.  A *huge*
> thanks to them for all the reviews and testing, and to Yan in particular.

FYI, Like found a brown paper bag bug[*] that causes selftests that move memory
regions to fail when compiled with CONFIG_KVM_EXTERNAL_WRITE_TRACKING=y.  I'm
redoing testing today with that forced on, but barring more falling, the fix is:

diff --git a/arch/x86/kvm/mmu/page_track.c b/arch/x86/kvm/mmu/page_track.c
index b5af8249eb09..cfd0b8092d06 100644
--- a/arch/x86/kvm/mmu/page_track.c
+++ b/arch/x86/kvm/mmu/page_track.c
@@ -306,5 +306,5 @@ void kvm_page_track_flush_slot(struct kvm *kvm, struct kvm_memory_slot *slot)
 
 bool kvm_page_track_has_external_user(struct kvm *kvm)
 {
-       return hlist_empty(&kvm->arch.track_notifier_head.track_notifier_list);
+       return !hlist_empty(&kvm->arch.track_notifier_head.track_notifier_list);
 }


[*] https://lkml.kernel.org/r/7a6488f2-fef4-6709-6a95-168b0c034ff4%40gmail.com

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: x86 pull requests for 6.6
  2023-08-30  0:06 [GIT PULL] KVM: x86 pull requests for 6.6 Sean Christopherson
                   ` (6 preceding siblings ...)
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: VMX " Sean Christopherson
@ 2023-08-31 17:30 ` Paolo Bonzini
  7 siblings, 0 replies; 20+ messages in thread
From: Paolo Bonzini @ 2023-08-31 17:30 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm, linux-kernel

On Wed, Aug 30, 2023 at 2:06 AM Sean Christopherson <seanjc@google.com> wrote:
>
> Adding a cover letter of sorts this time around to try and make your life a bit
> easier.

Appreciated, but not particularly necessary. :)

If anything, I would prefer to have pull requests during the
development period if any larger features become ready, so that
conflicts become apparent earlier. Not a huge deal, we can sort out
the specifics when we meet at Plumbers.

Paolo

>   [GIT PULL] KVM: Non-x86 changes for 6.6
>   [GIT PULL] KVM: x86: Misc changes for 6.6
>   [GIT PULL] KVM: x86: MMU changes for 6.6
>   [GIT PULL] KVM: x86: PMU changes for 6.6
>   [GIT PULL] KVM: x86: Selftests changes for 6.6
>   [GIT PULL] KVM: x86: SVM changes for 6.6
>   [GIT PULL] KVM: x86: VMX changes for 6.6
>
> There is a trivial conflict between "Non-x86" and "MMU", and a less trivial one
> between "Misc" and "SVM".  FWIW, I recommend pulling "Misc" after "SVM", I found
> the conflict that's generated by merging "Misc" before "SVM" to be terribly
> confusing.  Details in the "Non-x86" and "Misc" requests respectively.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: x86: PMU changes for 6.6
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: PMU " Sean Christopherson
@ 2023-08-31 17:31   ` Paolo Bonzini
  0 siblings, 0 replies; 20+ messages in thread
From: Paolo Bonzini @ 2023-08-31 17:31 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm, linux-kernel

On Wed, Aug 30, 2023 at 2:07 AM Sean Christopherson <seanjc@google.com> wrote:
>
> Please pull a light round of PMU changes for 6.6.  Basically just a single
> cleanup.  Note, there's a counter truncation fix that I have been neglecting
> for a few weeks[*], I'm planning on getting back to that after the merge window.
>
> [*] https://lore.kernel.org/all/20230504120042.785651-1-rkagan@amazon.de
>
> The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:
>
>   Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)
>
> are available in the Git repository at:
>
>   https://github.com/kvm-x86/linux.git tags/kvm-x86-pmu-6.6
>
> for you to fetch changes up to 6de2ccc169683bf81feba163834dae7cdebdd826:
>
>   KVM: x86/pmu: Move .hw_event_available() check out of PMC filter helper (2023-08-02 16:44:36 -0700)

Pulled, thanks.

Paolo

>
> ----------------------------------------------------------------
> KVM x86 PMU changes for 6.6:
>
>  - Clean up KVM's handling of Intel architectural events
>
> ----------------------------------------------------------------
> Sean Christopherson (4):
>       KVM: x86/pmu: Use enums instead of hardcoded magic for arch event indices
>       KVM: x86/pmu: Simplify intel_hw_event_available()
>       KVM: x86/pmu: Require nr fixed_pmc_events to match nr max fixed counters
>       KVM: x86/pmu: Move .hw_event_available() check out of PMC filter helper
>
>  arch/x86/kvm/pmu.c           |  4 +--
>  arch/x86/kvm/vmx/pmu_intel.c | 81 ++++++++++++++++++++++++++++++--------------
>  2 files changed, 56 insertions(+), 29 deletions(-)
>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: x86: VMX changes for 6.6
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: VMX " Sean Christopherson
@ 2023-08-31 17:32   ` Paolo Bonzini
  0 siblings, 0 replies; 20+ messages in thread
From: Paolo Bonzini @ 2023-08-31 17:32 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm, linux-kernel

On Wed, Aug 30, 2023 at 2:07 AM Sean Christopherson <seanjc@google.com> wrote:
>
> VMX changes for 6.6.  Nothing mindblowing, by far the most interesting change
> is the super late fix for NMI VM-Exits that you've already looked at.
>
> The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:
>
>   Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)
>
> are available in the Git repository at:
>
>   https://github.com/kvm-x86/linux.git tags/kvm-x86-vmx-6.6
>
> for you to fetch changes up to 50011c2a245792993f2756e5b5b571512bfa409e:
>
>   KVM: VMX: Refresh available regs and IDT vectoring info before NMI handling (2023-08-28 20:07:43 -0700)
>
> ----------------------------------------------------------------
> KVM: x86: VMX changes for 6.6:
>
>  - Misc cleanups
>
>  - Fix a bug where KVM reads a stale vmcs.IDT_VECTORING_INFO_FIELD when trying
>    to handle NMI VM-Exits

Pulled, thanks.

Paolo

> ----------------------------------------------------------------
> Sean Christopherson (3):
>       KVM: VMX: Drop manual TLB flush when migrating vmcs.APIC_ACCESS_ADDR
>       KVM: VMX: Delete ancient pr_warn() about KVM_SET_TSS_ADDR not being set
>       KVM: VMX: Refresh available regs and IDT vectoring info before NMI handling
>
> Shiyuan Gao (1):
>       KVM: VMX: Rename vmx_get_max_tdp_level() to vmx_get_max_ept_level()
>
>  arch/x86/kvm/vmx/vmx.c | 38 +++++++++++++++++---------------------
>  1 file changed, 17 insertions(+), 21 deletions(-)
>


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: x86: Misc changes for 6.6
  2023-08-30  0:06 ` [GIT PULL] KVM: x86: Misc " Sean Christopherson
@ 2023-08-31 17:39   ` Paolo Bonzini
  2023-08-31 18:27     ` Sean Christopherson
  0 siblings, 1 reply; 20+ messages in thread
From: Paolo Bonzini @ 2023-08-31 17:39 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm, linux-kernel

On Wed, Aug 30, 2023 at 2:06 AM Sean Christopherson <seanjc@google.com> wrote:
> Sean Christopherson (44):
>       KVM: x86: Snapshot host's MSR_IA32_ARCH_CAPABILITIES
>       KVM: VMX: Drop unnecessary vmx_fb_clear_ctrl_available "cache"
>       KVM: x86: Retry APIC optimized map recalc if vCPU is added/enabled
>       x86/reboot: VMCLEAR active VMCSes before emergency reboot
>       x86/reboot: Harden virtualization hooks for emergency reboot
>       x86/reboot: KVM: Handle VMXOFF in KVM's reboot callback
>       x86/reboot: KVM: Disable SVM during reboot via virt/KVM reboot callback
>       x86/reboot: Assert that IRQs are disabled when turning off virtualization
>       x86/reboot: Hoist "disable virt" helpers above "emergency reboot" path
>       x86/reboot: Disable virtualization during reboot iff callback is registered
>       x86/reboot: Expose VMCS crash hooks if and only if KVM_{INTEL,AMD} is enabled
>       x86/virt: KVM: Open code cpu_has_vmx() in KVM VMX
>       x86/virt: KVM: Move VMXOFF helpers into KVM VMX
>       KVM: SVM: Make KVM_AMD depend on CPU_SUP_AMD or CPU_SUP_HYGON
>       x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm()
>       x86/virt: KVM: Open code cpu_has_svm() into kvm_is_svm_supported()
>       KVM: SVM: Check that the current CPU supports SVM in kvm_is_svm_supported()
>       KVM: VMX: Ensure CPU is stable when probing basic VMX support
>       x86/virt: KVM: Move "disable SVM" helper into KVM SVM
>       KVM: x86: Force kvm_rebooting=true during emergency reboot/crash
>       KVM: SVM: Use "standard" stgi() helper when disabling SVM
>       KVM: VMX: Skip VMCLEAR logic during emergency reboots if CR4.VMXE=0
>       KVM: nSVM: Check instead of asserting on nested TSC scaling support
>       KVM: nSVM: Load L1's TSC multiplier based on L1 state, not L2 state
>       KVM: nSVM: Use the "outer" helper for writing multiplier to MSR_AMD64_TSC_RATIO
>       KVM: SVM: Clean up preemption toggling related to MSR_AMD64_TSC_RATIO
>       KVM: x86: Always write vCPU's current TSC offset/ratio in vendor hooks
>       KVM: nSVM: Skip writes to MSR_AMD64_TSC_RATIO if guest state isn't loaded
>       KVM: x86: Remove WARN sanity check on hypervisor timer vs. UNINITIALIZED vCPU
>       KVM: x86: Add a framework for enabling KVM-governed x86 features
>       KVM: x86/mmu: Use KVM-governed feature framework to track "GBPAGES enabled"
>       KVM: VMX: Recompute "XSAVES enabled" only after CPUID update
>       KVM: VMX: Check KVM CPU caps, not just VMX MSR support, for XSAVE enabling
>       KVM: VMX: Rename XSAVES control to follow KVM's preferred "ENABLE_XYZ"
>       KVM: x86: Use KVM-governed feature framework to track "XSAVES enabled"
>       KVM: nVMX: Use KVM-governed feature framework to track "nested VMX enabled"
>       KVM: nSVM: Use KVM-governed feature framework to track "NRIPS enabled"
>       KVM: nSVM: Use KVM-governed feature framework to track "TSC scaling enabled"
>       KVM: nSVM: Use KVM-governed feature framework to track "vVM{SAVE,LOAD} enabled"
>       KVM: nSVM: Use KVM-governed feature framework to track "LBRv enabled"
>       KVM: nSVM: Use KVM-governed feature framework to track "Pause Filter enabled"
>       KVM: nSVM: Use KVM-governed feature framework to track "vGIF enabled"
>       KVM: nSVM: Use KVM-governed feature framework to track "vNMI enabled"
>       KVM: x86: Disallow guest CPUID lookups when IRQs are disabled

This is definitely stuff that I wish I took a look for earlier (and
this is also why I prefer small bits over the development period, as
it keeps me honest), I'll take a look but I've pulled it anyway.

BTW, not using filemap turned out to be much bigger, and to some
extent uglier, than I expected. I'll send a message to the private mem
thread, but I think we should not pursue that for now and do it in a
separate patch series (if at all) so that it's clearer what filemap_*
code is being replaced by custom code.



Paolo


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: x86: MMU changes for 6.6
  2023-08-31 17:27   ` Sean Christopherson
@ 2023-08-31 17:43     ` Paolo Bonzini
  2023-09-01 18:43       ` Sean Christopherson
  0 siblings, 1 reply; 20+ messages in thread
From: Paolo Bonzini @ 2023-08-31 17:43 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm, linux-kernel, Like Xu

On Thu, Aug 31, 2023 at 7:27 PM Sean Christopherson <seanjc@google.com> wrote:
>
> +Like
>
> On Tue, Aug 29, 2023, Sean Christopherson wrote:
> > Please pull MMU changes for 6.6, with a healthy dose of KVMGT cleanups mixed in.
> > The other highlight is finally purging the old MMU_DEBUG code and replacing it
> > with CONFIG_KVM_PROVE_MMU.
> >
> > All KVMGT patches have been reviewed/acked and tested by KVMGT folks.  A *huge*
> > thanks to them for all the reviews and testing, and to Yan in particular.
>
> FYI, Like found a brown paper bag bug[*] that causes selftests that move memory
> regions to fail when compiled with CONFIG_KVM_EXTERNAL_WRITE_TRACKING=y.  I'm
> redoing testing today with that forced on, but barring more falling, the fix is:

Ok, I'll apply these by hand.

Paolo


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: x86: Misc changes for 6.6
  2023-08-31 17:39   ` Paolo Bonzini
@ 2023-08-31 18:27     ` Sean Christopherson
  0 siblings, 0 replies; 20+ messages in thread
From: Sean Christopherson @ 2023-08-31 18:27 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel

On Thu, Aug 31, 2023, Paolo Bonzini wrote:
> This is definitely stuff that I wish I took a look for earlier (and
> this is also why I prefer small bits over the development period, as
> it keeps me honest),

I'll work on making this happen.  I think the biggest thing on my end is to make
it easier to track/merge arbitrary topic branches, e.g. so that I can put big
series into their own branches with minimal risk of forgetting to merge them into
kvm-x86/next.

> I'll take a look but I've pulled it anyway.

FWIW, I despise the "goverened features" name, though I like the guest_can_use()
name.

> BTW, not using filemap turned out to be much bigger, and to some
> extent uglier, than I expected. I'll send a message to the private mem
> thread, but I think we should not pursue that for now and do it in a
> separate patch series (if at all) so that it's clearer what filemap_*
> code is being replaced by custom code.

Bummer, I was hoping we could avoid having to touch mm/ code.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: x86: MMU changes for 6.6
  2023-08-31 17:43     ` Paolo Bonzini
@ 2023-09-01 18:43       ` Sean Christopherson
  2023-09-01 21:07         ` Paolo Bonzini
  0 siblings, 1 reply; 20+ messages in thread
From: Sean Christopherson @ 2023-09-01 18:43 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Like Xu

On Thu, Aug 31, 2023, Paolo Bonzini wrote:
> On Thu, Aug 31, 2023 at 7:27 PM Sean Christopherson <seanjc@google.com> wrote:
> >
> > +Like
> >
> > On Tue, Aug 29, 2023, Sean Christopherson wrote:
> > > Please pull MMU changes for 6.6, with a healthy dose of KVMGT cleanups mixed in.
> > > The other highlight is finally purging the old MMU_DEBUG code and replacing it
> > > with CONFIG_KVM_PROVE_MMU.
> > >
> > > All KVMGT patches have been reviewed/acked and tested by KVMGT folks.  A *huge*
> > > thanks to them for all the reviews and testing, and to Yan in particular.
> >
> > FYI, Like found a brown paper bag bug[*] that causes selftests that move memory
> > regions to fail when compiled with CONFIG_KVM_EXTERNAL_WRITE_TRACKING=y.  I'm
> > redoing testing today with that forced on, but barring more falling, the fix is:
> 
> Ok, I'll apply these by hand.

In case you haven't taken care of this already, here's an "official" tested fix.

Like, if you can give your SoB, I'd rather give you full author credit and sub
me out entirely.

--
From: Sean Christopherson <seanjc@google.com>
Date: Fri, 1 Sep 2023 16:55:56 +0000
Subject: [PATCH] KVM: x86/mmu: Fix inverted check when detecting external page
 tracker(s)

When checking for the presence of external users of page write tracking,
check that the list of external trackers is NOT empty.

Fixes: aa611a99adb4 ("KVM: x86: Reject memslot MOVE operations if KVMGT is attached")
Reported-by: Like Xu <like.xu.linux@gmail.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/mmu/page_track.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu/page_track.h b/arch/x86/kvm/mmu/page_track.h
index 62f98c6c5af3..d4d72ed999b1 100644
--- a/arch/x86/kvm/mmu/page_track.h
+++ b/arch/x86/kvm/mmu/page_track.h
@@ -32,7 +32,7 @@ void kvm_page_track_delete_slot(struct kvm *kvm, struct kvm_memory_slot *slot);
 
 static inline bool kvm_page_track_has_external_user(struct kvm *kvm)
 {
-	return hlist_empty(&kvm->arch.track_notifier_head.track_notifier_list);
+	return !hlist_empty(&kvm->arch.track_notifier_head.track_notifier_list);
 }
 #else
 static inline int kvm_page_track_init(struct kvm *kvm) { return 0; }

base-commit: 22a1c60f8beca52229911b5133d010ff76588921
-- 


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: x86: MMU changes for 6.6
  2023-09-01 18:43       ` Sean Christopherson
@ 2023-09-01 21:07         ` Paolo Bonzini
  2023-09-01 21:49           ` Sean Christopherson
  0 siblings, 1 reply; 20+ messages in thread
From: Paolo Bonzini @ 2023-09-01 21:07 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: kvm, linux-kernel, Like Xu

On 9/1/23 20:43, Sean Christopherson wrote:
>> Ok, I'll apply these by hand.
> In case you haven't taken care of this already, here's an "official" tested fix.
> 
> Like, if you can give your SoB, I'd rather give you full author credit and sub
> me out entirely.

I prefer to squash and possibly face Linus's wrath. :)

Paolo


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [GIT PULL] KVM: x86: MMU changes for 6.6
  2023-09-01 21:07         ` Paolo Bonzini
@ 2023-09-01 21:49           ` Sean Christopherson
  0 siblings, 0 replies; 20+ messages in thread
From: Sean Christopherson @ 2023-09-01 21:49 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm, linux-kernel, Like Xu

On Fri, Sep 01, 2023, Paolo Bonzini wrote:
> On 9/1/23 20:43, Sean Christopherson wrote:
> > > Ok, I'll apply these by hand.
> > In case you haven't taken care of this already, here's an "official" tested fix.
> > 
> > Like, if you can give your SoB, I'd rather give you full author credit and sub
> > me out entirely.
> 
> I prefer to squash and possibly face Linus's wrath. :)

LOL, works for me, as long as you're taking the bullets. ;-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-09-01 22:55 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30  0:06 [GIT PULL] KVM: x86 pull requests for 6.6 Sean Christopherson
2023-08-30  0:06 ` [GIT PULL] KVM: Non-x86 changes " Sean Christopherson
2023-08-31 17:20   ` Paolo Bonzini
2023-08-30  0:06 ` [GIT PULL] KVM: x86: Misc " Sean Christopherson
2023-08-31 17:39   ` Paolo Bonzini
2023-08-31 18:27     ` Sean Christopherson
2023-08-30  0:06 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
2023-08-31 17:27   ` Sean Christopherson
2023-08-31 17:43     ` Paolo Bonzini
2023-09-01 18:43       ` Sean Christopherson
2023-09-01 21:07         ` Paolo Bonzini
2023-09-01 21:49           ` Sean Christopherson
2023-08-30  0:06 ` [GIT PULL] KVM: x86: PMU " Sean Christopherson
2023-08-31 17:31   ` Paolo Bonzini
2023-08-30  0:06 ` [GIT PULL] KVM: x86: Selftests " Sean Christopherson
2023-08-31 17:21   ` Paolo Bonzini
2023-08-30  0:06 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
2023-08-30  0:06 ` [GIT PULL] KVM: x86: VMX " Sean Christopherson
2023-08-31 17:32   ` Paolo Bonzini
2023-08-31 17:30 ` [GIT PULL] KVM: x86 pull requests " Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).