linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] iommu: Allow passing custom allocators to pgtable drivers
@ 2023-08-09 12:17 Boris Brezillon
  2023-08-09 12:17 ` [PATCH 1/2] " Boris Brezillon
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Boris Brezillon @ 2023-08-09 12:17 UTC (permalink / raw)
  To: Joerg Roedel, iommu, Will Deacon, Robin Murphy, linux-arm-kernel
  Cc: Rob Clark, Boris Brezillon

Hello,

This patchset is an attempt at making page table allocation
customizable. This is useful to some GPU drivers for various reasons:

- speed-up upcoming page table allocations by managing a pool of free
  pages
- batch page table allocation instead of allocating one page at a time
- pre-reserve pages for page tables needed for map/unmap operations and
  return the unused page tables to some pool

The first and last reasons are particularly important for GPU drivers
wanting to implement asynchronous VM_BIND. Asynchronous VM_BIND requires
that any page table needed for a map/unmap operation to succeed be
allocated at VM_BIND job creation time. At the time of the job creation,
we don't know what the VM will look like when we get to execute the
map/unmap, and can't guess how many page tables we will need. Because
of that, we have to over-provision page tables for the worst case
scenario (page table tree is empty), which means we will allocate/free
a lot. Having pool a pool of free pages is crucial if we want to
speed-up VM_BIND requests.

A real example of how such custom allocators can be used is available
here[1]. v2 of the Panthor driver is approaching submission, and I
figured I'd try to upstream the dependencies separately, which is
why I submit this series now, even though the user of this new API
will come afterwards. If you'd prefer to have those patches submitted
along with the Panthor driver, let me know.

This approach has been discussed with Robin, and is hopefully not too
far from what he had in mind.

Regards,

Boris

[1]https://gitlab.freedesktop.org/panfrost/linux/-/blob/panthor/drivers/gpu/drm/panthor/panthor_mmu.c#L441

Boris Brezillon (2):
  iommu: Allow passing custom allocators to pgtable drivers
  iommu: Extend LPAE page table format to support custom allocators

 drivers/iommu/io-pgtable-arm.c | 50 +++++++++++++++++++++++-----------
 drivers/iommu/io-pgtable.c     | 31 +++++++++++++++++++++
 include/linux/io-pgtable.h     | 21 ++++++++++++++
 3 files changed, 86 insertions(+), 16 deletions(-)

-- 
2.41.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2023-11-10  9:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-09 12:17 [PATCH 0/2] iommu: Allow passing custom allocators to pgtable drivers Boris Brezillon
2023-08-09 12:17 ` [PATCH 1/2] " Boris Brezillon
2023-08-09 12:17 ` [PATCH 2/2] iommu: Extend LPAE page table format to support custom allocators Boris Brezillon
2023-08-09 14:47   ` Will Deacon
2023-08-09 15:10     ` Boris Brezillon
2023-08-28 12:50       ` Boris Brezillon
2023-09-20 16:42   ` Robin Murphy
2023-11-10  9:52     ` Boris Brezillon
2023-09-20 13:12 ` [PATCH 0/2] iommu: Allow passing custom allocators to pgtable drivers Steven Price
2023-10-23 21:02   ` Rob Clark
2023-11-07 11:52     ` Gaurav Kohli
2023-11-07 12:01       ` Gaurav Kohli
2023-11-10  9:47       ` Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).