Skip to content

KVM: guest_memfd fixes

Sean Christopherson kvm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13KVM: Assert that mmu_invalidate_in_progress *never* goes negativevirt/kvm/kvm_main.c+1 -20 replies
2/13KVM: Actually truncate the inode when doing PUNCH_HOLE for guest_memfdvirt/kvm/guest_mem.c+5 -20 replies
3/13KVM: WARN if *any* MMU invalidation sequence doesn't add a rangevirt/kvm/kvm_main.c+3 -40 replies
4/13KVM: WARN if there are danging MMU invalidations at VM destructionvirt/kvm/kvm_main.c+8 -12 replies
5/13KVM: Fix MMU invalidation bookkeeping in guest_memfdvirt/kvm/guest_mem.c+14 -90 replies
6/13KVM: Disallow hugepages for incompatible gmem bindings, but let 'em succeedvirt/kvm/guest_mem.c+27 -274 replies
7/13KVM: x86/mmu: Track PRIVATE impact on hugepage mappings for all memslotsarch/x86/kvm/mmu/mmu.c+6 -42 replies
8/13KVM: x86/mmu: Zap shared-only memslots when private attribute changesarch/x86/kvm/mmu/mmu.c+10 -30 replies
9/13KVM: Always add relevant ranges to invalidation set when changing attributesvirt/kvm/kvm_main.c+20 -10 replies
10/13KVM: x86/mmu: Drop repeated add() of to-be-invalidated rangearch/x86/kvm/mmu/mmu.c+1 -10 replies
11/13KVM: selftests: Refactor private mem conversions to prep for punch_hole testtools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c+27 -240 replies
12/13KVM: selftests: Add a "pure" PUNCH_HOLE on guest_memfd testcasetools/testing/selftests/kvm/x86_64/private_mem_conversions_test.c+61 -00 replies
13/13KVM: Rename guest_mem.c to guest_memfd.cvirt/kvm/Makefile.kvm virt/kvm/guest_memfd.c+1 -10 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 00/13] KVM: guest_memfd fixes

Fix a variety of bugs in the guest_memfd series, almost all of which are my fault, and add assertions and testcases to detect future regressions.

The last patch, renaming guest_mem.c to guest_memfd.c, is obviously not a bug fix, I included it here so that if we want to go with guest_memfd.c, squashing everything will be straightforward.

Note, the truncate fix and test conflicts with Isaku's series[*]. My fix is more correct (knock wood), and my test is slightly more comprehensive (though arguably not really all that more interesting).

Note #2, this is based on kvm-x86/guest_memfd, to which I force-pushed v12.

Note #3, the patches are organized so that they can be squashed with their Fixes, i.e. the splits are more than a bit odd in some places.

[*] https://lore.kernel.org/all/[email protected]

Sean Christopherson (13):
KVM: Assert that mmu_invalidate_in_progress *never* goes negative
KVM: Actually truncate the inode when doing PUNCH_HOLE for guest_memfd
KVM: WARN if *any* MMU invalidation sequence doesn't add a range
KVM: WARN if there are danging MMU invalidations at VM destruction
KVM: Fix MMU invalidation bookkeeping in guest_memfd
KVM: Disallow hugepages for incompatible gmem bindings, but let 'em
succeed
KVM: x86/mmu: Track PRIVATE impact on hugepage mappings for all
memslots
KVM: x86/mmu: Zap shared-only memslots when private attribute changes
KVM: Always add relevant ranges to invalidation set when changing
attributes
KVM: x86/mmu: Drop repeated add() of to-be-invalidated range
KVM: selftests: Refactor private mem conversions to prep for
punch_hole test
KVM: selftests: Add a "pure" PUNCH_HOLE on guest_memfd testcase
KVM: Rename guest_mem.c to guest_memfd.c

 arch/x86/kvm/mmu/mmu.c                        |  25 ++--
 .../kvm/x86_64/private_mem_conversions_test.c | 112 ++++++++++++++----
 virt/kvm/Makefile.kvm                         |   2 +-
 virt/kvm/{guest_mem.c => guest_memfd.c}       |  84 +++++++------
 virt/kvm/kvm_main.c                           |  40 +++++--
 5 files changed, 184 insertions(+), 79 deletions(-)
 rename virt/kvm/{guest_mem.c => guest_memfd.c} (92%)

base-commit: 7af66fbd6d89b159acc359895449b5940b6e4fdb

Signature · 1 line
2.42.0.515.g380fc7ccd1-goog