diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2023-02-28 16:26:12 +0100 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2023-02-28 16:41:32 +0100 |
commit | e0106ac97886b6bc36c480de72562d3e70b3f8b1 (patch) | |
tree | 0dd0cdd216af7dbb5d38203b8f6776a5ada13163 /include | |
parent | drm/connector: print max_requested_bpc in state debugfs (diff) | |
download | linux-e0106ac97886b6bc36c480de72562d3e70b3f8b1.tar.xz linux-e0106ac97886b6bc36c480de72562d3e70b3f8b1.zip |
Revert "drm/shmem-helper: Switch to reservation lock"
This reverts commit 67b7836d4458790f1261e31fe0ce3250989784f0.
The locking appears incomplete. A caller of SHMEM helper's pin
function never acquires the dma-buf reservation lock. So we get
WARNING: CPU: 3 PID: 967 at drivers/gpu/drm/drm_gem_shmem_helper.c:243 drm_gem_shmem_pin+0x42/0x90 [drm_shmem_helper]
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230228152612.19971-1-tzimmermann@suse.de
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/drm_gem_shmem_helper.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/drm/drm_gem_shmem_helper.h b/include/drm/drm_gem_shmem_helper.h index 20ddcd799df9..5994fed5e327 100644 --- a/include/drm/drm_gem_shmem_helper.h +++ b/include/drm/drm_gem_shmem_helper.h @@ -27,6 +27,11 @@ struct drm_gem_shmem_object { struct drm_gem_object base; /** + * @pages_lock: Protects the page table and use count + */ + struct mutex pages_lock; + + /** * @pages: Page table */ struct page **pages; @@ -61,6 +66,11 @@ struct drm_gem_shmem_object { struct sg_table *sgt; /** + * @vmap_lock: Protects the vmap address and use count + */ + struct mutex vmap_lock; + + /** * @vaddr: Kernel virtual address of the backing memory */ void *vaddr; @@ -99,6 +109,7 @@ struct drm_gem_shmem_object { struct drm_gem_shmem_object *drm_gem_shmem_create(struct drm_device *dev, size_t size); void drm_gem_shmem_free(struct drm_gem_shmem_object *shmem); +int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem); void drm_gem_shmem_put_pages(struct drm_gem_shmem_object *shmem); int drm_gem_shmem_pin(struct drm_gem_shmem_object *shmem); void drm_gem_shmem_unpin(struct drm_gem_shmem_object *shmem); @@ -117,7 +128,8 @@ static inline bool drm_gem_shmem_is_purgeable(struct drm_gem_shmem_object *shmem !shmem->base.dma_buf && !shmem->base.import_attach; } -void drm_gem_shmem_purge(struct drm_gem_shmem_object *shmem); +void drm_gem_shmem_purge_locked(struct drm_gem_shmem_object *shmem); +bool drm_gem_shmem_purge(struct drm_gem_shmem_object *shmem); struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_shmem_object *shmem); struct sg_table *drm_gem_shmem_get_pages_sgt(struct drm_gem_shmem_object *shmem); |