mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v5 00/18] TDX MMU prep series part 1
@ 2024-12-13 19:56 Paolo Bonzini
  2024-12-13 19:56 ` [PATCH 01/18] KVM: x86/mmu: Zap invalid roots with mmu_lock holding for write at uninit Paolo Bonzini
                   ` (18 more replies)
  0 siblings, 19 replies; 25+ messages in thread
From: Paolo Bonzini @ 2024-12-13 19:56 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: yan.y.zhao, isaku.yamahata, binbin.wu, rick.p.edgecombe

Hi,

this is the essentially final version of the TDX MMU prep series, focusing
on supporting TDX's separation of EPT into a direct part (for shared pages)
and a part that is managed by the TDX module and cached (into a "mirror"
EPT) by KVM.

The changes from v4 (https://patchew.org/linux/20240718211230.1492011-1-rick.p.edgecombe@intel.com/)
are minor:

- patch 7: kvm_tdp_mmu_handle_gfn is now __kvm_tdp_mmu_age_gfn_range

- patch 7: zap_collapsible_spte_range is now split into
  tdp_mmu_make_huge_spte and recover_huge_pages_range

- patch 10/12: KVM_INVALID_ROOTS used to mean "walk all invalid roots";
  now it means "walk *also* invalid roots of the kind (direct/mirror)
  specified by the other bits.  This is closer in meaning to the
  existing code, as kvm_tdp_mmu_unmap_gfn_range() will then operate
  only on direct or only on mirror pages depending on the path that
  caused the invalidation (guest_memfd vs. MMU notifier)

- patch 13: adjust commit message due to change from kvm_tdp_mmu_handle_gfn
  to __kvm_tdp_mmu_age_gfn_range; "or" KVM_INVALID_ROOTS into the
  "types" variable in kvm_tdp_mmu_unmap_gfn_range, otherwise the loop
  would not affect invalid roots.  This is the problematic code from v4:

-	__for_each_tdp_mmu_root_yield_safe(kvm, root, range->slot->as_id, KVM_ALL_ROOTS)
+	types = kvm_gfn_range_filter_to_root_types(kvm, range->attr_filter);
+
+	__for_each_tdp_mmu_root_yield_safe(kvm, root, range->slot->as_id, types)

  and here is it in v5

+	types = kvm_gfn_range_filter_to_root_types(kvm, range->attr_filter) | KVM_INVALID_ROOTS;
+
+	__for_each_tdp_mmu_root_yield_safe(kvm, root, range->slot->as_id, types)

- patch 14: tdp_mmu_zap_spte_atomic() disappeared in commit 35ef80eb29ab
  ("KVM: x86/mmu: Batch TLB flushes when zapping collapsible TDP MMU SPTEs", 2024-10-30)

- patch 18: context changes due to kvm_release_pfn_clean -> kvm_mmu_finish_page_fault

Thanks,

Paolo

Isaku Yamahata (12):
  KVM: Add member to struct kvm_gfn_range for target alias
  KVM: x86/mmu: Add an external pointer to struct kvm_mmu_page
  KVM: x86/mmu: Add an is_mirror member for union kvm_mmu_page_role
  KVM: x86/tdp_mmu: Take struct kvm in iter loops
  KVM: x86/mmu: Support GFN direct bits
  KVM: x86/tdp_mmu: Extract root invalid check from tdx_mmu_next_root()
  KVM: x86/tdp_mmu: Introduce KVM MMU root types to specify page table
    type
  KVM: x86/tdp_mmu: Take root in tdp_mmu_for_each_pte()
  KVM: x86/tdp_mmu: Support mirror root for TDP MMU
  KVM: x86/tdp_mmu: Propagate building mirror page tables
  KVM: x86/tdp_mmu: Propagate tearing down mirror page tables
  KVM: x86/tdp_mmu: Take root types for
    kvm_tdp_mmu_invalidate_all_roots()

Paolo Bonzini (1):
  KVM: x86/tdp_mmu: Propagate attr_filter to MMU notifier callbacks

Rick Edgecombe (5):
  KVM: x86/mmu: Zap invalid roots with mmu_lock holding for write at
    uninit
  KVM: x86: Add a VM type define for TDX
  KVM: x86/mmu: Make kvm_tdp_mmu_alloc_root() return void
  KVM: x86/tdp_mmu: Don't zap valid mirror roots in
    kvm_tdp_mmu_zap_all()
  KVM: x86/mmu: Prevent aliased memslot GFNs

 arch/x86/include/asm/kvm-x86-ops.h |   4 +
 arch/x86/include/asm/kvm_host.h    |  26 ++-
 arch/x86/include/uapi/asm/kvm.h    |   1 +
 arch/x86/kvm/mmu.h                 |  31 +++
 arch/x86/kvm/mmu/mmu.c             |  50 ++++-
 arch/x86/kvm/mmu/mmu_internal.h    |  64 +++++-
 arch/x86/kvm/mmu/spte.h            |   5 +
 arch/x86/kvm/mmu/tdp_iter.c        |  10 +-
 arch/x86/kvm/mmu/tdp_iter.h        |  21 +-
 arch/x86/kvm/mmu/tdp_mmu.c         | 323 ++++++++++++++++++++++-------
 arch/x86/kvm/mmu/tdp_mmu.h         |  51 ++++-
 arch/x86/kvm/x86.c                 |   3 +
 include/linux/kvm_host.h           |   6 +
 virt/kvm/guest_memfd.c             |   2 +
 virt/kvm/kvm_main.c                |  14 ++
 15 files changed, 506 insertions(+), 105 deletions(-)

-- 
2.43.5


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

end of thread, other threads:[~2024-12-20 10:07 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-13 19:56 [PATCH v5 00/18] TDX MMU prep series part 1 Paolo Bonzini
2024-12-13 19:56 ` [PATCH 01/18] KVM: x86/mmu: Zap invalid roots with mmu_lock holding for write at uninit Paolo Bonzini
2024-12-13 19:56 ` [PATCH 02/18] KVM: Add member to struct kvm_gfn_range for target alias Paolo Bonzini
2024-12-13 19:56 ` [PATCH 03/18] KVM: x86: Add a VM type define for TDX Paolo Bonzini
2024-12-13 19:56 ` [PATCH 04/18] KVM: x86/mmu: Add an external pointer to struct kvm_mmu_page Paolo Bonzini
2024-12-16 12:31   ` Huang, Kai
2024-12-13 19:56 ` [PATCH 05/18] KVM: x86/mmu: Add an is_mirror member for union kvm_mmu_page_role Paolo Bonzini
2024-12-13 19:56 ` [PATCH 06/18] KVM: x86/mmu: Make kvm_tdp_mmu_alloc_root() return void Paolo Bonzini
2024-12-13 19:57 ` [PATCH 07/18] KVM: x86/tdp_mmu: Take struct kvm in iter loops Paolo Bonzini
2024-12-13 19:57 ` [PATCH 08/18] KVM: x86/mmu: Support GFN direct bits Paolo Bonzini
2024-12-13 19:57 ` [PATCH 09/18] KVM: x86/tdp_mmu: Extract root invalid check from tdx_mmu_next_root() Paolo Bonzini
2024-12-16 12:35   ` Huang, Kai
2024-12-13 19:57 ` [PATCH 10/18] KVM: x86/tdp_mmu: Introduce KVM MMU root types to specify page table type Paolo Bonzini
2024-12-13 19:57 ` [PATCH 11/18] KVM: x86/tdp_mmu: Take root in tdp_mmu_for_each_pte() Paolo Bonzini
2024-12-13 19:57 ` [PATCH 12/18] KVM: x86/tdp_mmu: Support mirror root for TDP MMU Paolo Bonzini
2024-12-13 19:57 ` [PATCH 13/18] KVM: x86/tdp_mmu: Propagate attr_filter to MMU notifier callbacks Paolo Bonzini
2024-12-17 12:53   ` Yan Zhao
2024-12-13 19:57 ` [PATCH 14/18] KVM: x86/tdp_mmu: Propagate building mirror page tables Paolo Bonzini
2024-12-13 19:57 ` [PATCH 15/18] KVM: x86/tdp_mmu: Propagate tearing down " Paolo Bonzini
2024-12-13 19:57 ` [PATCH 16/18] KVM: x86/tdp_mmu: Take root types for kvm_tdp_mmu_invalidate_all_roots() Paolo Bonzini
2024-12-13 19:57 ` [PATCH 17/18] KVM: x86/tdp_mmu: Don't zap valid mirror roots in kvm_tdp_mmu_zap_all() Paolo Bonzini
2024-12-18  2:49   ` Yan Zhao
2024-12-13 19:57 ` [PATCH 18/18] KVM: x86/mmu: Prevent aliased memslot GFNs Paolo Bonzini
2024-12-18  0:34 ` [PATCH v5 00/18] TDX MMU prep series part 1 Edgecombe, Rick P
2024-12-20  9:32   ` Yan Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®