Skip to contentSkip to conversation

running iommufd self tests

DISCUSSION Steven Sistare 2 participants 4 messages Sep 20, 2024 – Sep 23, 2024

lore
Share & tools
lore
#0 lore raw

What userland setup steps are necessary to run the iommufd tests?

I build a 6.11.0 kernel with:
CONFIG_IOMMUFD=m
CONFIG_IOMMUFD_TEST=y
CONFIG_DEBUG_KERNEL=y
CONFIG_FAULT_INJECTION=y
CONFIG_RUNTIME_TESTING_MENU=y

and make the tool:
make TARGETS=iommu -C tools/testing/selftests

and try one test:
modprobe iommufd
iommufd -r iommufd_mock_domain.one_domain.basic
FAIL

It fails in ioctl(IOMMU_TEST_CMD) creating the mock domain:

iommufd_test_mock_domain()

    iommufd_object_alloc()
    mock_dev_create()
      device_initialize()
      dev_set_name()
      device_add()
    iommufd_device_bind()
      device_iommu_capable()
        dev_has_iommu()  <-- false because dev->iommu == NULL , so fails

I suspect I am missing some configuration steps related to the iommufd_selftest_iommu device, but I cannot find any documentation.

- Steve

#1 lore raw
Quoted 29 lines · Steven Sistare

What userland setup steps are necessary to run the iommufd tests?

I build a 6.11.0 kernel with:
  CONFIG_IOMMUFD=m
  CONFIG_IOMMUFD_TEST=y
  CONFIG_DEBUG_KERNEL=y
  CONFIG_FAULT_INJECTION=y
  CONFIG_RUNTIME_TESTING_MENU=y

and make the tool:
  make TARGETS=iommu -C tools/testing/selftests

and try one test:
  modprobe iommufd
  iommufd -r iommufd_mock_domain.one_domain.basic FAIL

It fails in ioctl(IOMMU_TEST_CMD) creating the mock domain:

  iommufd_test_mock_domain()
    iommufd_object_alloc()
    mock_dev_create()
      device_initialize()
      dev_set_name()
      device_add()
    iommufd_device_bind()
      device_iommu_capable()
        dev_has_iommu()  <-- false because dev->iommu == NULL , so fails

Quoted 2 lines

I suspect I am missing some configuration steps related to the iommufd_selftest_iommu device, but I cannot find any documentation.

As far as I know, iommufd selftest is broken for now. Baolu has a patch to fix it [1], and I had a test patch [2] based on it as well in my testing. It’s originated from Baolu’s patch.

[1] https://lore.kernel.org/linux-iommu/[email protected]/
[2] https://github.com/yiliu1765/iommufd/commit/2af6b607c28e8d86f73f2390c954b5953651da60

Regards
Yi Liu

Signature · 2 lines
Regards,
Yi Liu
#2 lore raw
Quoted 33 lines · Yi Liu
Quoted 29 lines · Steven Sistare

What userland setup steps are necessary to run the iommufd tests?

I build a 6.11.0 kernel with:
   CONFIG_IOMMUFD=m
   CONFIG_IOMMUFD_TEST=y
   CONFIG_DEBUG_KERNEL=y
   CONFIG_FAULT_INJECTION=y
   CONFIG_RUNTIME_TESTING_MENU=y

and make the tool:
   make TARGETS=iommu -C tools/testing/selftests

and try one test:
   modprobe iommufd
   iommufd -r iommufd_mock_domain.one_domain.basic FAIL

It fails in ioctl(IOMMU_TEST_CMD) creating the mock domain:

   iommufd_test_mock_domain()
     iommufd_object_alloc()
     mock_dev_create()
       device_initialize()
       dev_set_name()
       device_add()
     iommufd_device_bind()
       device_iommu_capable()
         dev_has_iommu()  <-- false because dev->iommu == NULL , so fails

Quoted 2 lines

I suspect I am missing some configuration steps related to the iommufd_selftest_iommu device, but I cannot find any documentation.

Quoted 6 lines

As far as I know, iommufd selftest is broken for now. Baolu has a patch to fix it [1], and I had a test patch [2] based on it as well in my testing. It’s originated from Baolu’s patch.

[1] https://lore.kernel.org/linux-iommu/[email protected]/
[2] https://github.com/yiliu1765/iommufd/commit/2af6b607c28e8d86f73f2390c954b5953651da60

correct the link for [2] :)

[2] https://github.com/yiliu1765/iommufd/commit/ff0772d155c1ae2841e7b7ff0d7ca889271b81b2

Signature · 2 lines
Regards,
Yi Liu
#3 lore raw
Quoted 38 lines · Yi Liu
Quoted 37 lines · Yi Liu
Quoted 29 lines · Steven Sistare

What userland setup steps are necessary to run the iommufd tests?

I build a 6.11.0 kernel with:
   CONFIG_IOMMUFD=m
   CONFIG_IOMMUFD_TEST=y
   CONFIG_DEBUG_KERNEL=y
   CONFIG_FAULT_INJECTION=y
   CONFIG_RUNTIME_TESTING_MENU=y

and make the tool:
   make TARGETS=iommu -C tools/testing/selftests

and try one test:
   modprobe iommufd
   iommufd -r iommufd_mock_domain.one_domain.basic FAIL

It fails in ioctl(IOMMU_TEST_CMD) creating the mock domain:

   iommufd_test_mock_domain()
     iommufd_object_alloc()
     mock_dev_create()
       device_initialize()
       dev_set_name()
       device_add()
     iommufd_device_bind()
       device_iommu_capable()
         dev_has_iommu()  <-- false because dev->iommu == NULL , so fails

Quoted 2 lines

I suspect I am missing some configuration steps related to the iommufd_selftest_iommu device, but I cannot find any documentation.

As far as I know, iommufd selftest is broken for now. Baolu has a patch to fix it [1], and I had a test patch [2] based on it as well in my testing. It’s originated from Baolu’s patch.

Quoted 6 lines
Quoted 2 lines

[1] https://lore.kernel.org/linux-iommu/[email protected]/
[2] https://github.com/yiliu1765/iommufd/commit/2af6b607c28e8d86f73f2390c954b5953651da60

correct the link for [2] :)

[2] https://github.com/yiliu1765/iommufd/commit/ff0772d155c1ae2841e7b7ff0d7ca889271b81b2

Thank you! This corrected link applies to 6.11.0 and does the trick.

- Steve