This series fixes two minor bugs in the Panfrost driver.
Changelog:
v7: - Factored out Panfrost fixes from [1] since I'll be working on
the dma-buf locking in a separate patchset now.
[1] https://lore.kernel.org/all/[email protected]/
Dmitry Osipenko (2):
drm/panfrost: Put mapping instead of shmem obj on
panfrost_mmu_map_fault_addr() error
drm/panfrost: Fix shrinker list corruption by madvise IOCTL
drivers/gpu/drm/panfrost/panfrost_drv.c | 4 ++--
drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
--
2.36.1
When panfrost_mmu_map_fault_addr() fails, the BO's mapping should be
unreferenced and not the shmem object which backs the mapping.
Cc: [email protected]
Fixes: bdefca2d8dc0 ("drm/panfrost: Add the panfrost_gem_mapping concept")
Reviewed-by: Steven Price <[email protected]>
Signed-off-by: Dmitry Osipenko <[email protected]>
---
drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index d3f82b26a631..b285a8001b1d 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -518,7 +518,7 @@ static int panfrost_mmu_map_fault_addr(struct panfrost_device *pfdev, int as,
err_pages:
drm_gem_shmem_put_pages(&bo->base);
err_bo:
- drm_gem_object_put(&bo->base.base);
+ panfrost_gem_mapping_put(bomapping);
return ret;
}
--
2.36.1
Calling madvise IOCTL twice on BO causes memory shrinker list corruption
and crashes kernel because BO is already on the list and it's added to
the list again, while BO should be removed from the list before it's
re-added. Fix it.
Cc: [email protected]
Fixes: 013b65101315 ("drm/panfrost: Add madvise and shrinker support")
Acked-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Steven Price <[email protected]>
Signed-off-by: Dmitry Osipenko <[email protected]>
---
drivers/gpu/drm/panfrost/panfrost_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index c58075bc096e..2d870cf73b07 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -433,8 +433,8 @@ static int panfrost_ioctl_madvise(struct drm_device *dev, void *data,
if (args->retained) {
if (args->madv == PANFROST_MADV_DONTNEED)
- list_add_tail(&bo->base.madv_list,
- &pfdev->shrinker_list);
+ list_move_tail(&bo->base.madv_list,
+ &pfdev->shrinker_list);
else if (args->madv == PANFROST_MADV_WILLNEED)
list_del_init(&bo->base.madv_list);
}
--
2.36.1
On 30/06/2022 21:05, Dmitry Osipenko wrote:
> This series fixes two minor bugs in the Panfrost driver.
>
> Changelog:
>
> v7: - Factored out Panfrost fixes from [1] since I'll be working on
> the dma-buf locking in a separate patchset now.
>
> [1] https://lore.kernel.org/all/[email protected]/
>
> Dmitry Osipenko (2):
> drm/panfrost: Put mapping instead of shmem obj on
> panfrost_mmu_map_fault_addr() error
> drm/panfrost: Fix shrinker list corruption by madvise IOCTL
>
> drivers/gpu/drm/panfrost/panfrost_drv.c | 4 ++--
> drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
Thanks, I've pushed both to drm-misc-fixes.
Steve