* [PATCH] drm/panthor: Fix handling of NO_MMAP BOs
@ 2026-09-22 10:07 Akash Goel
2026-09-22 11:28 ` Boris Brezillon
2026-09-22 14:50 ` Liviu Dudau
0 siblings, 2 replies; 3+ messages in thread
From: Akash Goel @ 2026-09-22 10:07 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 BOs created with DRM_PANTHOR_BO_NO_MMAP flag are not supposed to be
mmappable by the Userspace. But after the rework to support shrinker,
it became possible to mmap NO_MMAP BOs. Userspace could second guess
the file offset range, allocated unconditionally at the BO creation
time, and create a CPU mapping. There may not be any adverse effect of
such a CPU mapping though.
This commit removes the unconditional allocation of file offset range
when a user/kernel BO is created. For user BOs, allocation of file
offset range would be done from BO_MMAP_OFFSET ioctl handler which has
a check for NO_MMAP flag. For kernel BOs, there is no need to allocate
file offset range.
Fixes: 68cbf96b1e9b ("drm/panthor: Part ways with drm_gem_shmem_object")
Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Akash Goel <akash.goel@arm.com>
---
drivers/gpu/drm/panthor/panthor_gem.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
index c07a44057e42..5cfe66537e87 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.c
+++ b/drivers/gpu/drm/panthor/panthor_gem.c
@@ -1021,10 +1021,6 @@ panthor_gem_create(struct drm_device *dev, size_t size, uint32_t flags,
mapping_set_gfp_mask(bo->base.filp->f_mapping,
GFP_HIGHUSER | __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
- ret = drm_gem_create_mmap_offset(&bo->base);
- if (ret)
- goto err_put;
-
if (exclusive_vm) {
bo->exclusive_vm_root_gem = panthor_vm_root_gem(exclusive_vm);
drm_gem_object_get(bo->exclusive_vm_root_gem);
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: Fix handling of NO_MMAP BOs
2026-09-22 10:07 [PATCH] drm/panthor: Fix handling of NO_MMAP BOs Akash Goel
@ 2026-09-22 11:28 ` Boris Brezillon
2026-09-22 14:50 ` Liviu Dudau
1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2026-09-22 11:28 UTC (permalink / raw)
To: Akash Goel
Cc: liviu.dudau, steven.price, dri-devel, linux-kernel,
maarten.lankhorst, mripard, tzimmermann, airlied, daniel, nd
On Tue, 22 Sep 2026 11:07:43 +0100
Akash Goel <akash.goel@arm.com> wrote:
> The BOs created with DRM_PANTHOR_BO_NO_MMAP flag are not supposed to be
> mmappable by the Userspace. But after the rework to support shrinker,
> it became possible to mmap NO_MMAP BOs. Userspace could second guess
> the file offset range, allocated unconditionally at the BO creation
> time, and create a CPU mapping. There may not be any adverse effect of
> such a CPU mapping though.
> This commit removes the unconditional allocation of file offset range
> when a user/kernel BO is created. For user BOs, allocation of file
> offset range would be done from BO_MMAP_OFFSET ioctl handler which has
> a check for NO_MMAP flag. For kernel BOs, there is no need to allocate
> file offset range.
>
> Fixes: 68cbf96b1e9b ("drm/panthor: Part ways with drm_gem_shmem_object")
> Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Akash Goel <akash.goel@arm.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/gpu/drm/panthor/panthor_gem.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> index c07a44057e42..5cfe66537e87 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.c
> +++ b/drivers/gpu/drm/panthor/panthor_gem.c
> @@ -1021,10 +1021,6 @@ panthor_gem_create(struct drm_device *dev, size_t size, uint32_t flags,
> mapping_set_gfp_mask(bo->base.filp->f_mapping,
> GFP_HIGHUSER | __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
>
> - ret = drm_gem_create_mmap_offset(&bo->base);
> - if (ret)
> - goto err_put;
> -
> if (exclusive_vm) {
> bo->exclusive_vm_root_gem = panthor_vm_root_gem(exclusive_vm);
> drm_gem_object_get(bo->exclusive_vm_root_gem);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/panthor: Fix handling of NO_MMAP BOs
2026-09-22 10:07 [PATCH] drm/panthor: Fix handling of NO_MMAP BOs Akash Goel
2026-09-22 11:28 ` Boris Brezillon
@ 2026-09-22 14:50 ` Liviu Dudau
1 sibling, 0 replies; 3+ messages in thread
From: Liviu Dudau @ 2026-09-22 14:50 UTC (permalink / raw)
To: Akash Goel
Cc: boris.brezillon, steven.price, dri-devel, linux-kernel,
maarten.lankhorst, mripard, tzimmermann, airlied, daniel, nd
On Tue, Sep 22, 2026 at 11:07:43AM +0100, Akash Goel wrote:
> The BOs created with DRM_PANTHOR_BO_NO_MMAP flag are not supposed to be
> mmappable by the Userspace. But after the rework to support shrinker,
> it became possible to mmap NO_MMAP BOs. Userspace could second guess
> the file offset range, allocated unconditionally at the BO creation
> time, and create a CPU mapping. There may not be any adverse effect of
> such a CPU mapping though.
> This commit removes the unconditional allocation of file offset range
> when a user/kernel BO is created. For user BOs, allocation of file
> offset range would be done from BO_MMAP_OFFSET ioctl handler which has
> a check for NO_MMAP flag. For kernel BOs, there is no need to allocate
> file offset range.
>
> Fixes: 68cbf96b1e9b ("drm/panthor: Part ways with drm_gem_shmem_object")
> Suggested-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Akash Goel <akash.goel@arm.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Best regards,
Liviu
> ---
> drivers/gpu/drm/panthor/panthor_gem.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> index c07a44057e42..5cfe66537e87 100644
> --- a/drivers/gpu/drm/panthor/panthor_gem.c
> +++ b/drivers/gpu/drm/panthor/panthor_gem.c
> @@ -1021,10 +1021,6 @@ panthor_gem_create(struct drm_device *dev, size_t size, uint32_t flags,
> mapping_set_gfp_mask(bo->base.filp->f_mapping,
> GFP_HIGHUSER | __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
>
> - ret = drm_gem_create_mmap_offset(&bo->base);
> - if (ret)
> - goto err_put;
> -
> if (exclusive_vm) {
> bo->exclusive_vm_root_gem = panthor_vm_root_gem(exclusive_vm);
> drm_gem_object_get(bo->exclusive_vm_root_gem);
> --
> 2.25.1
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-22 14:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22 10:07 [PATCH] drm/panthor: Fix handling of NO_MMAP BOs Akash Goel
2026-09-22 11:28 ` Boris Brezillon
2026-09-22 14:50 ` Liviu Dudau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®