Skip to content

RFC KVM: gmem: Implement error_remove_page

[email protected] kvm linux-coco lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6KVM: guest_memfd: Add config to show the capability to handle error pagevirt/kvm/Kconfig virt/kvm/guest_mem.c+6 -01 reply
2/6KVM: guestmem_fd: Make error_remove_page callback to unmap guest memoryinclude/linux/kvm_host.h virt/kvm/guest_mem.c+34 -151 reply
3/6KVM: guest_memfd, x86: MEMORY_FAULT exit with hw poisoned pagearch/x86/kvm/mmu/mmu.c include/uapi/linux/kvm.h virt/kvm/guest_mem.c+20 -81 reply
4/6KVM: guest_memfd: Implemnet bmap inode operationvirt/kvm/Kconfig virt/kvm/guest_mem.c+32 -01 reply
5/6KVM: selftests: Add selftest for guest_memfd() fibmaptools/testing/selftests/kvm/guest_memfd_test.c+45 -00 replies
6/6KVM: X86: Allow KVM gmem hwpoison test casesarch/x86/kvm/Kconfig+2 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC PATCH 0/6] KVM: gmem: Implement error_remove_page

From: Isaku Yamahata <[email protected]>

This patch series is to share my progress on the KVM gmem error_remove_page task. Although I'm still working on test cases, I don't want to hold the patches locally until I finish test cases.

- Update error_remove_page method. Unmap gfn on poisoned pages. Pass related arguments. Unfortunately, the error_remove_page callback is passed struct page. So the callback can't know about the actual poisoned address and range. The memory poisoning would be based on cache line size, though.
- Add a new flag to KVM_EXIT_MEMORY_FAULT to indicate the page is poisoned.
- Add check in faultin_pfn_private. When the page is poisoned, KVM_EXIT_MEMORY_FAULT(HWPOISON).
- Only test case for ioctl(FIBMAP). Test cases are TODO.

TODOs
- Implement test cases to inject HWPOISON or MCE by hwpoison (/sys/kernel/debug/hwpoison/corrupt-pfn) or MCE injection (/sys/kernel/debug/mce-inject).
- Update qemu to handle KVM_EXIT_MEMORY_FAULT(HWPOISON)
- Update TDX KVM to handle it and Add test cases for TDX.
- Try to inject HWPOISON as soon as the poison is detected.

Isaku Yamahata (6):
KVM: guest_memfd: Add config to show the capability to handle error
page
KVM: guestmem_fd: Make error_remove_page callback to unmap guest
memory
KVM: guest_memfd, x86: MEMORY_FAULT exit with hw poisoned page
KVM: guest_memfd: Implemnet bmap inode operation
KVM: selftests: Add selftest for guest_memfd() fibmap
KVM: X86: Allow KVM gmem hwpoison test cases

 arch/x86/kvm/Kconfig                          |  2 +
 arch/x86/kvm/mmu/mmu.c                        | 21 +++--
 include/linux/kvm_host.h                      |  2 +
 include/uapi/linux/kvm.h                      |  3 +-
 .../testing/selftests/kvm/guest_memfd_test.c  | 45 ++++++++++
 virt/kvm/Kconfig                              |  7 ++
 virt/kvm/guest_mem.c                          | 82 +++++++++++++++----
 7 files changed, 139 insertions(+), 23 deletions(-)

base-commit: a5accd8596fa84b9fe00076444b5ef628d2351b9

Signature · 1 line
2.25.1