Skip to content

RFC Add TDX intra-host migration support

Ryan Afranji kvm linux-kselftest lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 RFC Latest10 patches 2 repliesIn review

Changes in v2 from the cover letter

+ Added patch to prevent deadlock warnings by re-ordering locking order.
+ Added patch to allow vCPUs to be created for uninitialized VMs.
+ Minor optimizations to TDX intra-host migration core logic.
+ Moved lapic state transfer into TDX intra-host migration core logic.
+ Added logic to handle posted interrupts that are injected during migration.
+ Added selftests.
+ Addressed comments from RFC v1.
+ Various small changes to make patchset compatible with latest version of kvm/next.

[1] https://lore.kernel.org/lkml/[email protected]
[2] https://lore.kernel.org/lkml/[email protected]
[3] https://lore.kernel.org/all/[email protected]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10KVM: Split tdp_mmu_pages to mirror and direct countersarch/x86/include/asm/kvm_host.h arch/x86/kvm/mmu/tdp_mmu.c+14 -40 replies
2/10KVM: x86: Adjust locking order in move_enc_context_fromarch/x86/kvm/svm/sev.c arch/x86/kvm/x86.c+14 -130 replies
3/10KVM: TDX: Add base implementation for tdx_vm_move_enc_context_fromarch/x86/kvm/vmx/main.c arch/x86/kvm/vmx/tdx.c arch/x86/kvm/vmx/x86_ops.h+36 -10 replies
4/10KVM: TDX: Implement moving mirror pages between 2 TDsarch/x86/kvm/mmu.h arch/x86/kvm/mmu/mmu.c arch/x86/kvm/mmu/tdp_mmu.c +1 more+130 -50 replies
5/10KVM: TDX: Allow vCPUs to be created for migrationarch/x86/kvm/vmx/tdx.c+11 -100 replies
6/10KVM: TDX: Add core logic for TDX intra-host migrationarch/x86/kvm/vmx/tdx.c+192 -10 replies
7/10KVM: selftests: Refactor userspace_mem_region creation out of vm_mem_addtools/testing/selftests/kvm/lib/kvm_util.c+89 -580 replies
8/10KVM: selftests: TDX: Add tests for TDX in-place migrationtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/include/x86/tdx/tdx_util.h +3 more+429 -40 replies
9/10KVM: selftests: Add TDX support for ucallstools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/include/x86/ucall.h tools/testing/selftests/kvm/lib/ucall_common.c +2 more+118 -370 replies
10/10KVM: selftests: Add irqfd/interrupts test for TDX with migrationtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/include/kvm_util.h tools/testing/selftests/kvm/include/x86/tdx/tdx_util.h +6 more+343 -260 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC PATCH v2 00/10] Add TDX intra-host migration support

Hello,

This is RFC v2 for the TDX intra-host migration patch series. It addresses comments in RFC v1 [1] and is rebased onto the latest kvm/next (v6.16-rc1).

This patchset was built on top of the latest TDX selftests [2] and gmem linking [3] RFC patch series.

Here is the series stitched together for your convenience:
https://github.com/googleprodkernel/linux-cc/tree/tdx-copyless-rfc-v2

Changes from RFC v1:
+ Added patch to prevent deadlock warnings by re-ordering locking order.
+ Added patch to allow vCPUs to be created for uninitialized VMs.
+ Minor optimizations to TDX intra-host migration core logic.
+ Moved lapic state transfer into TDX intra-host migration core logic.
+ Added logic to handle posted interrupts that are injected during migration.
+ Added selftests.
+ Addressed comments from RFC v1.
+ Various small changes to make patchset compatible with latest version of kvm/next.

[1] https://lore.kernel.org/lkml/[email protected]
[2] https://lore.kernel.org/lkml/[email protected]
[3] https://lore.kernel.org/all/[email protected]

Ackerley Tng (2):
KVM: selftests: Add TDX support for ucalls
KVM: selftests: Add irqfd/interrupts test for TDX with migration

Ryan Afranji (3):
KVM: x86: Adjust locking order in move_enc_context_from
KVM: TDX: Allow vCPUs to be created for migration
KVM: selftests: Refactor userspace_mem_region creation out of
vm_mem_add

Sagi Shahar (5):
KVM: Split tdp_mmu_pages to mirror and direct counters
KVM: TDX: Add base implementation for tdx_vm_move_enc_context_from
KVM: TDX: Implement moving mirror pages between 2 TDs
KVM: TDX: Add core logic for TDX intra-host migration
KVM: selftests: TDX: Add tests for TDX in-place migration

 arch/x86/include/asm/kvm_host.h               |   7 +-
 arch/x86/kvm/mmu.h                            |   2 +
 arch/x86/kvm/mmu/mmu.c                        |  66 ++++
 arch/x86/kvm/mmu/tdp_mmu.c                    |  72 +++-
 arch/x86/kvm/mmu/tdp_mmu.h                    |   6 +
 arch/x86/kvm/svm/sev.c                        |  13 +-
 arch/x86/kvm/vmx/main.c                       |  12 +-
 arch/x86/kvm/vmx/tdx.c                        | 236 +++++++++++-
 arch/x86/kvm/vmx/x86_ops.h                    |   1 +
 arch/x86/kvm/x86.c                            |  14 +-
 tools/testing/selftests/kvm/Makefile.kvm      |   2 +
 .../testing/selftests/kvm/include/kvm_util.h  |  25 ++
 .../selftests/kvm/include/x86/tdx/tdx_util.h  |   3 +
 .../selftests/kvm/include/x86/tdx/test_util.h |   5 +
 .../testing/selftests/kvm/include/x86/ucall.h |   4 +-
 tools/testing/selftests/kvm/lib/kvm_util.c    | 222 ++++++++----
 .../testing/selftests/kvm/lib/ucall_common.c  |   2 +-
 .../selftests/kvm/lib/x86/tdx/tdx_util.c      |  63 +++-
 .../selftests/kvm/lib/x86/tdx/test_util.c     |  17 +
 tools/testing/selftests/kvm/lib/x86/ucall.c   | 108 ++++--
 .../kvm/x86/tdx_irqfd_migrate_test.c          | 264 ++++++++++++++
 .../selftests/kvm/x86/tdx_migrate_tests.c     | 337 ++++++++++++++++++
 22 files changed, 1349 insertions(+), 132 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86/tdx_irqfd_migrate_test.c
 create mode 100644 tools/testing/selftests/kvm/x86/tdx_migrate_tests.c
Signature · 1 line
2.50.0.rc1.591.g9c95f17f64-goog