mbox series

[RFC,v2,0/3] KVM: allow mapping of compound tail pages for IO or PFNMAP mapping

Message ID 20240103084327.19955-1-yan.y.zhao@intel.com
Headers show
Series KVM: allow mapping of compound tail pages for IO or PFNMAP mapping | expand

Message

Yan Zhao Jan. 3, 2024, 8:43 a.m. UTC
This is a v2 for previous series [1] to allow mapping for compound tail
pages for IO or PFNMAP mapping.

Compared to v1, this version provides selftest to check functionality in
KVM to map memslots for MMIO BARs (VMAs with flag VM_IO | VM_PFNMAP), as
requested by Sean in [1].

The selftest can also be used to test series "allow mapping non-refcounted
pages" [2].

Tag RFC is added because a test driver is introduced in patch 2, which is
new to KVM selftest, and test "set_memory_region_io" in patch 3 depends on
that the test driver is compiled and loaded in kernel.
Besides, patch 3 calls vm_set_user_memory_region() directly without
modifying vm_mem_add().
So, this series is sent to ensure the main direction is right.

Thanks
Yan

[1] https://lore.kernel.org/all/20230719083332.4584-1-yan.y.zhao@intel.com/
[2] https://lore.kernel.org/all/20230911021637.1941096-1-stevensd@google.com/

v2:
added patch 2 and 3 to do selftest for patch 1 (Sean).

Yan Zhao (3):
  KVM: allow mapping of compound tail pages for IO or PFNMAP mapping
  KVM: selftests: add selftest driver for KVM to test memory slots for
    MMIO BARs
  KVM: selftests: Add set_memory_region_io to test memslots for MMIO
    BARs

 lib/Kconfig.debug                             |  14 +
 lib/Makefile                                  |   1 +
 lib/test_kvm_mock_device.c                    | 281 ++++++++++++++++++
 lib/test_kvm_mock_device_uapi.h               |  16 +
 tools/testing/selftests/kvm/Makefile          |   1 +
 .../selftests/kvm/set_memory_region_io.c      | 188 ++++++++++++
 virt/kvm/kvm_main.c                           |   2 +-
 7 files changed, 502 insertions(+), 1 deletion(-)
 create mode 100644 lib/test_kvm_mock_device.c
 create mode 100644 lib/test_kvm_mock_device_uapi.h
 create mode 100644 tools/testing/selftests/kvm/set_memory_region_io.c


base-commit: 8ed26ab8d59111c2f7b86d200d1eb97d2a458fd1

Comments

Sean Christopherson Feb. 13, 2024, 3:07 a.m. UTC | #1
On Wed, Jan 03, 2024, Yan Zhao wrote:
> This is a v2 for previous series [1] to allow mapping for compound tail
> pages for IO or PFNMAP mapping.
> 
> Compared to v1, this version provides selftest to check functionality in
> KVM to map memslots for MMIO BARs (VMAs with flag VM_IO | VM_PFNMAP), as
> requested by Sean in [1].

Doh.  So I didn't intend for you to have to create a mock device just to be able
to run a selftest.  I assumed it would be easy-ish to utilize an existing generic
device.  I take it that's not the case?