* [PATCH] drm/panthor: Avoid adding of kernel BOs to extobj list
@ 2025-11-13 18:45 Akash Goel
2025-11-13 19:15 ` Boris Brezillon
2025-11-20 15:24 ` Steven Price
0 siblings, 2 replies; 3+ messages in thread
From: Akash Goel @ 2025-11-13 18:45 UTC (permalink / raw)
To: boris.brezillon, liviu.dudau, steven.price
Cc: dri-devel, linux-kernel, maarten.lankhorst, mripard, tzimmermann,
airlied, daniel, nd, Akash Goel
The kernel BOs unnecessarily got added to the external objects list
of drm_gpuvm, when mapping to GPU, which would have resulted in few
extra CPU cycles being spent at the time of job submission as
drm_exec_until_all_locked() loop iterates over all external objects.
Kernel BOs are private to a VM and so they share the dma_resv object of
the dummy GEM object created for a VM. Use of DRM_EXEC_IGNORE_DUPLICATES
flag ensured the recursive locking of the dummy GEM object was ignored.
Also no extra space got allocated to add fences to the dma_resv object
of dummy GEM object. So no other impact apart from few extra CPU cycles.
This commit sets the pointer to dma_resv object of GEM object of
kernel BOs before they are mapped to GPU, to prevent them from
being added to external objects list.
Signed-off-by: Akash Goel <akash.goel@arm.com>
---
drivers/gpu/drm/panthor/panthor_gem.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
index f369cc3e2a5f..10d255cccc09 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.c
+++ b/drivers/gpu/drm/panthor/panthor_gem.c
@@ -145,6 +145,9 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
bo = to_panthor_bo(&obj->base);
kbo->obj = &obj->base;
bo->flags = bo_flags;
+ bo->exclusive_vm_root_gem = panthor_vm_root_gem(vm);
+ drm_gem_object_get(bo->exclusive_vm_root_gem);
+ bo->base.base.resv = bo->exclusive_vm_root_gem->resv;
if (vm == panthor_fw_vm(ptdev))
debug_flags |= PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED;
@@ -168,9 +171,6 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
goto err_free_va;
kbo->vm = panthor_vm_get(vm);
- bo->exclusive_vm_root_gem = panthor_vm_root_gem(vm);
- drm_gem_object_get(bo->exclusive_vm_root_gem);
- bo->base.base.resv = bo->exclusive_vm_root_gem->resv;
return kbo;
err_free_va:
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: Avoid adding of kernel BOs to extobj list
2025-11-13 18:45 [PATCH] drm/panthor: Avoid adding of kernel BOs to extobj list Akash Goel
@ 2025-11-13 19:15 ` Boris Brezillon
2025-11-20 15:24 ` Steven Price
1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2025-11-13 19:15 UTC (permalink / raw)
To: Akash Goel
Cc: liviu.dudau, steven.price, dri-devel, linux-kernel,
maarten.lankhorst, mripard, tzimmermann, airlied, daniel, nd
On Thu, 13 Nov 2025 18:45:44 +0000
Akash Goel <akash.goel@arm.com> wrote:
> The kernel BOs unnecessarily got added to the external objects list
> of drm_gpuvm, when mapping to GPU, which would have resulted in few
> extra CPU cycles being spent at the time of job submission as
> drm_exec_until_all_locked() loop iterates over all external objects.
>
> Kernel BOs are private to a VM and so they share the dma_resv object of
> the dummy GEM object created for a VM. Use of DRM_EXEC_IGNORE_DUPLICATES
> flag ensured the recursive locking of the dummy GEM object was ignored.
> Also no extra space got allocated to add fences to the dma_resv object
> of dummy GEM object. So no other impact apart from few extra CPU cycles.
>
> This commit sets the pointer to dma_resv object of GEM object of
> kernel BOs before they are mapped to GPU, to prevent them from
> being added to external objects list.
>
> Signed-off-by: Akash Goel <akash.goel@arm.com>
With a proper Fixes tag, this is
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/gpu/drm/panthor/panthor_gem.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> index f369cc3e2a5f..10d255cccc09 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.c
> +++ b/drivers/gpu/drm/panthor/panthor_gem.c
> @@ -145,6 +145,9 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
> bo = to_panthor_bo(&obj->base);
> kbo->obj = &obj->base;
> bo->flags = bo_flags;
> + bo->exclusive_vm_root_gem = panthor_vm_root_gem(vm);
> + drm_gem_object_get(bo->exclusive_vm_root_gem);
> + bo->base.base.resv = bo->exclusive_vm_root_gem->resv;
>
> if (vm == panthor_fw_vm(ptdev))
> debug_flags |= PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED;
> @@ -168,9 +171,6 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
> goto err_free_va;
>
> kbo->vm = panthor_vm_get(vm);
> - bo->exclusive_vm_root_gem = panthor_vm_root_gem(vm);
> - drm_gem_object_get(bo->exclusive_vm_root_gem);
> - bo->base.base.resv = bo->exclusive_vm_root_gem->resv;
> return kbo;
>
> err_free_va:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: Avoid adding of kernel BOs to extobj list
2025-11-13 18:45 [PATCH] drm/panthor: Avoid adding of kernel BOs to extobj list Akash Goel
2025-11-13 19:15 ` Boris Brezillon
@ 2025-11-20 15:24 ` Steven Price
1 sibling, 0 replies; 3+ messages in thread
From: Steven Price @ 2025-11-20 15:24 UTC (permalink / raw)
To: Akash Goel, boris.brezillon, liviu.dudau
Cc: dri-devel, linux-kernel, maarten.lankhorst, mripard, tzimmermann,
airlied, daniel, nd
On 13/11/2025 18:45, Akash Goel wrote:
> The kernel BOs unnecessarily got added to the external objects list
> of drm_gpuvm, when mapping to GPU, which would have resulted in few
> extra CPU cycles being spent at the time of job submission as
> drm_exec_until_all_locked() loop iterates over all external objects.
>
> Kernel BOs are private to a VM and so they share the dma_resv object of
> the dummy GEM object created for a VM. Use of DRM_EXEC_IGNORE_DUPLICATES
> flag ensured the recursive locking of the dummy GEM object was ignored.
> Also no extra space got allocated to add fences to the dma_resv object
> of dummy GEM object. So no other impact apart from few extra CPU cycles.
>
> This commit sets the pointer to dma_resv object of GEM object of
> kernel BOs before they are mapped to GPU, to prevent them from
> being added to external objects list.
>
> Signed-off-by: Akash Goel <akash.goel@arm.com>
Reviewed-by: Steven Price <steven.price@arm.com>
As Boris says it would be good to have a Fixes tag - can you dig out an
appropriate commit then I can merge?
Thanks,
Steve
> ---
> drivers/gpu/drm/panthor/panthor_gem.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> index f369cc3e2a5f..10d255cccc09 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.c
> +++ b/drivers/gpu/drm/panthor/panthor_gem.c
> @@ -145,6 +145,9 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
> bo = to_panthor_bo(&obj->base);
> kbo->obj = &obj->base;
> bo->flags = bo_flags;
> + bo->exclusive_vm_root_gem = panthor_vm_root_gem(vm);
> + drm_gem_object_get(bo->exclusive_vm_root_gem);
> + bo->base.base.resv = bo->exclusive_vm_root_gem->resv;
>
> if (vm == panthor_fw_vm(ptdev))
> debug_flags |= PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED;
> @@ -168,9 +171,6 @@ panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
> goto err_free_va;
>
> kbo->vm = panthor_vm_get(vm);
> - bo->exclusive_vm_root_gem = panthor_vm_root_gem(vm);
> - drm_gem_object_get(bo->exclusive_vm_root_gem);
> - bo->base.base.resv = bo->exclusive_vm_root_gem->resv;
> return kbo;
>
> err_free_va:
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-20 15:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13 18:45 [PATCH] drm/panthor: Avoid adding of kernel BOs to extobj list Akash Goel
2025-11-13 19:15 ` Boris Brezillon
2025-11-20 15:24 ` Steven Price
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox