public inbox for linux-kselftest@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Revise the hwpt lifetime model
@ 2023-02-22 21:02 Jason Gunthorpe
  2023-02-22 21:02 ` [PATCH v2 1/7] iommufd: Assert devices_lock for iommufd_hw_pagetable_has_group() Jason Gunthorpe
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Jason Gunthorpe @ 2023-02-22 21:02 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 is a step toward the nesting and replace series.

I have this on github:

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

v2:
 - 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 (7):
  iommufd: Assert devices_lock for iommufd_hw_pagetable_has_group()
  iommufd: Add iommufd_lock_obj() around the auto-domains hwpts
  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: 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                | 150 +++++---------
 drivers/iommu/iommufd/hw_pagetable.c          |  72 ++++++-
 drivers/iommu/iommufd/iommufd_private.h       |  35 +++-
 drivers/iommu/iommufd/selftest.c              | 196 +++++++++++++++---
 tools/testing/selftests/iommu/iommufd.c       |  15 +-
 .../selftests/iommu/iommufd_fail_nth.c        |   8 -
 6 files changed, 319 insertions(+), 157 deletions(-)


base-commit: 8473685c99683f9e2c7e2a42ef3d3f14a79be274
-- 
2.39.1


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

end of thread, other threads:[~2023-02-24 18:19 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-22 21:02 [PATCH v2 0/7] Revise the hwpt lifetime model Jason Gunthorpe
2023-02-22 21:02 ` [PATCH v2 1/7] iommufd: Assert devices_lock for iommufd_hw_pagetable_has_group() Jason Gunthorpe
2023-02-22 21:02 ` [PATCH v2 2/7] iommufd: Add iommufd_lock_obj() around the auto-domains hwpts Jason Gunthorpe
2023-02-24  6:12   ` Tian, Kevin
2023-02-22 21:02 ` [PATCH v2 3/7] iommufd: Move ioas related HWPT destruction into iommufd_hw_pagetable_destroy() Jason Gunthorpe
2023-02-24  6:25   ` Tian, Kevin
2023-02-22 21:02 ` [PATCH v2 4/7] iommufd: Move iommufd_device to iommufd_private.h Jason Gunthorpe
2023-02-24  6:27   ` Tian, Kevin
2023-02-22 21:02 ` [PATCH v2 5/7] iommufd: Make iommufd_hw_pagetable_alloc() do iopt_table_add_domain() Jason Gunthorpe
2023-02-23  9:03   ` Tian, Kevin
2023-02-23 13:07     ` Jason Gunthorpe
2023-02-24  6:35   ` Tian, Kevin
2023-02-24 17:02     ` Jason Gunthorpe
2023-02-22 21:02 ` [PATCH v2 6/7] iommufd/selftest: Make selftest create a more complete mock device Jason Gunthorpe
2023-02-24  6:50   ` Tian, Kevin
2023-02-24 14:26     ` Jason Gunthorpe
2023-02-22 21:02 ` [PATCH v2 7/7] iommufd/selftest: Add a selftest for iommufd_device_attach() with a hwpt argument Jason Gunthorpe
2023-02-24  7:02   ` Tian, Kevin
2023-02-24 18:19     ` Jason Gunthorpe

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