public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/7] Introduce sparse DRM shmem object allocations
@ 2025-02-18 23:25 Adrián Larumbe
  2025-02-18 23:25 ` [RFC PATCH 1/7] shmem: Introduce non-blocking allocation of shmem pages Adrián Larumbe
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Adrián Larumbe @ 2025-02-18 23:25 UTC (permalink / raw)
  To: dri-devel, linux-kernel, Boris Brezillon, Steven Price,
	Rob Herring
  Cc: kernel, Adrián Larumbe

This patch series is a proposal for implementing sparse page allocations
for shmem objects. It was initially motivated by a kind of BO managed by
the Panfrost driver, the tiler heap, which grows on demand every time the
GPU faults on a virtual address within its drm_mm-managed ranged.

Because keeping a struct page pointer array that can describe the entire
virtual range is wasteful when only a few backing pages have been
allocated, at Collabora we thought a sparse allocation approach with
xarrays was a more efficient choice.

Since sparse and 'dense' DRM shmem objects must be managed slightly
differently, the API is expanded to allow client drivers to create sparse
objects and also to expand their page backing range, but everything else
should remain as transparent as possible and be handled from within the DRM
shmem system itself.

Another side feature that was introduced in this patch series is an shmem
helper for non-blocking allocation of pages. This is motivated by the desire
to avoid deadlocks with the shrinker.

Adrián Larumbe (7):
  shmem: Introduce non-blocking allocation of shmem pages
  lib/scatterlist.c: Support constructing sgt from page xarray
  drm/prime: Let drm_prime_pages_to_sg use the page_array interface
  drm/shmem: Introduce the notion of sparse objects
  drm/shmem: Implement sparse allocation of pages for shmem objects
  drm/panfrost: Use shmem sparse allocation for heap BOs
  drm/panfrost/panthor: Take sparse objects into account for fdinfo

 drivers/gpu/drm/drm_gem.c               |  32 +++++
 drivers/gpu/drm/drm_gem_shmem_helper.c  | 163 ++++++++++++++++++++++--
 drivers/gpu/drm/drm_prime.c             |   7 +-
 drivers/gpu/drm/panfrost/panfrost_gem.c |  16 ++-
 drivers/gpu/drm/panfrost/panfrost_gem.h |   2 +-
 drivers/gpu/drm/panfrost/panfrost_mmu.c |  85 +++---------
 drivers/gpu/drm/panthor/panthor_gem.c   |   4 +-
 include/drm/drm_gem.h                   |   3 +
 include/drm/drm_gem_shmem_helper.h      |  30 ++++-
 include/linux/scatterlist.h             |  47 +++++++
 include/linux/shmem_fs.h                |   7 +
 lib/scatterlist.c                       | 128 +++++++++++++++++++
 12 files changed, 435 insertions(+), 89 deletions(-)


base-commit: 4fd6ca90fc7f509977585d39885f21b2911123f3
--
2.47.1

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

end of thread, other threads:[~2025-02-25 15:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-18 23:25 [RFC PATCH 0/7] Introduce sparse DRM shmem object allocations Adrián Larumbe
2025-02-18 23:25 ` [RFC PATCH 1/7] shmem: Introduce non-blocking allocation of shmem pages Adrián Larumbe
2025-02-25 12:43   ` Boris Brezillon
2025-02-18 23:25 ` [RFC PATCH 2/7] lib/scatterlist.c: Support constructing sgt from page xarray Adrián Larumbe
2025-02-25 12:57   ` Boris Brezillon
2025-02-18 23:25 ` [RFC PATCH 3/7] drm/prime: Let drm_prime_pages_to_sg use the page_array interface Adrián Larumbe
2025-02-18 23:25 ` [RFC PATCH 4/7] drm/shmem: Introduce the notion of sparse objects Adrián Larumbe
2025-02-25 13:28   ` Boris Brezillon
2025-02-18 23:25 ` [RFC PATCH 5/7] drm/shmem: Implement sparse allocation of pages for shmem objects Adrián Larumbe
2025-02-25 14:39   ` Boris Brezillon
2025-02-18 23:25 ` [RFC PATCH 6/7] drm/panfrost: Use shmem sparse allocation for heap BOs Adrián Larumbe
2025-02-25 15:04   ` Boris Brezillon
2025-02-18 23:25 ` [RFC PATCH 7/7] drm/panfrost/panthor: Take sparse objects into account for fdinfo Adrián Larumbe
2025-02-25 15:09   ` Boris Brezillon

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