Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH v3 00/12] Revise the hwpt lifetime model
@ 2023-03-01 19:30 Jason Gunthorpe
  2023-03-01 19:30 ` [PATCH v3 01/12] iommufd: Assert devices_lock for iommufd_hw_pagetable_has_group() Jason Gunthorpe
                   ` (12 more replies)
  0 siblings, 13 replies; 22+ messages in thread
From: Jason Gunthorpe @ 2023-03-01 19:30 UTC (permalink / raw)
  To: iommu, Kevin Tian, linux-kselftest, Shuah Khan; +Cc: Nicolin Chen, Yi Liu

As discussed here is a small series to address the confusing lifetime
scheme for the hwpt. This was some leftover from prior rework that was
never fully cleaned up.

Make it clear that the ioas and ioas->hwpt_list are associated with the
hwpt during creation and never changed until it is destroyed. A hwpt with
a positive reference count is always valid for device attachment.

This also improves the selftest handling of the mock domains so that we
can implement more testing for the hwpt model.

This is a step toward the nesting and replace series.

I have this on github:

https://github.com/jgunthorpe/linux/commits/iommufd_hwpt

v3:
 - Split patch to just make the hwpt_item handling consistent
 - Remove two confusing comments
 - Four new patches to clean up the confusing 'domain_id' in the selftest
v2: https://lore.kernel.org/r/0-v2-406f7ac07936+6a-iommufd_hwpt_jgg@nvidia.com
 - Basically completely different
 - Add a test for HWPT cases by enhancing the mock iommu driver to be more
   complete
 - Move the device attachment as well into iommufd_hw_pagetable_alloc()
   so destroy is more symmetric
v1: https://lore.kernel.org/r/0-v1-4336b5cb2fe4+1d7-iommufd_hwpt_jgg@nvidia.com

Jason Gunthorpe (12):
  iommufd: Assert devices_lock for iommufd_hw_pagetable_has_group()
  iommufd: Add iommufd_lock_obj() around the auto-domains hwpts
  iommufd: Consistently manage hwpt_item
  iommufd: Move ioas related HWPT destruction into
    iommufd_hw_pagetable_destroy()
  iommufd: Move iommufd_device to iommufd_private.h
  iommufd: Make iommufd_hw_pagetable_alloc() do iopt_table_add_domain()
  iommufd/selftest: Rename the sefltest 'device_id' to 'stdev_id'
  iommufd/selftest: Rename domain_id to stdev_id for FIXTURE
    iommufd_ioas
  iommufd/selftest: Rename domain_id to hwpt_id for FIXTURE
    iommufd_mock_domain
  iommufd/selftest: Rename the remaining mock device_id's to stdev_id
  iommufd/selftest: Make selftest create a more complete mock device
  iommufd/selftest: Add a selftest for iommufd_device_attach() with a
    hwpt argument

 drivers/iommu/iommufd/device.c                | 149 +++++--------
 drivers/iommu/iommufd/hw_pagetable.c          |  70 ++++++-
 drivers/iommu/iommufd/iommufd_private.h       |  35 +++-
 drivers/iommu/iommufd/iommufd_test.h          |   2 +-
 drivers/iommu/iommufd/selftest.c              | 198 +++++++++++++++---
 tools/testing/selftests/iommu/iommufd.c       |  68 +++---
 .../selftests/iommu/iommufd_fail_nth.c        |  38 ++--
 tools/testing/selftests/iommu/iommufd_utils.h |  16 +-
 8 files changed, 368 insertions(+), 208 deletions(-)


base-commit: 8473685c99683f9e2c7e2a42ef3d3f14a79be274
-- 
2.39.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2023-03-06 17:18 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-01 19:30 [PATCH v3 00/12] Revise the hwpt lifetime model Jason Gunthorpe
2023-03-01 19:30 ` [PATCH v3 01/12] iommufd: Assert devices_lock for iommufd_hw_pagetable_has_group() Jason Gunthorpe
2023-03-01 19:30 ` [PATCH v3 02/12] iommufd: Add iommufd_lock_obj() around the auto-domains hwpts Jason Gunthorpe
2023-03-01 19:30 ` [PATCH v3 03/12] iommufd: Consistently manage hwpt_item Jason Gunthorpe
2023-03-02  1:20   ` Tian, Kevin
2023-03-01 19:30 ` [PATCH v3 04/12] iommufd: Move ioas related HWPT destruction into iommufd_hw_pagetable_destroy() Jason Gunthorpe
2023-03-02  1:21   ` Tian, Kevin
2023-03-01 19:30 ` [PATCH v3 05/12] iommufd: Move iommufd_device to iommufd_private.h Jason Gunthorpe
2023-03-01 19:30 ` [PATCH v3 06/12] iommufd: Make iommufd_hw_pagetable_alloc() do iopt_table_add_domain() Jason Gunthorpe
2023-03-01 19:30 ` [PATCH v3 07/12] iommufd/selftest: Rename the sefltest 'device_id' to 'stdev_id' Jason Gunthorpe
2023-03-02  1:21   ` Tian, Kevin
2023-03-01 19:30 ` [PATCH v3 08/12] iommufd/selftest: Rename domain_id to stdev_id for FIXTURE iommufd_ioas Jason Gunthorpe
2023-03-02  1:23   ` Tian, Kevin
2023-03-06 14:50     ` Jason Gunthorpe
2023-03-01 19:30 ` [PATCH v3 09/12] iommufd/selftest: Rename domain_id to hwpt_id for FIXTURE iommufd_mock_domain Jason Gunthorpe
2023-03-02  1:24   ` Tian, Kevin
2023-03-01 19:30 ` [PATCH v3 10/12] iommufd/selftest: Rename the remaining mock device_id's to stdev_id Jason Gunthorpe
2023-03-02  1:25   ` Tian, Kevin
2023-03-01 19:30 ` [PATCH v3 11/12] iommufd/selftest: Make selftest create a more complete mock device Jason Gunthorpe
2023-03-01 19:30 ` [PATCH v3 12/12] iommufd/selftest: Add a selftest for iommufd_device_attach() with a hwpt argument Jason Gunthorpe
2023-03-02  1:26   ` Tian, Kevin
2023-03-06 17:16 ` [PATCH v3 00/12] Revise the hwpt lifetime model Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox