All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: increase 64-bit mmap_range size to 8TB
@ 2026-11-12 12:20 Matthew Auld
  2026-11-12 12:58 ` Christian König
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Matthew Auld @ 2026-11-12 12:20 UTC (permalink / raw)
  To: intel-xe
  Cc: dri-devel, Thomas Hellström, Christian König,
	Matthew Brost

Every GEM/TTM buffer object, including imported dma-bufs, allocates a
fake mmap offset from the per-device drm_vma_offset_manager. On multi-GPU
systems with large VRAM, peer-to-peer dma-buf imports across devices and
processes can exhaust the current 1 TiB 64-bit range and fail BO creation
or PRIME import with -ENOSPC. Skipping mmap offset allocation for
imported sg buffers is not straightforward without risking userspace
regressions, as existing userspace (such as Intel compute-runtime) still
queries mmap_offset on imported host dma-bufs even when mapping the
dma-buf fd directly.

Increase DRM_FILE_PAGE_OFFSET_SIZE on 64-bit kernels so the fake offset
range spans up to 8 TiB (SZ_8T). This stays strictly below panthor's
DRM_PANTHOR_USER_MMIO_OFFSET_32BIT (1ULL << 43) carveout and within
32-bit compat mmap2's pgoff limit (16 TiB with 4K pages).

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Matthew Brost <matthew.brost@intel.com>
---
 include/drm/drm_vma_manager.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/include/drm/drm_vma_manager.h b/include/drm/drm_vma_manager.h
index 6c2a2f21dbf0..2c3233f9dec4 100644
--- a/include/drm/drm_vma_manager.h
+++ b/include/drm/drm_vma_manager.h
@@ -26,16 +26,23 @@
 #include <drm/drm_mm.h>
 #include <linux/mm.h>
 #include <linux/rbtree.h>
+#include <linux/sizes.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
 
-/* We make up offsets for buffer objects so we can recognize them at
+/*
+ * We make up offsets for buffer objects so we can recognize them at
  * mmap time. pgoff in mmap is an unsigned long, so we need to make sure
- * that the faked up offset will fit
+ * that the faked up offset will fit.
+ *
+ * On 64-bit, cap the range at 8 TiB (SZ_8T) so offsets remain below both
+ * panthor's DRM_PANTHOR_USER_MMIO_OFFSET_32BIT (1ULL << 43) and 32-bit
+ * compat mmap2's pgoff ceiling (16 TiB with 4K pages).
  */
 #if BITS_PER_LONG == 64
 #define DRM_FILE_PAGE_OFFSET_START ((0xFFFFFFFFUL >> PAGE_SHIFT) + 1)
-#define DRM_FILE_PAGE_OFFSET_SIZE ((0xFFFFFFFFUL >> PAGE_SHIFT) * 256)
+#define DRM_FILE_PAGE_OFFSET_SIZE ((SZ_8T >> PAGE_SHIFT) - \
+				   DRM_FILE_PAGE_OFFSET_START)
 #else
 #define DRM_FILE_PAGE_OFFSET_START ((0xFFFFFFFUL >> PAGE_SHIFT) + 1)
 #define DRM_FILE_PAGE_OFFSET_SIZE ((0xFFFFFFFUL >> PAGE_SHIFT) * 16)
-- 
2.56.0


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

end of thread, other threads:[~2026-11-13 15:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 12:20 [PATCH] drm: increase 64-bit mmap_range size to 8TB Matthew Auld
2026-11-12 12:58 ` Christian König
2026-11-13 15:09   ` Matthew Brost
2026-11-12 12:59 ` ✓ CI.KUnit: success for " Patchwork
2026-11-12 13:33 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-12 20:45 ` ✓ Xe.CI.FULL: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.