Skip to content

KVM: riscv: Add KVM_PRE_FAULT_MEMORY support

Jinyu Tang kvm kvm-riscv linux-kselftest linux-riscv lkml 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest posting 2/25 patches 1 replyIn review
  2. v4 posting 1/25 patches 0 repliesSuperseded
  3. v33 patches 3 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v23 patches2 repliesSuperseded
v13 patches1 replySuperseded

Changes in v4 from the cover letter

- Resend the full series because the previous v4 send was interrupted and the kvm-riscv list archive did not show a complete thread. No code changes.

Patches in v4 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5KVM: riscv: Avoid overwriting G-stage tables with huge leavesarch/riscv/kvm/gstage.c arch/riscv/kvm/mmu.c+29 -11 reply
2/5KVM: riscv: Avoid THP adjustment for existing 4K G-stage leavesarch/riscv/kvm/mmu.c+13 -10 replies
3/5KVM: riscv: Implement KVM_PRE_FAULT_MEMORYarch/riscv/kvm/Kconfig arch/riscv/kvm/gstage.c arch/riscv/kvm/mmu.c +1 more+49 -10 replies
4/5KVM: selftests: Add RISC-V Sv57 page table indexingtools/testing/selftests/kvm/include/riscv/processor.h tools/testing/selftests/kvm/lib/riscv/processor.c+5 -00 replies
5/5KVM: selftests: Enable pre_fault_memory_test for RISC-Vtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/include/riscv/processor.h+4 -00 replies

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by.

PatchNutty Liu
1/5
2/5
3/5
4/5R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 RESEND 0/5] KVM: riscv: Add KVM_PRE_FAULT_MEMORY support

Add RISC-V support for the generic KVM_PRE_FAULT_MEMORY ioctl.

Patch 1 and patch 2 fix existing G-stage huge-page corner cases. They are included first because the prefault hook relies on the map path reporting the mapping that actually covers the requested GPA.

Patch 3 adds the RISC-V arch hook for KVM_PRE_FAULT_MEMORY. Patch 4 adds Sv57 indexing support to the RISC-V KVM selftest helpers, and patch 5 enables the generic pre_fault_memory_test for RISC-V.

Patch 1 folds the previously posted standalone G-stage table overwrite fix into this series:

https://lore.kernel.org/kvm-riscv/[email protected]/T/#u

Changes in v4 resend:
- Resend the full series because the previous v4 send was interrupted and the kvm-riscv list archive did not show a complete thread. No code changes.

Changes in v4:
- Fold the standalone G-stage non-leaf overwrite fix into this series.
- Avoid THP adjustment when the original faulting GPA already has an existing 4K G-stage leaf.
- Return an error for HWPOISON instead of reporting success without a visible G-stage mapping. (Sashiko)

Changes in v3:
- Retry internally when the map path returns success without a visible G-stage mapping, instead of exposing -EAGAIN. (Sashiko)

Changes in v2:
- Drop the per-test guest_modes_append_default() call from pre_fault_memory_test.c. (Sean)

Jinyu Tang (5):
KVM: riscv: Avoid overwriting G-stage tables with huge leaves
KVM: riscv: Avoid THP adjustment for existing 4K G-stage leaves
KVM: riscv: Implement KVM_PRE_FAULT_MEMORY
KVM: selftests: Add RISC-V Sv57 page table indexing
KVM: selftests: Enable pre_fault_memory_test for RISC-V

 arch/riscv/kvm/Kconfig                        |  1 +
 arch/riscv/kvm/gstage.c                       |  9 ++
 arch/riscv/kvm/mmu.c                          | 83 ++++++++++++++++++-
 arch/riscv/kvm/vm.c                           |  1 +
 tools/testing/selftests/kvm/Makefile.kvm      |  1 +
 .../selftests/kvm/include/riscv/processor.h   |  6 ++
 .../selftests/kvm/lib/riscv/processor.c       |  2 +
 7 files changed, 100 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0