drm: Reduce page tables overhead with THP
Subsystems (8)
v13 cover drm: Reduce page tables overhead with THP
This series aims to reduce the page tables overhead of DRM drivers for builds with CONFIG_TRANSPARENT_HUGEPAGE enabled and either the sysfs knob '/sys/kernel/mm/transparent_hugepage/shmem_enabled' appropriately set or drivers using a dedicated huge tmpfs mount point.
It starts by checking whether a faulty address in the page fault handler is part of a huge page in order to attempt a PMD sized PFN insertion into the VMA. It then introduces a dedicated get_unmapped_area file operation on the DRM file descriptor for GEM objects to get the best virtual address alignment for the underlying shmem buffers.
The remaining commits propose shmem helpers to create and release huge tmpfs mount points and adapt the i915 and V3D drivers. The helpers are then used to optionally enable Transparent Hugepage for Panfrost and Panthor.
For Panthor on a Rock 5B, this series makes the first memcpy() to an entire BO object mapped in userspace about twice as fast with Transparent Hugepage enabled.
Implementing a fault-around handler using the arm64 contiguous page hint (contptes) could also greatly help reduce page tables overhead for small pages by mapping several contiguous pages around a faulty address at once. This will be proposed in another patch series.
Loïc Molinari (10):
drm/shmem-helper: Simplify page offset calculation in fault handler drm/shmem-helper: Map huge pages in fault handler drm/gem: Introduce drm_gem_get_unmapped_area() fop drm/gem: Add huge tmpfs mountpoint helpers
drm/i915: Use huge tmpfs mountpoint helpers
drm/v3d: Use huge tmpfs mountpoint helpers
drm/gem: Get rid of *_with_mnt helpers
drm/panthor: Introduce huge tmpfs mountpoint option drm/panfrost: Introduce huge tmpfs mountpoint option Documentation/gpu/drm-mm: Add THP paragraph to GEM mapping section
Documentation/gpu/drm-mm.rst | 29 ++- drivers/gpu/drm/drm_gem.c | 202 +++++++++++++----- drivers/gpu/drm/drm_gem_shmem_helper.c | 77 +++---- drivers/gpu/drm/i915/Makefile | 3 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 9 +- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 58 +++-- drivers/gpu/drm/i915/gem/i915_gemfs.c | 71 ------ drivers/gpu/drm/i915/gem/i915_gemfs.h | 14 -- .../gpu/drm/i915/gem/selftests/huge_pages.c | 15 +- drivers/gpu/drm/i915/i915_drv.h | 5 - drivers/gpu/drm/panfrost/panfrost_device.c | 3 + drivers/gpu/drm/panfrost/panfrost_drv.c | 6 + drivers/gpu/drm/panfrost/panfrost_drv.h | 9 + drivers/gpu/drm/panfrost/panfrost_gem.c | 18 ++ drivers/gpu/drm/panfrost/panfrost_gem.h | 2 + drivers/gpu/drm/panthor/panthor_device.c | 3 + drivers/gpu/drm/panthor/panthor_drv.c | 7 + drivers/gpu/drm/panthor/panthor_drv.h | 9 + drivers/gpu/drm/panthor/panthor_gem.c | 18 ++ drivers/gpu/drm/panthor/panthor_gem.h | 2 + drivers/gpu/drm/v3d/Makefile | 3 +- drivers/gpu/drm/v3d/v3d_bo.c | 6 +- drivers/gpu/drm/v3d/v3d_drv.c | 2 +- drivers/gpu/drm/v3d/v3d_drv.h | 11 +- drivers/gpu/drm/v3d/v3d_gem.c | 21 +- drivers/gpu/drm/v3d/v3d_gemfs.c | 62 ------ include/drm/drm_device.h | 15 ++ include/drm/drm_gem.h | 40 +++- include/drm/drm_gem_shmem_helper.h | 3 - 29 files changed, 420 insertions(+), 303 deletions(-) delete mode 100644 drivers/gpu/drm/i915/gem/i915_gemfs.c delete mode 100644 drivers/gpu/drm/i915/gem/i915_gemfs.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_drv.h create mode 100644 drivers/gpu/drm/panthor/panthor_drv.h delete mode 100644 drivers/gpu/drm/v3d/v3d_gemfs.c
Signature · 1 line
2.47.3
PATCH v13 1/10 drm/shmem-helper: Simplify page offset calculation in fault handler
For a fault at address addr, the page offset is
page_offset = (vmf->address - vma->vm_start) >> PAGE_SHIFT
= ((addr & PAGE_MASK) - vma->vm_start) >> PAGE_SHIFT = (addr - vma->vm_start) >> PAGE_SHIFT
Since the faulty logical page offset based on VMA is
vmf->pgoff = vma->vm_pgoff + ((addr - vma->vm_start) >> PAGE_SHIFT)
We can slightly simplify the calculation using
page_offset = vmf->pgoff - vma->vm_pgoff
v11:
- remove misleading comment
- add Boris R-b
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_gem_shmem_helper.c +2 -2
@@ -577,8 +577,8 @@ static vm_fault_t drm_gem_shmem_fault(struct vm_fault *vmf)struct page *page;pgoff_t page_offset; -/* We don't use vmf->pgoff since that has the fake offset */ - page_offset = (vmf->address - vma->vm_start) >>PAGE_SHIFT ; +/* Offset to faulty address in the VMA. */ + page_offset = vmf->pgoff - vma->vm_pgoff;dma_resv_lock (shmem->base.resv,NULL );
Signature · 1 line
2.47.3
PATCH v13 2/10 drm/shmem-helper: Map huge pages in fault handler
In reply to Loïc MolinariAttempt a PMD sized PFN insertion into the VMA if the faulty address of the fault handler is part of a huge page.
On builds with CONFIG_TRANSPARENT_HUGEPAGE enabled, if the mmap() user address is PMD size aligned, if the GEM object is backed by shmem buffers on mountpoints setting the 'huge=' option and if the shmem backing store manages to allocate a huge folio, CPU mapping would then benefit from significantly increased memcpy() performance. When these conditions are met on a system with 2 MiB huge pages, an aligned copy of 2 MiB would raise a single page fault instead of 4096.
v4:
- implement map_pages instead of huge_fault
v6:
- get rid of map_pages handler for now (keep it for another series along with arm64 contpte support)
v11:
- remove page fault validity check helper
- rename drm_gem_shmem_map_pmd() to drm_gem_shmem_try_map_pmd()
- add Boris R-b
v12:
- move up ret var decl in fault handler to minimize diff
--- drivers/gpu/drm/drm_gem_shmem_helper.c | 35 +++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_gem_shmem_helper.c +31 -4
@@ -567,6 +567,26 @@ int drm_gem_shmem_dumb_create(struct drm_file *file, struct drm_device *dev, }EXPORT_SYMBOL_GPL (drm_gem_shmem_dumb_create); +static bool drm_gem_shmem_try_map_pmd (struct vm_fault *vmf,unsigned long addr, +struct page *page) +{ +#ifdef CONFIG_ARCH_SUPPORTS_PMD_PFNMAP +unsigned long pfn =page_to_pfn (page); +unsigned long paddr = pfn <<PAGE_SHIFT ; +bool aligned = (addr & ~PMD_MASK ) == (paddr & ~PMD_MASK ); + +if (aligned && +pmd_none (*vmf->pmd) && +folio_test_pmd_mappable (page_folio (page))) { + pfn &=PMD_MASK >>PAGE_SHIFT ; +if (vmf_insert_pfn_pmd (vmf, pfn, false) ==VM_FAULT_NOPAGE ) +return true; + } +#endif + +return false; +} +static vm_fault_t drm_gem_shmem_fault (struct vm_fault *vmf) {struct vm_area_struct *vma = vmf->vma;
@@ -574,8 +594,9 @@ static vm_fault_t drm_gem_shmem_fault(struct vm_fault *vmf)struct drm_gem_shmem_object *shmem =to_drm_gem_shmem_obj (obj);loff_t num_pages = obj->size >>PAGE_SHIFT ;vm_fault_t ret; -struct page *page; +struct page **pages = shmem->pages;pgoff_t page_offset; +unsigned long pfn;/* Offset to faulty address in the VMA. */ page_offset = vmf->pgoff - vma->vm_pgoff;
@@ -586,12 +607,18 @@ static vm_fault_t drm_gem_shmem_fault(struct vm_fault *vmf) drm_WARN_ON_ONCE(obj->dev, !shmem->pages) || shmem->madv < 0) { ret =VM_FAULT_SIGBUS ; - } else { - page = shmem->pages[page_offset]; + goto out; + } - ret =vmf_insert_pfn (vma, vmf->address,page_to_pfn (page)); +if (drm_gem_shmem_try_map_pmd (vmf, vmf->address, pages[page_offset])) { + ret =VM_FAULT_NOPAGE ; + goto out; } + pfn =page_to_pfn (pages[page_offset]); + ret =vmf_insert_pfn (vma, vmf->address, pfn); + + out:dma_resv_unlock (shmem->base.resv);return ret;
Signature · 1 line
2.47.3
PATCH v13 3/10 drm/gem: Introduce drm_gem_get_unmapped_area() fop
In reply to Loïc Molinarimmap() calls on the DRM file pointer currently always end up using mm_get_unmapped_area() to get a free mapping region. On builds with CONFIG_TRANSPARENT_HUGEPAGE enabled, this isn't ideal for GEM objects backed by shmem buffers on mountpoints setting the 'huge=' option because it can't correctly figure out the potentially huge address alignment required.
This commit introduces the drm_gem_get_unmapped_area() function which is meant to be used as a get_unmapped_area file operation on the DRM file pointer to lookup GEM objects based on their fake offsets and get a properly aligned region by calling shmem_get_unmapped_area() with the right file pointer. If a GEM object isn't available at the given offset or if the caller isn't granted access to it, the function falls back to mm_get_unmapped_area().
This also makes drm_gem_get_unmapped_area() part of the default GEM file operations so that all the DRM drivers can benefit from more efficient mappings thanks to the huge page fault handler introduced in previous commit 'drm/shmem-helper: Add huge page fault handler'.
The shmem_get_unmapped_area() function needs to be exported so that it can be used from the DRM subsystem.
v3:
- include <linux/sched/mm.h> in drm_gem.c
- forward to shmem layer in builds with CONFIG_TRANSPARENT_HUGEPAGE=n
v6:
- use GPL variant to export drm_gem_get_unmapped_area()
- don't export shmem_get_unmapped_area() anymore (use f_op instead)
v11:
- rename drm_gem_object_lookup_from_offset() to
drm_gem_object_lookup_at_offset()
- add Boris R-b
--- drivers/gpu/drm/drm_gem.c | 108 ++++++++++++++++++++++++++++++-------- include/drm/drm_gem.h | 4 ++ 2 files changed, 90 insertions(+), 22 deletions(-)
drivers/gpu/drm/drm_gem.c +86 -22
@@ -36,6 +36,7 @@#include <linux/module.h> #include <linux/pagemap.h> #include <linux/pagevec.h> +#include <linux/sched/mm.h> #include <linux/shmem_fs.h> #include <linux/slab.h> #include <linux/string_helpers.h>
@@ -1177,36 +1178,27 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size, }EXPORT_SYMBOL (drm_gem_mmap_obj); -/** -* drm_gem_mmap - memory map routine for GEM objects -* @filp: DRM file pointer -* @vma: VMA for the area to be mapped -* -* If a driver supports GEM object mapping, mmap calls on the DRM file -* descriptor will end up here. -* -* Look up the GEM object based on the offset passed in (vma->vm_pgoff will -* contain the fake offset we created when the GTT map ioctl was called on -* the object) and map it with a call to drm_gem_mmap_obj(). -* -* If the caller is not granted access to the buffer object, the mmap will fail -* with EACCES. Please see the vma manager for more information. +/* +* Look up a GEM object in offset space based on the exact start address. The +* caller must be granted access to the object. Returns a GEM object on success +* or a negative error code on failure. The returned GEM object needs to be +* released with drm_gem_object_put(). */ -int drm_gem_mmap (struct file *filp,struct vm_area_struct *vma) +static struct drm_gem_object * +drm_gem_object_lookup_at_offset (struct file *filp,unsigned long start, +unsigned long pages) {struct drm_file *priv = filp->private_data;struct drm_device *dev = priv->minor->dev;struct drm_gem_object *obj =NULL ;struct drm_vma_offset_node *node; -int ret;if (drm_dev_is_unplugged (dev)) -return -ENODEV ; +return ERR_PTR (-ENODEV );drm_vma_offset_lock_lookup (dev->vma_offset_manager); node =drm_vma_offset_exact_lookup_locked (dev->vma_offset_manager, - vma->vm_pgoff, -vma_pages (vma)); + start, pages);if (likely (node)) { obj = container_of(node, struct drm_gem_object, vma_node);/*
@@ -1225,14 +1217,86 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)drm_vma_offset_unlock_lookup (dev->vma_offset_manager);if (!obj) -return -EINVAL ; +return ERR_PTR (-EINVAL );if (!drm_vma_node_is_allowed (node, priv)) {drm_gem_object_put (obj); -return -EACCES ; +return ERR_PTR (-EACCES ); } - ret =drm_gem_mmap_obj (obj,drm_vma_node_size (node) <<PAGE_SHIFT , +return obj; +} + +/** +* drm_gem_get_unmapped_area - get memory mapping region routine for GEM objects +* @filp: DRM file pointer +* @uaddr: User address hint +* @len: Mapping length +* @pgoff: Offset (in pages) +* @flags: Mapping flags +* +* If a driver supports GEM object mapping, before ending up in drm_gem_mmap(), +* mmap calls on the DRM file descriptor will first try to find a free linear +* address space large enough for a mapping. Since GEM objects are backed by +* shmem buffers, this should preferably be handled by the shmem virtual memory +* filesystem which can appropriately align addresses to huge page sizes when +* needed. +* +* Look up the GEM object based on the offset passed in (vma->vm_pgoff will +* contain the fake offset we created) and call shmem_get_unmapped_area() with +* the right file pointer. +* +* If a GEM object is not available at the given offset or if the caller is not +* granted access to it, fall back to mm_get_unmapped_area(). +*/ +unsigned long drm_gem_get_unmapped_area (struct file *filp,unsigned long uaddr, +unsigned long len,unsigned long pgoff, +unsigned long flags) +{ +struct drm_gem_object *obj; +unsigned long ret; + + obj =drm_gem_object_lookup_at_offset (filp, pgoff, len >>PAGE_SHIFT ); +if (IS_ERR (obj) || !obj->filp || !obj->filp->f_op->get_unmapped_area) +return mm_get_unmapped_area (current->mm, filp, uaddr, len,0 , + flags); + + ret = obj->filp->f_op->get_unmapped_area (obj->filp, uaddr, len,0 , + flags); + +drm_gem_object_put (obj); + +return ret; +} +EXPORT_SYMBOL_GPL (drm_gem_get_unmapped_area); + +/** +* drm_gem_mmap - memory map routine for GEM objects +* @filp: DRM file pointer +* @vma: VMA for the area to be mapped +* +* If a driver supports GEM object mapping, mmap calls on the DRM file +* descriptor will end up here. +* +* Look up the GEM object based on the offset passed in (vma->vm_pgoff will +* contain the fake offset we created) and map it with a call to +* drm_gem_mmap_obj(). +* +* If the caller is not granted access to the buffer object, the mmap will fail +* with EACCES. Please see the vma manager for more information. +*/ +int drm_gem_mmap (struct file *filp,struct vm_area_struct *vma) +{ +struct drm_gem_object *obj; +int ret; + + obj =drm_gem_object_lookup_at_offset (filp, vma->vm_pgoff, +vma_pages (vma)); +if (IS_ERR (obj)) +return PTR_ERR (obj); + + ret =drm_gem_mmap_obj (obj, +drm_vma_node_size (&obj->vma_node) <<PAGE_SHIFT , vma);drm_gem_object_put (obj);
include/drm/drm_gem.h +4 -0
@@ -469,6 +469,7 @@ struct drm_gem_object { .poll = drm_poll,\ .read = drm_read,\ .llseek = noop_llseek,\ + .get_unmapped_area = drm_gem_get_unmapped_area,\ .mmap = drm_gem_mmap, \ .fop_flags = FOP_UNSIGNED_OFFSET
@@ -506,6 +507,9 @@ void drm_gem_vm_close(struct vm_area_struct *vma);int drm_gem_mmap_obj (struct drm_gem_object *obj,unsigned long obj_size,struct vm_area_struct *vma);int drm_gem_mmap (struct file *filp,struct vm_area_struct *vma); +unsigned long drm_gem_get_unmapped_area (struct file *filp,unsigned long uaddr, +unsigned long len,unsigned long pgoff, +unsigned long flags);/** * drm_gem_object_get - acquire a GEM buffer object reference
Signature · 1 line
2.47.3
PATCH v13 4/10 drm/gem: Add huge tmpfs mountpoint helpers
In reply to Loïc MolinariAdd the drm_gem_huge_mnt_create() and drm_gem_get_huge_mnt() helpers to avoid code duplication in the i915, V3D, Panfrost and Panthor drivers. The former creates and mounts a dedicated huge tmpfs mountpoint, for the lifetime of a DRM device, used at GEM object initialization. The latter retrieves the dedicated huge tmpfs mountpoint used by a DRM device.
The next commits will port drivers to these helpers.
v3:
- store huge tmpfs mountpoint in drm_device
v4:
- return 0 in builds with CONFIG_TRANSPARENT_HUGEPAGE=n
- return 0 when huge_mnt already exists
- use new vfs_parse_fs_string() helper
v5:
- remove warning on !dev->huge_mnt and reset to NULL on free
- inline drm_gem_huge_mnt_create() to remove func from text and avoid calls in builds with CONFIG_TRANSPARENT_HUGEPAGE=n
- compile out drm_device's huge_mnt field in builds with CONFIG_TRANSPARENT_HUGEPAGE=n
- add drm_gem_has_huge_mnt() helper
v6:
- move huge_mnt doc into ifdef'd section
- either inline or export drm_gem_huge_mnt_create()
v7:
- include <drm/drm_device.h> in drm_gem.h
v9:
- replace drm_gem_has_huge_mnt() by drm_gem_get_huge_mnt()
v11:
- doc fixes
- add Boris and Maíra R-bs
--- drivers/gpu/drm/drm_gem.c | 57 +++++++++++++++++++++++++++++++++++++++ include/drm/drm_device.h | 15 +++++++++++ include/drm/drm_gem.h | 33 +++++++++++++++++++++++ 3 files changed, 105 insertions(+)
drivers/gpu/drm/drm_gem.c +57 -0
@@ -29,6 +29,9 @@#include <linux/export.h> #include <linux/file.h> #include <linux/fs.h> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#include <linux/fs_context.h> +#endif #include <linux/iosys-map.h> #include <linux/mem_encrypt.h> #include <linux/mm.h>
@@ -82,6 +85,60 @@* up at a later date, and as our interface with shmfs for memory allocation. */ +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +static void drm_gem_huge_mnt_free (struct drm_device *dev,void *data) +{ +kern_unmount (dev->huge_mnt); +} + +/** +* drm_gem_huge_mnt_create - Create, mount and use a huge tmpfs mountpoint +* @dev: DRM device that will use the huge tmpfs mountpoint +* @value: huge tmpfs mount option value +* +* This function creates and mounts a dedicated huge tmpfs mountpoint for the +* lifetime of the DRM device @dev which is used at GEM object initialization +* with drm_gem_object_init(). +* +* The most common option for @value is "within_size" which only allocates huge +* pages if the page will be fully within the GEM object size. "always", +* "advise" and "never" are supported too but the latter would just create a +* mountpoint similar to the default one (`shm_mnt`). See shmemfs and +* Transparent Hugepage for more information. +* +* Returns: +* 0 on success or a negative error code on failure. +*/ +int drm_gem_huge_mnt_create (struct drm_device *dev,const char *value) +{ +struct file_system_type *type; +struct fs_context *fc; +int ret; + +if (unlikely (drm_gem_get_huge_mnt (dev))) +return 0 ; + + type =get_fs_type ("tmpfs" ); +if (unlikely (!type)) +return -EOPNOTSUPP ; + fc =fs_context_for_mount (type,SB_KERNMOUNT ); +if (IS_ERR (fc)) +return PTR_ERR (fc); + ret =vfs_parse_fs_string (fc,"source" ,"tmpfs" ); +if (unlikely (ret)) +return -ENOPARAM ; + ret =vfs_parse_fs_string (fc,"huge" , value); +if (unlikely (ret)) +return -ENOPARAM ; + + dev->huge_mnt =fc_mount_longterm (fc); +put_fs_context (fc); + +return drmm_add_action_or_reset (dev, drm_gem_huge_mnt_free,NULL ); +} +EXPORT_SYMBOL_GPL (drm_gem_huge_mnt_create); +#endif +static void drm_gem_init_release (struct drm_device *dev,void *ptr) {
include/drm/drm_device.h +15 -0
@@ -3,6 +3,9 @@#include <linux/list.h> #include <linux/kref.h> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#include <linux/mount.h> +#endif #include <linux/mutex.h> #include <linux/idr.h> #include <linux/sched.h>
@@ -168,6 +171,18 @@ struct drm_device {*/ struct drm_master *master; +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +/** +* @huge_mnt: +* +* Huge tmpfs mountpoint used at GEM object initialization +* drm_gem_object_init(). Drivers can call drm_gem_huge_mnt_create() to +* create, mount and use it. The default tmpfs mountpoint (`shm_mnt`) is +* used if NULL. +*/ +struct vfsmount *huge_mnt; +#endif +/** * @driver_features: per-device driver features *
include/drm/drm_gem.h +33 -0
@@ -40,6 +40,9 @@#include <linux/list.h> #include <linux/mutex.h> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#include <drm/drm_device.h> +#endif #include <drm/drm_vma_manager.h> struct iosys_map ;
@@ -492,6 +495,36 @@ struct drm_gem_object { DRM_GEM_FOPS,\ } +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +int drm_gem_huge_mnt_create (struct drm_device *dev,const char *value); +#else +static inline int drm_gem_huge_mnt_create (struct drm_device *dev, +const char *value) +{ +return 0 ; +} +#endif + +/** +* drm_gem_get_huge_mnt - Get the huge tmpfs mountpoint used by a DRM device +* @dev: DRM device + +* This function gets the huge tmpfs mountpoint used by DRM device @dev. A huge +* tmpfs mountpoint is used instead of `shm_mnt` after a successful call to +* drm_gem_huge_mnt_create() when CONFIG_TRANSPARENT_HUGEPAGE is enabled. + +* Returns: +* The huge tmpfs mountpoint in use, NULL otherwise. +*/ +static inline struct vfsmount *drm_gem_get_huge_mnt (struct drm_device *dev) +{ +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +return dev->huge_mnt; +#else +return NULL ; +#endif +} +void drm_gem_object_release (struct drm_gem_object *obj);void drm_gem_object_free (struct kref *kref); int drm_gem_object_init(struct drm_device *dev,
Signature · 1 line
2.47.3
PATCH v13 5/10 drm/i915: Use huge tmpfs mountpoint helpers
In reply to Loïc MolinariMake use of the new drm_gem_huge_mnt_create() and drm_gem_get_huge_mnt() helpers to avoid code duplication. Now that it's just a few lines long, the single function in i915_gemfs.c is moved into i915_gem_shmem.c.
v3:
- use huge tmpfs mountpoint in drm_device
- move i915_gemfs.c into i915_gem_shmem.c
v4:
- clean up mountpoint creation error handling
v5:
- use drm_gem_has_huge_mnt() helper
v7:
- include <drm/drm_print.h> in i915_gem_shmem.c
v8:
- keep logging notice message with CONFIG_TRANSPARENT_HUGEPAGE=n
- don't access huge_mnt field with CONFIG_TRANSPARENT_HUGEPAGE=n
v9:
- replace drm_gem_has_huge_mnt() by drm_gem_get_huge_mnt()
- remove useless ternary op test in selftests/huge_pages.c
v12:
- fix layering violation in selftests (Tvrtko)
- fix incorrect filename in commit message
v13:
- add Tvrtko A-b
--- drivers/gpu/drm/i915/Makefile | 3 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 9 +-- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 58 ++++++++++----- drivers/gpu/drm/i915/gem/i915_gemfs.c | 71 ------------------- drivers/gpu/drm/i915/gem/i915_gemfs.h | 14 ---- .../gpu/drm/i915/gem/selftests/huge_pages.c | 15 +--- drivers/gpu/drm/i915/i915_drv.h | 5 -- 7 files changed, 50 insertions(+), 125 deletions(-) delete mode 100644 drivers/gpu/drm/i915/gem/i915_gemfs.c delete mode 100644 drivers/gpu/drm/i915/gem/i915_gemfs.h
drivers/gpu/drm/i915/Makefile +1 -2
@@ -169,8 +169,7 @@ gem-y += \ gem/i915_gem_ttm_move.o \ gem/i915_gem_ttm_pm.o \ gem/i915_gem_userptr.o \ - gem/i915_gem_wait.o \ - gem/i915_gemfs.o + gem/i915_gem_wait.o i915-y += \ $(gem-y) \ i915_active.o \
drivers/gpu/drm/i915/gem/i915_gem_object_types.h +5 -4
@@ -348,12 +348,13 @@ struct drm_i915_gem_object {*/ #define I915_BO_ALLOC_GPU_ONLY BIT(6)#define I915_BO_ALLOC_CCS_AUX BIT(7) +#define I915_BO_ALLOC_NOTHP BIT(8)/* * Object is allowed to retain its initial data and will not be cleared on first * access if used along with I915_BO_ALLOC_USER. This is mainly to keep * preallocated framebuffer data intact while transitioning it to i915drmfb. */ -#define I915_BO_PREALLOC BIT(8) +#define I915_BO_PREALLOC BIT(9)#define I915_BO_ALLOC_FLAGS (I915_BO_ALLOC_CONTIGUOUS | \ I915_BO_ALLOC_VOLATILE | \ I915_BO_ALLOC_CPU_CLEAR | \
@@ -363,9 +364,9 @@ struct drm_i915_gem_object { I915_BO_ALLOC_GPU_ONLY | \ I915_BO_ALLOC_CCS_AUX | \ I915_BO_PREALLOC) -#define I915_BO_READONLY BIT(9) -#define I915_TILING_QUIRK_BIT 10/* unknown swizzling; do not release! */ -#define I915_BO_PROTECTED BIT(11) +#define I915_BO_READONLY BIT(10) +#define I915_TILING_QUIRK_BIT 11/* unknown swizzling; do not release! */ +#define I915_BO_PROTECTED BIT(12)/** * @mem_flags - Mutable placement-related flags *
drivers/gpu/drm/i915/gem/i915_gem_shmem.c +41 -17
103 lines not on this page · raw message
drivers/gpu/drm/i915/gem/i915_gemfs.c deleted +0 -71
71 lines not on this page · raw message
drivers/gpu/drm/i915/gem/i915_gemfs.h deleted +0 -14
@@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: MIT */ -/* -* Copyright © 2017 Intel Corporation -*/ - -#ifndef __I915_GEMFS_H__ -#define __I915_GEMFS_H__ - -struct drm_i915_private ; - -void i915_gemfs_init (struct drm_i915_private *i915); -void i915_gemfs_fini (struct drm_i915_private *i915); - -#endif
drivers/gpu/drm/i915/gem/selftests/huge_pages.c +3 -12
@@ -1316,7 +1316,7 @@ typedef struct drm_i915_gem_object *static inline bool igt_can_allocate_thp (struct drm_i915_private *i915) { -return i915->mm.gemfs &&has_transparent_hugepage (); +return !!drm_gem_get_huge_mnt (&i915->drm); } static struct drm_i915_gem_object *
@@ -1761,7 +1761,6 @@ static int igt_tmpfs_fallback(void *arg)struct drm_i915_private *i915 = arg;struct i915_address_space *vm;struct i915_gem_context *ctx; -struct vfsmount *gemfs = i915->mm.gemfs;struct drm_i915_gem_object *obj;struct i915_vma *vma;struct file *file;
@@ -1779,15 +1778,8 @@ static int igt_tmpfs_fallback(void *arg) } vm =i915_gem_context_get_eb_vm (ctx); -/* -* Make sure that we don't burst into a ball of flames upon falling back -* to tmpfs, which we rely on if on the off-chance we encounter a failure -* when setting up gemfs. -*/ - - i915->mm.gemfs =NULL ; - - obj =i915_gem_object_create_shmem (i915,PAGE_SIZE ); + obj =i915_gem_object_create_region (i915->mm.regions[INTEL_REGION_SMEM ], +PAGE_SIZE ,0 ,I915_BO_ALLOC_NOTHP );if (IS_ERR (obj)) { err =PTR_ERR (obj); goto out_restore;
@@ -1819,7 +1811,6 @@ static int igt_tmpfs_fallback(void *arg) out_put:i915_gem_object_put (obj); out_restore: - i915->mm.gemfs = gemfs;i915_vm_put (vm); out:
drivers/gpu/drm/i915/i915_drv.h +0 -5
@@ -141,11 +141,6 @@ struct i915_gem_mm {*/ atomic_t free_count; -/** -* tmpfs instance used for shmem backed objects -*/ -struct vfsmount *gemfs; -struct intel_memory_region *regions[INTEL_REGION_UNKNOWN ];struct notifier_block oom_notifier;
Signature · 1 line
2.47.3
Tvrtko Ursulin
maintainerRe: [PATCH v13 05/10] drm/i915: Use huge tmpfs mountpoint helpers
Quoted 30 lines · Loïc Molinari
Make use of the new
drm_gem_huge_mnt_create()anddrm_gem_get_huge_mnt()helpers to avoid code duplication. Now that it's just a few lines long, the single function ini915_gemfs.cis moved intoi915_gem_shmem.c.v3:
- use huge tmpfs mountpoint indrm_device
- movei915_gemfs.cintoi915_gem_shmem.cv4:
- clean up mountpoint creation error handlingv5:
- usedrm_gem_has_huge_mnt()helperv7:
- include <drm/drm_print.h> ini915_gem_shmem.cv8:
- keep logging notice message withCONFIG_TRANSPARENT_HUGEPAGE=n
- don't accesshuge_mntfield withCONFIG_TRANSPARENT_HUGEPAGE=nv9:
- replacedrm_gem_has_huge_mnt()bydrm_gem_get_huge_mnt()
- remove useless ternary op test inselftests/huge_pages.cv12:
- fix layering violation in selftests (Tvrtko)
- fix incorrect filename in commit message
Quoted 5 lines
v13:
- add Tvrtko A-bSigned-off-by Loïc Molinari <[email protected]>Acked-by Tvrtko Ursulin <[email protected]>
Forgot to say - from my point of view it is okay to land this via drm-misc. I don't think there should be any conflicts in this area.
Regards,
Tvrtko
Quoted 330 lines
--- drivers/gpu/drm/i915/Makefile | 3 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 9 +-- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 58 ++++++++++----- drivers/gpu/drm/i915/gem/i915_gemfs.c | 71 ------------------- drivers/gpu/drm/i915/gem/i915_gemfs.h | 14 ---- .../gpu/drm/i915/gem/selftests/huge_pages.c | 15 +--- drivers/gpu/drm/i915/i915_drv.h | 5 -- 7 files changed, 50 insertions(+), 125 deletions(-)delete mode 100644
drivers/gpu/drm/i915/gem/i915_gemfs.cdelete mode 100644drivers/gpu/drm/i915/gem/i915_gemfs.hdrivers/gpu/drm/i915/Makefile +1
-2@@ -169,8 +169,7 @@ gem-y += \ gem/i915_gem_ttm_move.o \ gem/i915_gem_ttm_pm.o \ gem/i915_gem_userptr.o \ - gem/i915_gem_wait.o \ - gem/i915_gemfs.o + gem/i915_gem_wait.o i915-y += \ $(gem-y) \ i915_active.o \drivers/gpu/drm/i915/gem/i915_gem_object_types.h +5
-4@@ -348,12 +348,13 @@ struct drm_i915_gem_object {*/ #define I915_BO_ALLOC_GPU_ONLY BIT(6)#define I915_BO_ALLOC_CCS_AUX BIT(7) +#define I915_BO_ALLOC_NOTHP BIT(8)/* * Object is allowed to retain its initial data and will not be cleared on first * access if used along with I915_BO_ALLOC_USER. This is mainly to keep * preallocated framebuffer data intact while transitioning it to i915drmfb. */ -#define I915_BO_PREALLOC BIT(8) +#define I915_BO_PREALLOC BIT(9)#define I915_BO_ALLOC_FLAGS (I915_BO_ALLOC_CONTIGUOUS | \ I915_BO_ALLOC_VOLATILE | \ I915_BO_ALLOC_CPU_CLEAR | \@@ -363,9 +364,9 @@ struct drm_i915_gem_object { I915_BO_ALLOC_GPU_ONLY | \ I915_BO_ALLOC_CCS_AUX | \ I915_BO_PREALLOC) -#define I915_BO_READONLY BIT(9) -#define I915_TILING_QUIRK_BIT 10/* unknown swizzling; do not release! */ -#define I915_BO_PROTECTED BIT(11) +#define I915_BO_READONLY BIT(10) +#define I915_TILING_QUIRK_BIT 11/* unknown swizzling; do not release! */ +#define I915_BO_PROTECTED BIT(12)/** * @mem_flags - Mutable placement-related flags * drivers/gpu/drm/i915/gem/i915_gem_shmem.c +41
-17@@ -9,14 +9,16 @@#include <linux/uio.h> #include <drm/drm_cache.h> +#include <drm/drm_gem.h> +#include <drm/drm_print.h> #include "gem/i915_gem_region.h" #include "i915_drv.h" #include "i915_gem_object.h" #include "i915_gem_tiling.h" -#include "i915_gemfs.h" #include "i915_scatterlist.h" #include "i915_trace.h" +#include "i915_utils.h" /* * Move folios to appropriate lru and release the batch, decrementing the @@ -494,9 +496,11 @@ const struct drm_i915_gem_object_ops i915_gem_shmem_ops = {static int __create_shmem (struct drm_i915_private *i915,struct drm_gem_object *obj, -resource_size_t size) +resource_size_t size, +unsigned int flags) { -unsigned long flags =VM_NORESERVE ; +unsigned long shmem_flags =VM_NORESERVE ; +struct vfsmount *huge_mnt;struct file *filp;drm_gem_private_object_init (&i915->drm, obj, size);@@ -515,11 +519,12 @@ static int __create_shmem(struct drm_i915_private *i915,if (BITS_PER_LONG ==64 && size >MAX_LFS_FILESIZE )return -E2BIG ; -if (i915->mm.gemfs) - filp =shmem_file_setup_with_mnt (i915->mm.gemfs,"i915" , size, - flags); + huge_mnt =drm_gem_get_huge_mnt (&i915->drm); +if (!(flags &I915_BO_ALLOC_NOTHP ) && huge_mnt) + filp =shmem_file_setup_with_mnt (huge_mnt,"i915" , size, + shmem_flags);else - filp =shmem_file_setup ("i915" , size, flags); + filp =shmem_file_setup ("i915" , size, shmem_flags);if (IS_ERR (filp))return PTR_ERR (filp);@@ -548,7 +553,7 @@ static int shmem_object_init(struct intel_memory_region *mem,gfp_t mask;int ret; - ret =__create_shmem (i915, &obj->base, size); + ret =__create_shmem (i915, &obj->base, size, flags);if (ret)return ret;@@ -644,21 +649,40 @@ i915_gem_object_create_shmem_from_data(struct drm_i915_private *i915,static int init_shmem (struct intel_memory_region *mem) { -i915_gemfs_init (mem->i915); -intel_memory_region_set_name (mem,"system" ); +struct drm_i915_private *i915 = mem->i915; -return 0 ;/* We have fallback to the kernel mnt if gemfs init failed. */ -} +/* +* By creating our own shmemfs mountpoint, we can pass in +* mount flags that better match our usecase. +* +* One example, although it is probably better with a per-file +* control, is selecting huge page allocations ("huge=within_size"). +* However, we only do so on platforms which benefit from it, or to +* offset the overhead of iommu lookups, where with latter it is a net +* win even on platforms which would otherwise see some performance +* regressions such a slow reads issue on Broadwell and Skylake. +*/ -static int release_shmem (struct intel_memory_region *mem) -{ -i915_gemfs_fini (mem->i915); -return 0 ; +if (GRAPHICS_VER (i915) <11 && !i915_vtd_active (i915)) + goto no_thp; + +drm_gem_huge_mnt_create (&i915->drm,"within_size" ); +if (drm_gem_get_huge_mnt (&i915->drm)) +drm_info (&i915->drm,"Using Transparent Hugepages\n" ); +else +drm_notice (&i915->drm, +"Transparent Hugepage support is recommended for optimal performance%s\n" , +GRAPHICS_VER (i915) >=11 ?" on this platform!" : +" when IOMMU is enabled!" ); + + no_thp: +intel_memory_region_set_name (mem,"system" ); + +return 0 ;/* We have fallback to the kernel mnt if huge mnt failed. */ }static const struct intel_memory_region_ops shmem_region_ops = { .init = init_shmem, - .release = release_shmem, .init_object = shmem_object_init, };drivers/gpu/drm/i915/gem/i915_gemfs.c deleted +0
-71@@ -1,71 +0,0 @@ -// SPDX-License-Identifier: MIT -/* -* Copyright © 2017 Intel Corporation -*/ - -#include <linux/fs.h> -#include <linux/mount.h> -#include <linux/fs_context.h> - -#include <drm/drm_print.h> - -#include "i915_drv.h" -#include "i915_gemfs.h" -#include "i915_utils.h" - -void i915_gemfs_init (struct drm_i915_private *i915) -{ -struct file_system_type *type; -struct fs_context *fc; -struct vfsmount *gemfs; -int ret; - -/* -* By creating our own shmemfs mountpoint, we can pass in -* mount flags that better match our usecase. -* -* One example, although it is probably better with a per-file -* control, is selecting huge page allocations ("huge=within_size"). -* However, we only do so on platforms which benefit from it, or to -* offset the overhead of iommu lookups, where with latter it is a net -* win even on platforms which would otherwise see some performance -* regressions such a slow reads issue on Broadwell and Skylake. -*/ - -if (GRAPHICS_VER (i915) <11 && !i915_vtd_active (i915)) -return ; - -if (!IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE )) - goto err; - - type =get_fs_type ("tmpfs" ); -if (!type) - goto err; - - fc =fs_context_for_mount (type,SB_KERNMOUNT ); -if (IS_ERR (fc)) - goto err; - ret =vfs_parse_fs_string (fc,"source" ,"tmpfs" ); -if (!ret) - ret =vfs_parse_fs_string (fc,"huge" ,"within_size" ); -if (!ret) - gemfs =fc_mount_longterm (fc); -put_fs_context (fc); -if (ret) - goto err; - - i915->mm.gemfs = gemfs; -drm_info (&i915->drm,"Using Transparent Hugepages\n" ); -return ; - -err: -drm_notice (&i915->drm, -"Transparent Hugepage support is recommended for optimal performance%s\n" , -GRAPHICS_VER (i915) >=11 ?" on this platform!" : -" when IOMMU is enabled!" ); -} - -void i915_gemfs_fini (struct drm_i915_private *i915) -{ -kern_unmount (i915->mm.gemfs); -}drivers/gpu/drm/i915/gem/i915_gemfs.h deleted +0
-14@@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: MIT */ -/* -* Copyright © 2017 Intel Corporation -*/ - -#ifndef __I915_GEMFS_H__ -#define __I915_GEMFS_H__ - -struct drm_i915_private ; - -void i915_gemfs_init (struct drm_i915_private *i915); -void i915_gemfs_fini (struct drm_i915_private *i915); - -#endif drivers/gpu/drm/i915/gem/selftests/huge_pages.c +3
-12@@ -1316,7 +1316,7 @@ typedef struct drm_i915_gem_object *static inline bool igt_can_allocate_thp (struct drm_i915_private *i915) { -return i915->mm.gemfs &&has_transparent_hugepage (); +return !!drm_gem_get_huge_mnt (&i915->drm); } static struct drm_i915_gem_object *@@ -1761,7 +1761,6 @@ static int igt_tmpfs_fallback(void *arg)struct drm_i915_private *i915 = arg;struct i915_address_space *vm;struct i915_gem_context *ctx; -struct vfsmount *gemfs = i915->mm.gemfs;struct drm_i915_gem_object *obj;struct i915_vma *vma;struct file *file;@@ -1779,15 +1778,8 @@ static int igt_tmpfs_fallback(void *arg) } vm =i915_gem_context_get_eb_vm (ctx); -/* -* Make sure that we don't burst into a ball of flames upon falling back -* to tmpfs, which we rely on if on the off-chance we encounter a failure -* when setting up gemfs. -*/ - - i915->mm.gemfs =NULL ; - - obj =i915_gem_object_create_shmem (i915,PAGE_SIZE ); + obj =i915_gem_object_create_region (i915->mm.regions[INTEL_REGION_SMEM ], +PAGE_SIZE ,0 ,I915_BO_ALLOC_NOTHP );if (IS_ERR (obj)) { err =PTR_ERR (obj); goto out_restore;@@ -1819,7 +1811,6 @@ static int igt_tmpfs_fallback(void *arg) out_put:i915_gem_object_put (obj); out_restore: - i915->mm.gemfs = gemfs;i915_vm_put (vm); out:drivers/gpu/drm/i915/i915_drv.h +0
-5@@ -141,11 +141,6 @@ struct i915_gem_mm {*/ atomic_t free_count; -/** -* tmpfs instance used for shmem backed objects -*/ -struct vfsmount *gemfs; -struct intel_memory_region *regions[INTEL_REGION_UNKNOWN ];struct notifier_block oom_notifier;
PATCH v13 6/10 drm/v3d: Use huge tmpfs mountpoint helpers
In reply to Loïc MolinariMake use of the new drm_gem_huge_mnt_create() and drm_gem_get_huge_mnt() helpers to avoid code duplication. Now that it's just a few lines long, the single function in v3d_gemfs.c is moved into v3d_gem.c.
v3:
- use huge tmpfs mountpoint in drm_device
- move v3d_gemfs.c into v3d_gem.c
v4:
- clean up mountpoint creation error handling
v5:
- fix CONFIG_TRANSPARENT_HUGEPAGE check
- use drm_gem_has_huge_mnt() helper
v8:
- don't access huge_mnt field with CONFIG_TRANSPARENT_HUGEPAGE=n
v9:
- replace drm_gem_has_huge_mnt() by drm_gem_get_huge_mnt()
v10:
- get rid of CONFIG_TRANSPARENT_HUGEPAGE ifdefs
v11:
- remove superfluous comment
- add Maíra and Boris R-bs
--- drivers/gpu/drm/v3d/Makefile | 3 +- drivers/gpu/drm/v3d/v3d_bo.c | 5 ++- drivers/gpu/drm/v3d/v3d_drv.c | 2 +- drivers/gpu/drm/v3d/v3d_drv.h | 11 +----- drivers/gpu/drm/v3d/v3d_gem.c | 21 +++++++++-- drivers/gpu/drm/v3d/v3d_gemfs.c | 62 --------------------------------- 6 files changed, 24 insertions(+), 80 deletions(-) delete mode 100644 drivers/gpu/drm/v3d/v3d_gemfs.c
drivers/gpu/drm/v3d/Makefile +1 -2
@@ -13,8 +13,7 @@ v3d-y := \ v3d_trace_points.o \ v3d_sched.o \ v3d_sysfs.o \ - v3d_submit.o \ - v3d_gemfs.o + v3d_submit.o v3d-$(CONFIG_DEBUG_FS) += v3d_debugfs.o
drivers/gpu/drm/v3d/v3d_bo.c +2 -3
@@ -114,7 +114,7 @@ v3d_bo_create_finish(struct drm_gem_object *obj)if (IS_ERR (sgt))return PTR_ERR (sgt); -if (!v3d->gemfs) +if (!drm_gem_get_huge_mnt (obj->dev)) align =SZ_4K ;else if (obj->size >=SZ_1M ) align =SZ_1M ;
@@ -150,12 +150,11 @@ struct v3d_bo *v3d_bo_create(struct drm_device *dev, struct drm_file *file_priv, size_t unaligned_size) {struct drm_gem_shmem_object *shmem_obj; -struct v3d_dev *v3d =to_v3d_dev (dev);struct v3d_bo *bo;int ret; shmem_obj =drm_gem_shmem_create_with_mnt (dev, unaligned_size, - v3d->gemfs); +drm_gem_get_huge_mnt (dev));if (IS_ERR (shmem_obj))return ERR_CAST (shmem_obj); bo =to_v3d_bo (&shmem_obj->base);
drivers/gpu/drm/v3d/v3d_drv.c +1 -1
@@ -107,7 +107,7 @@ static int v3d_get_param_ioctl(struct drm_device *dev, void *data, args->value = v3d->perfmon_info.max_counters;return 0 ;case DRM_V3D_PARAM_SUPPORTS_SUPER_PAGES : - args->value = !!v3d->gemfs; + args->value = !!drm_gem_get_huge_mnt (dev);return 0 ;case DRM_V3D_PARAM_GLOBAL_RESET_COUNTER :mutex_lock (&v3d->reset_lock);
drivers/gpu/drm/v3d/v3d_drv.h +1 -10
@@ -158,11 +158,6 @@ struct v3d_dev {struct drm_mm mm;spinlock_t mm_lock; -/* -* tmpfs instance used for shmem backed objects -*/ -struct vfsmount *gemfs; -struct work_struct overflow_mem_work;struct v3d_queue_state queue[V3D_MAX_QUEUES ];
@@ -569,6 +564,7 @@ extern const struct dma_fence_ops v3d_fence_ops;struct dma_fence *v3d_fence_create (struct v3d_dev *v3d,enum v3d_queue q);/* v3d_gem.c */ +extern bool super_pages;int v3d_gem_init (struct drm_device *dev);void v3d_gem_destroy (struct drm_device *dev);void v3d_reset_sms (struct v3d_dev *v3d);
@@ -576,11 +572,6 @@ void v3d_reset(struct v3d_dev *v3d);void v3d_invalidate_caches (struct v3d_dev *v3d);void v3d_clean_caches (struct v3d_dev *v3d); -/* v3d_gemfs.c */ -extern bool super_pages; -void v3d_gemfs_init (struct v3d_dev *v3d); -void v3d_gemfs_fini (struct v3d_dev *v3d); -/* v3d_submit.c */ void v3d_job_cleanup (struct v3d_job *job);void v3d_job_put (struct v3d_job *job);
drivers/gpu/drm/v3d/v3d_gem.c +19 -2
@@ -259,6 +259,24 @@ v3d_invalidate_caches(struct v3d_dev *v3d)v3d_invalidate_slices (v3d,0 ); } +static void +v3d_huge_mnt_init (struct v3d_dev *v3d) +{ +int err =0 ; + +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ) && super_pages) + err =drm_gem_huge_mnt_create (&v3d->drm,"within_size" ); + +if (drm_gem_get_huge_mnt (&v3d->drm)) +drm_info (&v3d->drm,"Using Transparent Hugepages\n" ); +else if (err) +drm_warn (&v3d->drm,"Can't use Transparent Hugepages (%d)\n" , + err); +else +drm_notice (&v3d->drm, +"Transparent Hugepage support is recommended for optimal performance on this platform!\n" ); +} +int v3d_gem_init (struct drm_device *dev) {
@@ -310,7 +328,7 @@ v3d_gem_init(struct drm_device *dev)v3d_init_hw_state (v3d);v3d_mmu_set_page_table (v3d); -v3d_gemfs_init (v3d); +v3d_huge_mnt_init (v3d); ret =v3d_sched_init (v3d);if (ret) {
@@ -330,7 +348,6 @@ v3d_gem_destroy(struct drm_device *dev)enum v3d_queue q;v3d_sched_fini (v3d); -v3d_gemfs_fini (v3d);/* Waiting for jobs to finish would need to be done before * unregistering V3D.
drivers/gpu/drm/v3d/v3d_gemfs.c deleted +0 -62
62 lines not on this page · raw message
Signature · 1 line
2.47.3
PATCH v13 7/10 drm/gem: Get rid of *_with_mnt helpers
In reply to Loïc Molinaridrm_gem_object_init_with_mnt() and drm_gem_shmem_create_with_mnt() can be removed now that the drivers use the new drm_gem_huge_mnt_create() and drm_gem_get_huge_mnt() helpers.
v5:
- use drm_gem_has_huge_mnt() helper
- compile out shmem_file_setup_with_mnt() call in builds with CONFIG_TRANSPARENT_HUGEPAGE=n
v9:
- replace drm_gem_has_huge_mnt() with drm_gem_get_huge_mnt()
--- drivers/gpu/drm/drm_gem.c | 37 +++++++------------------ drivers/gpu/drm/drm_gem_shmem_helper.c | 38 ++++++-------------------- drivers/gpu/drm/v3d/v3d_bo.c | 3 +- include/drm/drm_gem.h | 3 -- include/drm/drm_gem_shmem_helper.h | 3 -- 5 files changed, 19 insertions(+), 65 deletions(-)
drivers/gpu/drm/drm_gem.c +10 -27
@@ -171,29 +171,28 @@ drm_gem_init(struct drm_device *dev) }/** -* drm_gem_object_init_with_mnt - initialize an allocated shmem-backed GEM -* object in a given shmfs mountpoint +* drm_gem_object_init - initialize an allocated shmem-backed GEM object * * @dev: drm_device the object should be initialized for * @obj: drm_gem_object to initialize * @size: object size -* @gemfs: tmpfs mount where the GEM object will be created. If NULL, use -* the usual tmpfs mountpoint (`shm_mnt`). * * Initialize an already allocated GEM object of the specified size with -* shmfs backing store. +* shmfs backing store. A huge mountpoint can be used by calling +* drm_gem_huge_mnt_create() beforehand. */ -int drm_gem_object_init_with_mnt (struct drm_device *dev, -struct drm_gem_object *obj,size_t size, -struct vfsmount *gemfs) +int drm_gem_object_init (struct drm_device *dev,struct drm_gem_object *obj, +size_t size) { +struct vfsmount *huge_mnt;struct file *filp;drm_gem_private_object_init (dev, obj, size); -if (gemfs) - filp =shmem_file_setup_with_mnt (gemfs,"drm mm object" , size, -VM_NORESERVE ); + huge_mnt =drm_gem_get_huge_mnt (dev); +if (huge_mnt) + filp =shmem_file_setup_with_mnt (huge_mnt,"drm mm object" , + size,VM_NORESERVE );else filp =shmem_file_setup ("drm mm object" , size,VM_NORESERVE );
@@ -204,22 +203,6 @@ int drm_gem_object_init_with_mnt(struct drm_device *dev,return 0 ; } -EXPORT_SYMBOL (drm_gem_object_init_with_mnt); - -/** -* drm_gem_object_init - initialize an allocated shmem-backed GEM object -* @dev: drm_device the object should be initialized for -* @obj: drm_gem_object to initialize -* @size: object size -* -* Initialize an already allocated GEM object of the specified size with -* shmfs backing store. -*/ -int drm_gem_object_init (struct drm_device *dev,struct drm_gem_object *obj, -size_t size) -{ -return drm_gem_object_init_with_mnt (dev, obj, size,NULL ); -}EXPORT_SYMBOL (drm_gem_object_init);/**
drivers/gpu/drm/drm_gem_shmem_helper.c +8 -30
@@ -50,7 +50,7 @@ static const struct drm_gem_object_funcs drm_gem_shmem_funcs = { };static int __drm_gem_shmem_init (struct drm_device *dev,struct drm_gem_shmem_object *shmem, -size_t size,bool private,struct vfsmount *gemfs) +size_t size,bool private) {struct drm_gem_object *obj = &shmem->base;int ret =0 ;
@@ -62,7 +62,7 @@ static int __drm_gem_shmem_init(struct drm_device *dev, struct drm_gem_shmem_objdrm_gem_private_object_init (dev, obj, size); shmem->map_wc = false;/* dma-buf mappings use always writecombine */ }else { - ret =drm_gem_object_init_with_mnt (dev, obj, size, gemfs); + ret =drm_gem_object_init (dev, obj, size); }if (ret) {drm_gem_private_object_fini (obj);
@@ -103,13 +103,12 @@ static int __drm_gem_shmem_init(struct drm_device *dev, struct drm_gem_shmem_obj*/ int drm_gem_shmem_init (struct drm_device *dev,struct drm_gem_shmem_object *shmem,size_t size) { -return __drm_gem_shmem_init (dev, shmem, size, false,NULL ); +return __drm_gem_shmem_init (dev, shmem, size, false); }EXPORT_SYMBOL_GPL (drm_gem_shmem_init);static struct drm_gem_shmem_object * -__drm_gem_shmem_create (struct drm_device *dev,size_t size,bool private, -struct vfsmount *gemfs) +__drm_gem_shmem_create (struct drm_device *dev,size_t size,bool private) {struct drm_gem_shmem_object *shmem;struct drm_gem_object *obj;
@@ -129,7 +128,7 @@ __drm_gem_shmem_create(struct drm_device *dev, size_t size, bool private, obj = &shmem->base; } - ret =__drm_gem_shmem_init (dev, shmem, size, private, gemfs); + ret =__drm_gem_shmem_init (dev, shmem, size, private);if (ret) {kfree (obj);return ERR_PTR (ret);
@@ -150,31 +149,10 @@ __drm_gem_shmem_create(struct drm_device *dev, size_t size, bool private,*/ struct drm_gem_shmem_object *drm_gem_shmem_create (struct drm_device *dev,size_t size) { -return __drm_gem_shmem_create (dev, size, false,NULL ); +return __drm_gem_shmem_create (dev, size, false); }EXPORT_SYMBOL_GPL (drm_gem_shmem_create); -/** -* drm_gem_shmem_create_with_mnt - Allocate an object with the given size in a -* given mountpoint -* @dev: DRM device -* @size: Size of the object to allocate -* @gemfs: tmpfs mount where the GEM object will be created -* -* This function creates a shmem GEM object in a given tmpfs mountpoint. -* -* Returns: -* A struct drm_gem_shmem_object * on success or an ERR_PTR()-encoded negative -* error code on failure. -*/ -struct drm_gem_shmem_object *drm_gem_shmem_create_with_mnt (struct drm_device *dev, -size_t size, -struct vfsmount *gemfs) -{ -return __drm_gem_shmem_create (dev, size, false, gemfs); -} -EXPORT_SYMBOL_GPL (drm_gem_shmem_create_with_mnt); -/** * drm_gem_shmem_release - Release resources associated with a shmem GEM object. * @shmem: shmem GEM object
@@ -851,7 +829,7 @@ drm_gem_shmem_prime_import_sg_table(struct drm_device *dev,size_t size =PAGE_ALIGN (attach->dmabuf->size);struct drm_gem_shmem_object *shmem; - shmem =__drm_gem_shmem_create (dev, size, true,NULL ); + shmem =__drm_gem_shmem_create (dev, size, true);if (IS_ERR (shmem))return ERR_CAST (shmem);
@@ -899,7 +877,7 @@ struct drm_gem_object *drm_gem_shmem_prime_import_no_map(struct drm_device *dev, size =PAGE_ALIGN (attach->dmabuf->size); - shmem =__drm_gem_shmem_create (dev, size, true,NULL ); + shmem =__drm_gem_shmem_create (dev, size, true);if (IS_ERR (shmem)) { ret =PTR_ERR (shmem); goto fail_detach;
drivers/gpu/drm/v3d/v3d_bo.c +1 -2
@@ -153,8 +153,7 @@ struct v3d_bo *v3d_bo_create(struct drm_device *dev, struct drm_file *file_priv,struct v3d_bo *bo;int ret; - shmem_obj =drm_gem_shmem_create_with_mnt (dev, unaligned_size, -drm_gem_get_huge_mnt (dev)); + shmem_obj =drm_gem_shmem_create (dev, unaligned_size);if (IS_ERR (shmem_obj))return ERR_CAST (shmem_obj); bo =to_v3d_bo (&shmem_obj->base);
include/drm/drm_gem.h +0 -3
@@ -529,9 +529,6 @@ void drm_gem_object_release(struct drm_gem_object *obj);void drm_gem_object_free (struct kref *kref);int drm_gem_object_init (struct drm_device *dev,struct drm_gem_object *obj,size_t size); -int drm_gem_object_init_with_mnt (struct drm_device *dev, -struct drm_gem_object *obj,size_t size, -struct vfsmount *gemfs);void drm_gem_private_object_init (struct drm_device *dev,struct drm_gem_object *obj,size_t size);void drm_gem_private_object_fini (struct drm_gem_object *obj);
include/drm/drm_gem_shmem_helper.h +0 -3
@@ -109,9 +109,6 @@ struct drm_gem_shmem_object {int drm_gem_shmem_init (struct drm_device *dev,struct drm_gem_shmem_object *shmem,size_t size);struct drm_gem_shmem_object *drm_gem_shmem_create (struct drm_device *dev,size_t size); -struct drm_gem_shmem_object *drm_gem_shmem_create_with_mnt (struct drm_device *dev, -size_t size, -struct vfsmount *gemfs);void drm_gem_shmem_release (struct drm_gem_shmem_object *shmem);void drm_gem_shmem_free (struct drm_gem_shmem_object *shmem);
Signature · 1 line
2.47.3
Re: [PATCH v13 07/10] drm/gem: Get rid of *_with_mnt helpers
Hi Loïc,
Quoted 9 lines · Loïc Molinari
drm_gem_object_init_with_mnt()anddrm_gem_shmem_create_with_mnt()can be removed now that the drivers use the newdrm_gem_huge_mnt_create()anddrm_gem_get_huge_mnt()helpers.v5:
- usedrm_gem_has_huge_mnt()helper
- compile outshmem_file_setup_with_mnt()call in builds withCONFIG_TRANSPARENT_HUGEPAGE=n
Quoted 5 lines
v9:
- replacedrm_gem_has_huge_mnt()withdrm_gem_get_huge_mnt()Signed-off-by Loïc Molinari <[email protected]>Reviewed-by Boris Brezillon <[email protected]>
Best Regards,
- Maíra
Quoted 215 lines
--- drivers/gpu/drm/drm_gem.c | 37 +++++++------------------ drivers/gpu/drm/drm_gem_shmem_helper.c | 38 ++++++-------------------- drivers/gpu/drm/v3d/v3d_bo.c | 3 +- include/drm/drm_gem.h | 3 -- include/drm/drm_gem_shmem_helper.h | 3 -- 5 files changed, 19 insertions(+), 65 deletions(-)drivers/gpu/drm/drm_gem.c +10
-27@@ -171,29 +171,28 @@ drm_gem_init(struct drm_device *dev) }/** -* drm_gem_object_init_with_mnt - initialize an allocated shmem-backed GEM -* object in a given shmfs mountpoint +* drm_gem_object_init - initialize an allocated shmem-backed GEM object * * @dev: drm_device the object should be initialized for * @obj: drm_gem_object to initialize * @size: object size -* @gemfs: tmpfs mount where the GEM object will be created. If NULL, use -* the usual tmpfs mountpoint (`shm_mnt`). * * Initialize an already allocated GEM object of the specified size with -* shmfs backing store. +* shmfs backing store. A huge mountpoint can be used by calling +* drm_gem_huge_mnt_create() beforehand. */ -int drm_gem_object_init_with_mnt (struct drm_device *dev, -struct drm_gem_object *obj,size_t size, -struct vfsmount *gemfs) +int drm_gem_object_init (struct drm_device *dev,struct drm_gem_object *obj, +size_t size) { +struct vfsmount *huge_mnt;struct file *filp;drm_gem_private_object_init (dev, obj, size); -if (gemfs) - filp =shmem_file_setup_with_mnt (gemfs,"drm mm object" , size, -VM_NORESERVE ); + huge_mnt =drm_gem_get_huge_mnt (dev); +if (huge_mnt) + filp =shmem_file_setup_with_mnt (huge_mnt,"drm mm object" , + size,VM_NORESERVE );else filp =shmem_file_setup ("drm mm object" , size,VM_NORESERVE );@@ -204,22 +203,6 @@ int drm_gem_object_init_with_mnt(struct drm_device *dev,return 0 ; } -EXPORT_SYMBOL (drm_gem_object_init_with_mnt); - -/** -* drm_gem_object_init - initialize an allocated shmem-backed GEM object -* @dev: drm_device the object should be initialized for -* @obj: drm_gem_object to initialize -* @size: object size -* -* Initialize an already allocated GEM object of the specified size with -* shmfs backing store. -*/ -int drm_gem_object_init (struct drm_device *dev,struct drm_gem_object *obj, -size_t size) -{ -return drm_gem_object_init_with_mnt (dev, obj, size,NULL ); -}EXPORT_SYMBOL (drm_gem_object_init);/** drivers/gpu/drm/drm_gem_shmem_helper.c +8
-30@@ -50,7 +50,7 @@ static const struct drm_gem_object_funcs drm_gem_shmem_funcs = { };static int __drm_gem_shmem_init (struct drm_device *dev,struct drm_gem_shmem_object *shmem, -size_t size,bool private,struct vfsmount *gemfs) +size_t size,bool private) {struct drm_gem_object *obj = &shmem->base;int ret =0 ;@@ -62,7 +62,7 @@ static int __drm_gem_shmem_init(struct drm_device *dev, struct drm_gem_shmem_objdrm_gem_private_object_init (dev, obj, size); shmem->map_wc = false;/* dma-buf mappings use always writecombine */ }else { - ret =drm_gem_object_init_with_mnt (dev, obj, size, gemfs); + ret =drm_gem_object_init (dev, obj, size); }if (ret) {drm_gem_private_object_fini (obj);@@ -103,13 +103,12 @@ static int __drm_gem_shmem_init(struct drm_device *dev, struct drm_gem_shmem_obj*/ int drm_gem_shmem_init (struct drm_device *dev,struct drm_gem_shmem_object *shmem,size_t size) { -return __drm_gem_shmem_init (dev, shmem, size, false,NULL ); +return __drm_gem_shmem_init (dev, shmem, size, false); }EXPORT_SYMBOL_GPL (drm_gem_shmem_init);static struct drm_gem_shmem_object * -__drm_gem_shmem_create (struct drm_device *dev,size_t size,bool private, -struct vfsmount *gemfs) +__drm_gem_shmem_create (struct drm_device *dev,size_t size,bool private) {struct drm_gem_shmem_object *shmem;struct drm_gem_object *obj;@@ -129,7 +128,7 @@ __drm_gem_shmem_create(struct drm_device *dev, size_t size, bool private, obj = &shmem->base; } - ret =__drm_gem_shmem_init (dev, shmem, size, private, gemfs); + ret =__drm_gem_shmem_init (dev, shmem, size, private);if (ret) {kfree (obj);return ERR_PTR (ret);@@ -150,31 +149,10 @@ __drm_gem_shmem_create(struct drm_device *dev, size_t size, bool private,*/ struct drm_gem_shmem_object *drm_gem_shmem_create (struct drm_device *dev,size_t size) { -return __drm_gem_shmem_create (dev, size, false,NULL ); +return __drm_gem_shmem_create (dev, size, false); }EXPORT_SYMBOL_GPL (drm_gem_shmem_create); -/** -* drm_gem_shmem_create_with_mnt - Allocate an object with the given size in a -* given mountpoint -* @dev: DRM device -* @size: Size of the object to allocate -* @gemfs: tmpfs mount where the GEM object will be created -* -* This function creates a shmem GEM object in a given tmpfs mountpoint. -* -* Returns: -* A struct drm_gem_shmem_object * on success or an ERR_PTR()-encoded negative -* error code on failure. -*/ -struct drm_gem_shmem_object *drm_gem_shmem_create_with_mnt (struct drm_device *dev, -size_t size, -struct vfsmount *gemfs) -{ -return __drm_gem_shmem_create (dev, size, false, gemfs); -} -EXPORT_SYMBOL_GPL (drm_gem_shmem_create_with_mnt); -/** * drm_gem_shmem_release - Release resources associated with a shmem GEM object. * @shmem: shmem GEM object @@ -851,7 +829,7 @@ drm_gem_shmem_prime_import_sg_table(struct drm_device *dev,size_t size =PAGE_ALIGN (attach->dmabuf->size);struct drm_gem_shmem_object *shmem; - shmem =__drm_gem_shmem_create (dev, size, true,NULL ); + shmem =__drm_gem_shmem_create (dev, size, true);if (IS_ERR (shmem))return ERR_CAST (shmem);@@ -899,7 +877,7 @@ struct drm_gem_object *drm_gem_shmem_prime_import_no_map(struct drm_device *dev, size =PAGE_ALIGN (attach->dmabuf->size); - shmem =__drm_gem_shmem_create (dev, size, true,NULL ); + shmem =__drm_gem_shmem_create (dev, size, true);if (IS_ERR (shmem)) { ret =PTR_ERR (shmem); goto fail_detach;drivers/gpu/drm/v3d/v3d_bo.c +1
-2@@ -153,8 +153,7 @@ struct v3d_bo *v3d_bo_create(struct drm_device *dev, struct drm_file *file_priv,struct v3d_bo *bo;int ret; - shmem_obj =drm_gem_shmem_create_with_mnt (dev, unaligned_size, -drm_gem_get_huge_mnt (dev)); + shmem_obj =drm_gem_shmem_create (dev, unaligned_size);if (IS_ERR (shmem_obj))return ERR_CAST (shmem_obj); bo =to_v3d_bo (&shmem_obj->base);include/drm/drm_gem.h +0
-3@@ -529,9 +529,6 @@ void drm_gem_object_release(struct drm_gem_object *obj);void drm_gem_object_free (struct kref *kref);int drm_gem_object_init (struct drm_device *dev,struct drm_gem_object *obj,size_t size); -int drm_gem_object_init_with_mnt (struct drm_device *dev, -struct drm_gem_object *obj,size_t size, -struct vfsmount *gemfs);void drm_gem_private_object_init (struct drm_device *dev,struct drm_gem_object *obj,size_t size);void drm_gem_private_object_fini (struct drm_gem_object *obj);include/drm/drm_gem_shmem_helper.h +0
-3@@ -109,9 +109,6 @@ struct drm_gem_shmem_object {int drm_gem_shmem_init (struct drm_device *dev,struct drm_gem_shmem_object *shmem,size_t size);struct drm_gem_shmem_object *drm_gem_shmem_create (struct drm_device *dev,size_t size); -struct drm_gem_shmem_object *drm_gem_shmem_create_with_mnt (struct drm_device *dev, -size_t size, -struct vfsmount *gemfs);void drm_gem_shmem_release (struct drm_gem_shmem_object *shmem);void drm_gem_shmem_free (struct drm_gem_shmem_object *shmem);
PATCH v13 8/10 drm/panthor: Introduce huge tmpfs mountpoint option
In reply to Loïc MolinariIntroduce the 'panthor.transparent_hugepage' boolean module parameter (false by default). When the parameter is set to true, a new tmpfs mountpoint is created and mounted using the 'huge=within_size' option. It's then used at GEM object creation instead of the default 'shm_mnt' mountpoint in order to enable Transparent Hugepage (THP) for the object (without having to rely on a system wide parameter).
v3:
- use huge tmpfs mountpoint in drm_device
v4:
- fix builds with CONFIG_TRANSPARENT_HUGEPAGE=n
- clean up mountpoint creation error handling
- print negative error value
v5:
- use drm_gem_has_huge_tmp() helper
- get rid of CONFIG_TRANSPARENT_HUGEPAGE ifdefs
v9:
- replace drm_gem_has_huge_tmp() by drm_gem_get_huge_tmp()
v11:
- enable 'panthor.transparent_hugepage' by default
--- drivers/gpu/drm/panthor/panthor_device.c | 3 +++ drivers/gpu/drm/panthor/panthor_drv.c | 7 +++++++ drivers/gpu/drm/panthor/panthor_drv.h | 9 +++++++++ drivers/gpu/drm/panthor/panthor_gem.c | 18 ++++++++++++++++++ drivers/gpu/drm/panthor/panthor_gem.h | 2 ++ 5 files changed, 39 insertions(+) create mode 100644 drivers/gpu/drm/panthor/panthor_drv.h
drivers/gpu/drm/panthor/panthor_device.c +3 -0
@@ -18,6 +18,7 @@#include "panthor_devfreq.h" #include "panthor_device.h" #include "panthor_fw.h" +#include "panthor_gem.h" #include "panthor_gpu.h" #include "panthor_hw.h" #include "panthor_mmu.h"
@@ -294,6 +295,8 @@ int panthor_device_init(struct panthor_device *ptdev)if (ret) goto err_unplug_fw; +panthor_gem_init (ptdev); +/* ~3 frames */ pm_runtime_set_autosuspend_delay (ptdev->base.dev,50 );pm_runtime_use_autosuspend (ptdev->base.dev);
drivers/gpu/drm/panthor/panthor_drv.c +7 -0
@@ -1559,6 +1559,7 @@ static const struct file_operations panthor_drm_driver_fops = { .read = drm_read, .llseek = noop_llseek, .mmap = panthor_mmap, + .get_unmapped_area = drm_gem_get_unmapped_area, .show_fdinfo = drm_show_fdinfo, .fop_flags = FOP_UNSIGNED_OFFSET, };
@@ -1627,6 +1628,12 @@ static const struct drm_driver panthor_drm_driver = {#endif }; +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +bool panthor_transparent_hugepage = true; +module_param_named (transparent_hugepage, panthor_transparent_hugepage, bool,0400 ); +MODULE_PARM_DESC (transparent_hugepage,"Use a dedicated tmpfs mount point with Transparent Hugepage enabled (true = default)" ); +#endif +static int panthor_probe (struct platform_device *pdev) {struct panthor_device *ptdev;
drivers/gpu/drm/panthor/panthor_drv.h new file +9 -0
@@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 or MIT +/* Copyright 2025 Amazon.com, Inc. or its affiliates */ + +#ifndef __PANTHOR_DRV_H__ +#define __PANTHOR_DRV_H__ + +extern bool panthor_transparent_hugepage; + +#endif
drivers/gpu/drm/panthor/panthor_gem.c +18 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0 or MIT /* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */ /* Copyright 2023 Collabora ltd. */ +/* Copyright 2025 Amazon.com, Inc. or its affiliates */ #include <linux/cleanup.h> #include <linux/dma-buf.h>
@@ -12,10 +13,27 @@#include <drm/panthor_drm.h> #include "panthor_device.h" +#include "panthor_drv.h" #include "panthor_fw.h" #include "panthor_gem.h" #include "panthor_mmu.h" +void panthor_gem_init (struct panthor_device *ptdev) +{ +int err; + +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ) && + !panthor_transparent_hugepage) +return ; + + err =drm_gem_huge_mnt_create (&ptdev->base,"within_size" ); +if (drm_gem_get_huge_mnt (&ptdev->base)) +drm_info (&ptdev->base,"Using Transparent Hugepage\n" ); +else if (err) +drm_warn (&ptdev->base,"Can't use Transparent Hugepage (%d)\n" , + err); +} +#ifdef CONFIG_DEBUG_FS static void panthor_gem_debugfs_bo_init (struct panthor_gem_object *bo) {
drivers/gpu/drm/panthor/panthor_gem.h +2 -0
@@ -136,6 +136,8 @@ struct panthor_gem_object *to_panthor_bo(struct drm_gem_object *obj) return container_of(to_drm_gem_shmem_obj(obj), struct panthor_gem_object, base); } +void panthor_gem_init (struct panthor_device *ptdev); +struct drm_gem_object *panthor_gem_create_object (struct drm_device *ddev,size_t size);int
Signature · 1 line
2.47.3
PATCH v13 9/10 drm/panfrost: Introduce huge tmpfs mountpoint option
In reply to Loïc MolinariIntroduce the 'panfrost.transparent_hugepage' boolean module parameter (false by default). When the parameter is set to true, a new tmpfs mountpoint is created and mounted using the 'huge=within_size' option. It's then used at GEM object creation instead of the default 'shm_mnt' mountpoint in order to enable Transparent Hugepage (THP) for the object (without having to rely on a system wide parameter).
v3:
- use huge tmpfs mountpoint in drm_device
v4:
- fix builds with CONFIG_TRANSPARENT_HUGEPAGE=n
- clean up mountpoint creation error handling
- print negative error value
v5:
- use drm_gem_has_huge_tmp() helper
- get rid of CONFIG_TRANSPARENT_HUGEPAGE ifdefs
v9:
- replace drm_gem_has_huge_tmp() by drm_gem_get_huge_tmp()
v11:
- enable 'panfrost.transparent_hugepage' by default
--- drivers/gpu/drm/panfrost/panfrost_device.c | 3 +++ drivers/gpu/drm/panfrost/panfrost_drv.c | 6 ++++++ drivers/gpu/drm/panfrost/panfrost_drv.h | 9 +++++++++ drivers/gpu/drm/panfrost/panfrost_gem.c | 18 ++++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_gem.h | 2 ++ 5 files changed, 38 insertions(+) create mode 100644 drivers/gpu/drm/panfrost/panfrost_drv.h
drivers/gpu/drm/panfrost/panfrost_device.c +3 -0
@@ -12,6 +12,7 @@#include "panfrost_device.h" #include "panfrost_devfreq.h" #include "panfrost_features.h" +#include "panfrost_gem.h" #include "panfrost_issues.h" #include "panfrost_gpu.h" #include "panfrost_job.h"
@@ -267,6 +268,8 @@ int panfrost_device_init(struct panfrost_device *pfdev)if (err) goto out_job; +panfrost_gem_init (pfdev); +return 0 ; out_job:panfrost_jm_fini (pfdev);
drivers/gpu/drm/panfrost/panfrost_drv.c +6 -0
@@ -858,6 +858,12 @@ static const struct drm_driver panfrost_drm_driver = {#endif }; +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +bool panfrost_transparent_hugepage = true; +module_param_named (transparent_hugepage, panfrost_transparent_hugepage, bool,0400 ); +MODULE_PARM_DESC (transparent_hugepage,"Use a dedicated tmpfs mount point with Transparent Hugepage enabled (true = default)" ); +#endif +static int panfrost_probe (struct platform_device *pdev) {struct panfrost_device *pfdev;
drivers/gpu/drm/panfrost/panfrost_drv.h new file +9 -0
@@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 or MIT +/* Copyright 2025 Amazon.com, Inc. or its affiliates */ + +#ifndef __PANFROST_DRV_H__ +#define __PANFROST_DRV_H__ + +extern bool panfrost_transparent_hugepage; + +#endif
drivers/gpu/drm/panfrost/panfrost_gem.c +18 -0
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */ +/* Copyright 2025 Amazon.com, Inc. or its affiliates */ #include <linux/cleanup.h> #include <linux/err.h>
@@ -10,9 +11,26 @@#include <drm/panfrost_drm.h> #include <drm/drm_print.h> #include "panfrost_device.h" +#include "panfrost_drv.h" #include "panfrost_gem.h" #include "panfrost_mmu.h" +void panfrost_gem_init (struct panfrost_device *pfdev) +{ +int err; + +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE ) && + !panfrost_transparent_hugepage) +return ; + + err =drm_gem_huge_mnt_create (&pfdev->base,"within_size" ); +if (drm_gem_get_huge_mnt (&pfdev->base)) +drm_info (&pfdev->base,"Using Transparent Hugepage\n" ); +else if (err) +drm_warn (&pfdev->base,"Can't use Transparent Hugepage (%d)\n" , + err); +} +#ifdef CONFIG_DEBUG_FS static void panfrost_gem_debugfs_bo_add (struct panfrost_device *pfdev,struct panfrost_gem_object *bo)
drivers/gpu/drm/panfrost/panfrost_gem.h +2 -0
@@ -124,6 +124,8 @@ drm_mm_node_to_panfrost_mapping(struct drm_mm_node *node) return container_of(node, struct panfrost_gem_mapping, mmnode); } +void panfrost_gem_init (struct panfrost_device *pfdev); +struct drm_gem_object *panfrost_gem_create_object (struct drm_device *dev,size_t size); struct drm_gem_object *
Signature · 1 line
2.47.3
PATCH v13 10/10 Documentation/gpu/drm-mm: Add THP paragraph to GEM mapping section
In reply to Loïc MolinariAdd a paragraph to the GEM Objects Creation section about the drm_gem_huge_mnt_create() helper and to the GEM objects mapping section explaining how transparent huge pages are handled by GEM.
v4:
- fix wording after huge_pages handler removal
v6:
- fix wording after map_pages handler removal
v11:
- mention drm_gem_huge_mnt_create() helper
- add Boris and Maíra R-bs
--- Documentation/gpu/drm-mm.rst | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-)
Documentation/gpu/drm-mm.rst +23 -6
@@ -155,7 +155,12 @@ drm_gem_object_init() will create an shmfs file of the requested size and store it into the struct :c:type:`struct drm_gem_object <drm_gem_object>` filp field. The memory is used as either main storage for the object when the graphics hardware -uses system memory directly or as a backing store otherwise. +uses system memory directly or as a backing store otherwise. Drivers +can call drm_gem_huge_mnt_create() to create, mount and use a huge +shmem mountpoint instead of the default one ('shm_mnt'). For builds +with CONFIG_TRANSPARENT_HUGEPAGE enabled, further calls to +drm_gem_object_init() will let shmem allocate huge pages when +possible. Drivers are responsible for the actual physical pages allocation by calling shmem_read_mapping_page_gfp() for each page.
@@ -290,15 +295,27 @@ The open and close operations must update the GEM object reference count. Drivers can use the drm_gem_vm_open() and drm_gem_vm_close() helper functions directly as open and close handlers. -The fault operation handler is responsible for mapping individual pages -to userspace when a page fault occurs. Depending on the memory -allocation scheme, drivers can allocate pages at fault time, or can -decide to allocate memory for the GEM object at the time the object is -created. +The fault operation handler is responsible for mapping pages to +userspace when a page fault occurs. Depending on the memory allocation +scheme, drivers can allocate pages at fault time, or can decide to +allocate memory for the GEM object at the time the object is created. Drivers that want to map the GEM object upfront instead of handling page faults can implement their own mmap file operation handler. +In order to reduce page table overhead, if the internal shmem mountpoint +"shm_mnt" is configured to use transparent huge pages (for builds with +CONFIG_TRANSPARENT_HUGEPAGE enabled) and if the shmem backing store +managed to allocate a huge page for a faulty address, the fault handler +will first attempt to insert that huge page into the VMA before falling +back to individual page insertion. mmap() user address alignment for GEM +objects is handled by providing a custom get_unmapped_area file +operation which forwards to the shmem backing store. For most drivers, +which don't create a huge mountpoint by default or through a module +parameter, transparent huge pages can be enabled by either setting the +"transparent_hugepage_shmem" kernel parameter or the +"/sys/kernel/mm/transparent_hugepage/shmem_enabled" sysfs knob. + For platforms without MMU the GEM core provides a helper method drm_gem_dma_get_unmapped_area(). The mmap() routines will call this to get a proposed address for the mapping.
Signature · 1 line
2.47.3
Patchwork
CI✗ i915.CI.BAT: failure for drm: Reduce page tables overhead with THP
In reply to Loïc Molinari== Series Details ==
== Series Details ==
Series: drm: Reduce page tables overhead with THP
URL : https://patchwork.freedesktop.org/series/158591/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_17641 -> Patchwork_158591v1
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_158591v1 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_158591v1, please notify your bug team ([email protected]) to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/index.html
Participating hosts (45 -> 41)
------------------------------
Missing (4): fi-kbl-7567u bat-twl-2 fi-snb-2520m fi-skl-6600u
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_158591v1:
### IGT changes ###
#### Possible regressions ####
* igt@i915_selftest@live:
- fi-hsw-4770: [PASS][1] -> [ABORT][2] +1 other test abort
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-hsw-4770/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-hsw-4770/igt@[email protected]
- fi-ivb-3770: [PASS][3] -> [ABORT][4] +1 other test abort
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-ivb-3770/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-ivb-3770/igt@[email protected]
- bat-mtlp-8: [PASS][5] -> [ABORT][6] +1 other test abort
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-mtlp-8/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-mtlp-8/igt@[email protected]
- bat-dg2-8: [PASS][7] -> [ABORT][8] +1 other test abort
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-dg2-8/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-dg2-8/igt@[email protected]
- fi-kbl-guc: [PASS][9] -> [ABORT][10] +1 other test abort
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-kbl-guc/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-kbl-guc/igt@[email protected]
- bat-adls-6: [PASS][11] -> [ABORT][12] +1 other test abort
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-adls-6/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-adls-6/igt@[email protected]
- bat-jsl-1: [PASS][13] -> [ABORT][14] +1 other test abort
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-jsl-1/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-jsl-1/igt@[email protected]
- fi-bsw-n3050: [PASS][15] -> [ABORT][16] +1 other test abort
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-bsw-n3050/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-bsw-n3050/igt@[email protected]
- bat-arlh-3: [PASS][17] -> [ABORT][18] +1 other test abort
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-arlh-3/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-arlh-3/igt@[email protected]
* igt@i915_selftest@live@hugepages:
- fi-glk-j4005: [PASS][19] -> [ABORT][20] +1 other test abort
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-glk-j4005/igt@i915_selftest@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-glk-j4005/igt@i915_selftest@[email protected]
- bat-adlp-9: [PASS][21] -> [ABORT][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-adlp-9/igt@i915_selftest@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-adlp-9/igt@i915_selftest@[email protected]
- bat-twl-1: [PASS][23] -> [ABORT][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-twl-1/igt@i915_selftest@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-twl-1/igt@i915_selftest@[email protected]
- bat-apl-1: [PASS][25] -> [ABORT][26] +1 other test abort
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-apl-1/igt@i915_selftest@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-apl-1/igt@i915_selftest@[email protected]
- bat-arls-5: [PASS][27] -> [ABORT][28] +1 other test abort
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-arls-5/igt@i915_selftest@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-arls-5/igt@i915_selftest@[email protected]
- bat-rplp-1: [PASS][29] -> [ABORT][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-rplp-1/igt@i915_selftest@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-rplp-1/igt@i915_selftest@[email protected]
- bat-arlh-2: [PASS][31] -> [ABORT][32] +1 other test abort
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-arlh-2/igt@i915_selftest@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-arlh-2/igt@i915_selftest@[email protected]
- fi-rkl-11600: [PASS][33] -> [ABORT][34] +1 other test abort
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-rkl-11600/igt@i915_selftest@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-rkl-11600/igt@i915_selftest@[email protected]
- bat-dg1-7: [PASS][35] -> [ABORT][36] +1 other test abort
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-dg1-7/igt@i915_selftest@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-dg1-7/igt@i915_selftest@[email protected]
- bat-dg2-9: [PASS][37] -> [ABORT][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-dg2-9/igt@i915_selftest@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-dg2-9/igt@i915_selftest@[email protected]
- fi-kbl-x1275: [PASS][39] -> [ABORT][40] +1 other test abort
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-kbl-x1275/igt@i915_selftest@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-kbl-x1275/igt@i915_selftest@[email protected]
- bat-adlp-11: [PASS][41] -> [ABORT][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-adlp-11/igt@i915_selftest@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-adlp-11/igt@i915_selftest@[email protected]
- bat-rpls-4: [PASS][43] -> [ABORT][44] +1 other test abort
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-rpls-4/igt@i915_selftest@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-rpls-4/igt@i915_selftest@[email protected]
- fi-kbl-8809g: [PASS][45] -> [ABORT][46] +1 other test abort
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-kbl-8809g/igt@i915_selftest@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-kbl-8809g/igt@i915_selftest@[email protected]
- bat-jsl-5: [PASS][47] -> [ABORT][48] +1 other test abort
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-jsl-5/igt@i915_selftest@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-jsl-5/igt@i915_selftest@[email protected]
- bat-dg1-6: [PASS][49] -> [ABORT][50] +1 other test abort
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-dg1-6/igt@i915_selftest@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-dg1-6/igt@i915_selftest@[email protected]
- fi-tgl-1115g4: [PASS][51] -> [ABORT][52] +1 other test abort
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-tgl-1115g4/igt@i915_selftest@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-tgl-1115g4/igt@i915_selftest@[email protected]
- fi-cfl-guc: [PASS][53] -> [ABORT][54] +1 other test abort
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-cfl-guc/igt@i915_selftest@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-cfl-guc/igt@i915_selftest@[email protected]
- bat-mtlp-6: [PASS][55] -> [ABORT][56] +1 other test abort
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-mtlp-6/igt@i915_selftest@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-mtlp-6/igt@i915_selftest@[email protected]
- fi-cfl-8700k: [PASS][57] -> [ABORT][58] +1 other test abort
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-cfl-8700k/igt@i915_selftest@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-cfl-8700k/igt@i915_selftest@[email protected]
- bat-dg2-14: [PASS][59] -> [ABORT][60] +1 other test abort
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-dg2-14/igt@i915_selftest@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-dg2-14/igt@i915_selftest@[email protected]
- fi-bsw-nick: [PASS][61] -> [ABORT][62] +1 other test abort
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-bsw-nick/igt@i915_selftest@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-bsw-nick/igt@i915_selftest@[email protected]
- bat-kbl-2: [PASS][63] -> [ABORT][64] +1 other test abort
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-kbl-2/igt@i915_selftest@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-kbl-2/igt@i915_selftest@[email protected]
- bat-adlp-6: [PASS][65] -> [ABORT][66]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-adlp-6/igt@i915_selftest@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-adlp-6/igt@i915_selftest@[email protected]
- bat-atsm-1: [PASS][67] -> [INCOMPLETE][68]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-atsm-1/igt@i915_selftest@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-atsm-1/igt@i915_selftest@[email protected]
- bat-dg2-11: [PASS][69] -> [ABORT][70]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-dg2-11/igt@i915_selftest@[email protected]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-dg2-11/igt@i915_selftest@[email protected]
- bat-mtlp-9: [PASS][71] -> [ABORT][72] +1 other test abort
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-mtlp-9/igt@i915_selftest@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-mtlp-9/igt@i915_selftest@[email protected]
- bat-arls-6: [PASS][73] -> [ABORT][74] +1 other test abort
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-arls-6/igt@i915_selftest@[email protected]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-arls-6/igt@i915_selftest@[email protected]
#### Warnings ####
* igt@i915_selftest@live:
- bat-dg2-9: [DMESG-FAIL][75] ([i915#12061]) -> [ABORT][76]
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-dg2-9/igt@[email protected]
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-dg2-9/igt@[email protected]
- bat-dg2-11: [DMESG-FAIL][77] ([i915#12061]) -> [ABORT][78]
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-dg2-11/igt@[email protected]
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-dg2-11/igt@[email protected]
New tests
---------
New tests have been introduced between CI_DRM_17641 and Patchwork_158591v1:
### New IGT tests (8) ###
* igt@i915_selftest@addfb25-x-tiled-legacy:
- Statuses :
- Exec time: [None] s
* igt@i915_selftest@addfb25-x-tiled-mismatch-legacy:
- Statuses :
- Exec time: [None] s
* igt@i915_selftest@bad-pitch-256:
- Statuses :
- Exec time: [None] s
* igt@i915_selftest@basic-eu-total:
- Statuses :
- Exec time: [None] s
* igt@i915_selftest@basic-llseek-bad:
- Statuses :
- Exec time: [None] s
* igt@i915_selftest@dsc-basic:
- Statuses :
- Exec time: [None] s
* igt@i915_selftest@inject-audio:
- Statuses :
- Exec time: [None] s
* igt@i915_selftest@second-client:
- Statuses :
- Exec time: [None] s
Known issues
------------
Here are the changes found in Patchwork_158591v1 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live:
- bat-adlp-9: [PASS][79] -> [ABORT][80] ([i915#14365])
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-adlp-9/igt@[email protected]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-adlp-9/igt@[email protected]
- bat-twl-1: [PASS][81] -> [ABORT][82] ([i915#14365])
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-twl-1/igt@[email protected]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-twl-1/igt@[email protected]
- bat-rplp-1: [PASS][83] -> [ABORT][84] ([i915#14365])
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-rplp-1/igt@[email protected]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-rplp-1/igt@[email protected]
- bat-adlp-11: [PASS][85] -> [ABORT][86] ([i915#14365])
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-adlp-11/igt@[email protected]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-adlp-11/igt@[email protected]
- bat-adlp-6: [PASS][87] -> [ABORT][88] ([i915#14365])
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-adlp-6/igt@[email protected]
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-adlp-6/igt@[email protected]
* igt@kms_hdmi_inject@inject-audio:
- fi-tgl-1115g4: [PASS][89] -> [FAIL][90] ([i915#14867])
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/fi-tgl-1115g4/igt@[email protected]
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/fi-tgl-1115g4/igt@[email protected]
#### Warnings ####
* igt@i915_selftest@live:
- bat-atsm-1: [DMESG-FAIL][91] ([i915#12061] / [i915#13929]) -> [INCOMPLETE][92] ([i915#12061] / [i915#15157])
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-atsm-1/igt@[email protected]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-atsm-1/igt@[email protected]
* igt@i915_selftest@live@mman:
- bat-atsm-1: [DMESG-FAIL][93] ([i915#13929]) -> [DMESG-FAIL][94] ([i915#14204])
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_17641/bat-atsm-1/igt@i915_selftest@[email protected]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/bat-atsm-1/igt@i915_selftest@[email protected]
[i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061
[i915#13929]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13929
[i915#14204]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14204
[i915#14365]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14365
[i915#14867]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14867
[i915#15157]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15157
Build changes
-------------
* Linux: CI_DRM_17641 -> Patchwork_158591v1
CI-20190529: 20190529
CI_DRM_17641: abc20a831a03dc608256340159c23e01ee6b6ead @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8656: 1fa8aeb0848614e6204602c5fe2949e049f087c9 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_158591v1: abc20a831a03dc608256340159c23e01ee6b6ead @ git://anongit.freedesktop.org/gfx-ci/linux
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_158591v1/index.html
Quoted 26 lines · On Fri, 5 Dec 2025 19:22:21 +0100 Loïc Molinari <[email protected]>…
This series aims to reduce the page tables overhead of DRM drivers for builds with
CONFIG_TRANSPARENT_HUGEPAGEenabled and either the sysfs knob '/sys/kernel/mm/transparent_hugepage/shmem_enabled' appropriately set or drivers using a dedicated huge tmpfs mount point.It starts by checking whether a faulty address in the page fault handler is part of a huge page in order to attempt a PMD sized PFN insertion into the VMA. It then introduces a dedicated
get_unmapped_areafile operation on the DRM file descriptor for GEM objects to get the best virtual address alignment for the underlying shmem buffers.The remaining commits propose shmem helpers to create and release huge tmpfs mount points and adapt the i915 and V3D drivers. The helpers are then used to optionally enable Transparent Hugepage for Panfrost and Panthor.
For Panthor on a Rock 5B, this series makes the first
memcpy()to an entire BO object mapped in userspace about twice as fast with Transparent Hugepage enabled.Implementing a fault-around handler using the arm64 contiguous page hint (contptes) could also greatly help reduce page tables overhead for small pages by mapping several contiguous pages around a faulty address at once. This will be proposed in another patch series.
Quoted 11 lines
Loïc Molinari (10):
drm/shmem-helper: Simplify page offset calculation in fault handler drm/shmem-helper: Map huge pages in fault handler drm/gem: Introducedrm_gem_get_unmapped_area()fop drm/gem: Add huge tmpfs mountpoint helpers
drm/i915: Use huge tmpfs mountpoint helpers
drm/v3d: Use huge tmpfs mountpoint helpers
drm/gem: Get rid of*_with_mnthelpers
drm/panthor: Introduce huge tmpfs mountpoint option drm/panfrost: Introduce huge tmpfs mountpoint optionDocumentation/gpu/drm-mm: Add THP paragraph to GEM mapping section
Queued to drm-misc-next.
Quoted 37 lines
Documentation/gpu/drm-mm.rst | 29 ++- drivers/gpu/drm/drm_gem.c | 202 +++++++++++++----- drivers/gpu/drm/drm_gem_shmem_helper.c | 77 +++---- drivers/gpu/drm/i915/Makefile | 3 +- .../gpu/drm/i915/gem/i915_gem_object_types.h | 9 +- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 58 +++-- drivers/gpu/drm/i915/gem/i915_gemfs.c | 71 ------ drivers/gpu/drm/i915/gem/i915_gemfs.h | 14 -- .../gpu/drm/i915/gem/selftests/huge_pages.c | 15 +- drivers/gpu/drm/i915/i915_drv.h | 5 - drivers/gpu/drm/panfrost/panfrost_device.c | 3 + drivers/gpu/drm/panfrost/panfrost_drv.c | 6 + drivers/gpu/drm/panfrost/panfrost_drv.h | 9 + drivers/gpu/drm/panfrost/panfrost_gem.c | 18 ++ drivers/gpu/drm/panfrost/panfrost_gem.h | 2 + drivers/gpu/drm/panthor/panthor_device.c | 3 + drivers/gpu/drm/panthor/panthor_drv.c | 7 + drivers/gpu/drm/panthor/panthor_drv.h | 9 + drivers/gpu/drm/panthor/panthor_gem.c | 18 ++ drivers/gpu/drm/panthor/panthor_gem.h | 2 + drivers/gpu/drm/v3d/Makefile | 3 +- drivers/gpu/drm/v3d/v3d_bo.c | 6 +- drivers/gpu/drm/v3d/v3d_drv.c | 2 +- drivers/gpu/drm/v3d/v3d_drv.h | 11 +- drivers/gpu/drm/v3d/v3d_gem.c | 21 +- drivers/gpu/drm/v3d/v3d_gemfs.c | 62 ------ include/drm/drm_device.h | 15 ++ include/drm/drm_gem.h | 40 +++- include/drm/drm_gem_shmem_helper.h | 3 - 29 files changed, 420 insertions(+), 303 deletions(-) delete mode 100644 drivers/gpu/drm/i915/gem/i915_gemfs.c delete mode 100644 drivers/gpu/drm/i915/gem/i915_gemfs.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_drv.h create mode 100644 drivers/gpu/drm/panthor/panthor_drv.h delete mode 100644 drivers/gpu/drm/v3d/v3d_gemfs.c