Skip to contentSkip to conversation

drm: Fareless gem_free_object

PATCH Superseded Emil Velikov 10 participants 73 messages May 7, 2020 – May 14, 2020

Subsystems (32)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover drm: Fareless gem_free_object

Hi all,

Recently I had a look at the new dmabuf AMDGPU implementation.

Seemingly it was using the wrong drm_gem_object_put API. Namely the locked one, even though the driver is struct_mutex free.

Upon checking with the documentation, I've noticed it's a bit misleading so I've went ahead and:

- tweaked the drm_gem_object_put/struct_mutex references in the docs
- fixed up the AMDGPU caller
- removed the gem_free_object driver hook - \o/
- fold drm_gem_object_put_unlocked and __drm_gem_object_put
- drm_gem_object_put - add _locked suffix
- drm_gem_object_put_unlocked - remove _unlocked suffix

Although the rename patches are a handful, it does make sense to have a consistent and obviously named API.

Input and reviews are highly appreciated.
Emil

Cc Daniel Vetter <[email protected]>

Emil Velikov (36):
drm: remove unused drm_gem.h include
drm/gem: use _unlocked reference in drm_gem_objects_lookup docs drm/todo: mention i915 in the struct_mutex section drm/doc: drop struct_mutex references
drm/doc: drop struct_mutex refernce for drm_gem_object_free drm/amdgpu: use the unlocked drm_gem_object_put drm/gma500: Use lockless gem BO free callback
drm: remove drm_driver::gem_free_object
drm/gem: fold drm_gem_object_put_unlocked and __drm_gem_object_put() drm/gem: add _locked suffix to drm_object_put
drm/gem: add drm_object_put helper
drm/amd: remove _unlocked suffix in drm_object_put_unlocked drm/arm: remove _unlocked suffix in drm_object_put_unlocked drm/armada: remove _unlocked suffix in drm_object_put_unlocked drm/etnaviv: remove _unlocked suffix in drm_object_put_unlocked drm/exynos: remove _unlocked suffix in drm_object_put_unlocked drm/gma500: remove _unlocked suffix in drm_object_put_unlocked drm/i915: remove _unlocked suffix in drm_object_put_unlocked drm/lima: remove _unlocked suffix in drm_object_put_unlocked drm/mediatek: remove _unlocked suffix in drm_object_put_unlocked drm/mgag200: remove _unlocked suffix in drm_object_put_unlocked drm/msm: remove _unlocked suffix in drm_object_put_unlocked drm/nouveau: remove _unlocked suffix in drm_object_put_unlocked drm/omapdrm: remove _unlocked suffix in drm_object_put_unlocked drm/panfrost: remove _unlocked suffix in drm_object_put_unlocked drm/qxl: remove _unlocked suffix in drm_object_put_unlocked drm/radeon: remove _unlocked suffix in drm_object_put_unlocked drm/rockchip: remove _unlocked suffix in drm_object_put_unlocked drm/tegra: remove _unlocked suffix in drm_object_put_unlocked drm/v3d: remove _unlocked suffix in drm_object_put_unlocked drm/vc4: remove _unlocked suffix in drm_object_put_unlocked drm/vgem: remove _unlocked suffix in drm_object_put_unlocked drm/virtio: remove _unlocked suffix in drm_object_put_unlocked drm/vkms: remove _unlocked suffix in drm_object_put_unlocked drm/xen: remove _unlocked suffix in drm_object_put_unlocked drm/gem: remove _unlocked suffix in drm_object_put_unlocked

 Documentation/gpu/drm-mm.rst                  |  5 +-
 Documentation/gpu/todo.rst                    |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c        |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c       | 20 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  6 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  6 +-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  6 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  6 +-
 .../arm/display/komeda/komeda_framebuffer.c   |  6 +-
 drivers/gpu/drm/arm/malidp_drv.c              |  4 +-
 drivers/gpu/drm/armada/armada_crtc.c          |  8 +--
 drivers/gpu/drm/armada/armada_fb.c            |  4 +-
 drivers/gpu/drm/armada/armada_fbdev.c         |  6 +-
 drivers/gpu/drm/armada/armada_gem.c           | 10 +--
 drivers/gpu/drm/drm_client.c                  |  2 +-
 drivers/gpu/drm/drm_gem.c                     | 70 +++++--------------
 drivers/gpu/drm/drm_gem_cma_helper.c          |  8 +--
 drivers/gpu/drm/drm_gem_framebuffer_helper.c  |  6 +-
 drivers/gpu/drm/drm_gem_shmem_helper.c        |  4 +-
 drivers/gpu/drm/drm_gem_ttm_helper.c          |  2 +-
 drivers/gpu/drm/drm_gem_vram_helper.c         | 10 +--
 drivers/gpu/drm/drm_prime.c                   |  6 +-
 drivers/gpu/drm/drm_vm.c                      |  1 -
 drivers/gpu/drm/etnaviv/etnaviv_drv.c         |  8 +--
 drivers/gpu/drm/etnaviv/etnaviv_gem.c         |  6 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c   |  2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c  |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_gem.c       |  4 +-
 drivers/gpu/drm/exynos/exynos_drm_gem.h       |  2 +-
 drivers/gpu/drm/gma500/framebuffer.c          |  2 +-
 drivers/gpu/drm/gma500/gem.c                  |  2 +-
 drivers/gpu/drm/gma500/gma_display.c          |  6 +-
 drivers/gpu/drm/gma500/psb_drv.c              |  2 +-
 drivers/gpu/drm/i915/gem/i915_gem_object.h    |  2 +-
 drivers/gpu/drm/lima/lima_gem.c               | 10 +--
 drivers/gpu/drm/lima/lima_sched.c             |  2 +-
 drivers/gpu/drm/mediatek/mtk_drm_gem.c        |  2 +-
 drivers/gpu/drm/mgag200/mgag200_cursor.c      |  8 +--
 drivers/gpu/drm/msm/adreno/a5xx_debugfs.c     |  4 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c         |  6 +-
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c         |  2 +-
 drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c     |  4 +-
 drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c      |  2 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c     |  2 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c            |  2 +-
 drivers/gpu/drm/msm/msm_drv.c                 |  8 +--
 drivers/gpu/drm/msm/msm_fb.c                  |  4 +-
 drivers/gpu/drm/msm/msm_gem.c                 | 18 ++---
 drivers/gpu/drm/msm/msm_gem_submit.c          |  2 +-
 drivers/gpu/drm/msm/msm_gpu.c                 |  2 +-
 drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  2 +-
 drivers/gpu/drm/nouveau/nouveau_abi16.c       |  2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c     |  8 +--
 drivers/gpu/drm/nouveau/nouveau_gem.c         | 14 ++--
 drivers/gpu/drm/omapdrm/omap_drv.c            |  2 +-
 drivers/gpu/drm/omapdrm/omap_fb.c             |  2 +-
 drivers/gpu/drm/omapdrm/omap_fbdev.c          |  2 +-
 drivers/gpu/drm/omapdrm/omap_gem.c            |  4 +-
 drivers/gpu/drm/panfrost/panfrost_drv.c       | 10 +--
 drivers/gpu/drm/panfrost/panfrost_gem.c       |  4 +-
 drivers/gpu/drm/panfrost/panfrost_job.c       |  2 +-
 drivers/gpu/drm/panfrost/panfrost_mmu.c       |  2 +-
 drivers/gpu/drm/panfrost/panfrost_perfcnt.c   |  4 +-
 drivers/gpu/drm/qxl/qxl_cmd.c                 |  2 +-
 drivers/gpu/drm/qxl/qxl_display.c             |  6 +-
 drivers/gpu/drm/qxl/qxl_dumb.c                |  2 +-
 drivers/gpu/drm/qxl/qxl_gem.c                 |  2 +-
 drivers/gpu/drm/qxl/qxl_ioctl.c               |  4 +-
 drivers/gpu/drm/qxl/qxl_object.c              |  4 +-
 drivers/gpu/drm/radeon/radeon_cs.c            |  2 +-
 drivers/gpu/drm/radeon/radeon_cursor.c        |  6 +-
 drivers/gpu/drm/radeon/radeon_display.c       |  8 +--
 drivers/gpu/drm/radeon/radeon_fb.c            |  4 +-
 drivers/gpu/drm/radeon/radeon_gem.c           | 30 ++++----
 drivers/gpu/drm/radeon/radeon_object.c        |  2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |  2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c   |  2 +-
 drivers/gpu/drm/tegra/drm.c                   | 12 ++--
 drivers/gpu/drm/tegra/fb.c                    |  6 +-
 drivers/gpu/drm/tegra/gem.c                   |  4 +-
 drivers/gpu/drm/v3d/v3d_bo.c                  |  6 +-
 drivers/gpu/drm/v3d/v3d_gem.c                 |  4 +-
 drivers/gpu/drm/v3d/v3d_irq.c                 |  2 +-
 drivers/gpu/drm/vc4/vc4_bo.c                  | 14 ++--
 drivers/gpu/drm/vc4/vc4_gem.c                 | 14 ++--
 drivers/gpu/drm/vc4/vc4_kms.c                 |  2 +-
 drivers/gpu/drm/vc4/vc4_v3d.c                 |  4 +-
 drivers/gpu/drm/vgem/vgem_drv.c               |  6 +-
 drivers/gpu/drm/vgem/vgem_fence.c             |  2 +-
 drivers/gpu/drm/virtio/virtgpu_display.c      |  2 +-
 drivers/gpu/drm/virtio/virtgpu_gem.c          |  6 +-
 drivers/gpu/drm/virtio/virtgpu_ioctl.c        |  6 +-
 drivers/gpu/drm/vkms/vkms_gem.c               |  2 +-
 drivers/gpu/drm/xen/xen_drm_front.c           |  4 +-
 include/drm/drm_drv.h                         |  8 ---
 include/drm/drm_gem.h                         | 28 +++-----
 99 files changed, 269 insertions(+), 325 deletions(-)
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 1/36 drm: remove unused drm_gem.h include

From: Emil Velikov <[email protected]>

---
 drivers/gpu/drm/drm_vm.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_vm.c +0 -1
index 56197ae0b2f9..954baa8a2a8f 100644
@@ -51,7 +51,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_file.h>
 #include <drm/drm_framebuffer.h>
-#include <drm/drm_gem.h>
 #include <drm/drm_print.h>
 
 #include "drm_internal.h"
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 1/36
#2 lore raw

Re: [PATCH 01/36] drm: remove unused drm_gem.h include

Am 07.05.20 um 17:07 schrieb Emil Velikov:

Quoted 3 lines

From: Emil Velikov <[email protected]>

Quoted 17 lines
---
 drivers/gpu/drm/drm_vm.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_vm.c +0 -1
index 56197ae0b2f9..954baa8a2a8f 100644
@@ -51,7 +51,6 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_file.h>
 #include <drm/drm_framebuffer.h>
-#include <drm/drm_gem.h>
 #include <drm/drm_print.h>
 
 #include "drm_internal.h"
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

PATCH 2/36 drm/gem: use _unlocked reference in drm_gem_objects_lookup docs

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Use the drm_gem_object_put_unlocked in the documentation for drm_gem_objects_lookup. The locked version of the helper should be used solely by people who know exactly what they are doing.

Should prevent issues like ones adddressed with the next patch.

---
 drivers/gpu/drm/drm_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_gem.c +1 -1
index 7bf628e13023..918d1ba25f63 100644
@@ -690,7 +690,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,
  * Returns:
  *
  * @objs filled in with GEM object pointers. Returned GEM objects need to be
- * released with drm_gem_object_put(). -ENOENT is returned on a lookup
+ * released with drm_gem_object_put_unlocked(). -ENOENT is returned on a lookup
  * failure. 0 is returned on success.
  *
  */
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Re: [PATCH 02/36] drm/gem: use _unlocked reference in drm_gem_objects_lookup docs

Hi Emil.

Quoted 18 lines · Emil Velikov

From: Emil Velikov <[email protected]>

Use the drm_gem_object_put_unlocked in the documentation for drm_gem_objects_lookup. The locked version of the helper should be used solely by people who know exactly what they are doing.

Should prevent issues like ones adddressed with the next patch.

---
 drivers/gpu/drm/drm_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_gem.c +0 -0
index 7bf628e13023..918d1ba25f63 100644

drivers/gpu/drm/drm_gem.c static int objects_lookup(struct drm_file *filp, u32 *handle, int count, · line 696

Quoted 8 lines
drivers/gpu/drm/drm_gem.c +1 -1
@@ -690,7 +690,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,
  * Returns:
  *
  * @objs filled in with GEM object pointers. Returned GEM objects need to be
- * released with drm_gem_object_put(). -ENOENT is returned on a lookup
+ * released with drm_gem_object_put_unlocked(). -ENOENT is returned on a lookup
  * failure. 0 is returned on success.
  *
  */

This change seems pointless as you go ahead and drop the _unlocked suffix a few patches later.

Sam

Quoted 7 lines
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

PATCH 3/36 drm/todo: mention i915 in the struct_mutex section

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

---
i915 uses the _unlocked version of the grm_gem_object API. Yet makes an extensive use of the struct_mutex.

Did not check how exactly it all work though.

---
 Documentation/gpu/todo.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/gpu/todo.rst +2 -2
index 658b52f7ffc6..2ce52c5917f8 100644
@@ -157,8 +157,8 @@ private lock. The tricky part is the BO free functions, since those can't
 reliably take that lock any more. Instead state needs to be protected with
 suitable subordinate locks or some cleanup work pushed to a worker thread. For
 performance-critical drivers it might also be better to go with a more
-fine-grained per-buffer object and per-context lockings scheme. Currently only the
-``msm`` driver still use ``struct_mutex``.
+fine-grained per-buffer object and per-context lockings scheme. Currently only
+the ``msm`` and `i915` drivers use ``struct_mutex``.
 
 Contact: Daniel Vetter, respective driver maintainers
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 3/36
#6 lore raw

Re: [PATCH 03/36] drm/todo: mention i915 in the struct_mutex section

Quoted 8 lines · Emil Velikov

From: Emil Velikov <[email protected]>

---
i915 uses the _unlocked version of the grm_gem_object API. Yet makes an extensive use of the struct_mutex.

Did not check how exactly it all work though.

Quoted 26 lines
---
 Documentation/gpu/todo.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/gpu/todo.rst +2 -2
index 658b52f7ffc6..2ce52c5917f8 100644
@@ -157,8 +157,8 @@ private lock. The tricky part is the BO free functions, since those can't
 reliably take that lock any more. Instead state needs to be protected with
 suitable subordinate locks or some cleanup work pushed to a worker thread. For
 performance-critical drivers it might also be better to go with a more
-fine-grained per-buffer object and per-context lockings scheme. Currently only the
-``msm`` driver still use ``struct_mutex``.
+fine-grained per-buffer object and per-context lockings scheme. Currently only
+the ``msm`` and `i915` drivers use ``struct_mutex``.
 
 Contact: Daniel Vetter, respective driver maintainers
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#7 lore raw

RE: [PATCH 03/36] drm/todo: mention i915 in the struct_mutex section

In reply to Emil Velikov
Quoted 8 lines

-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Emil Velikov
Sent: Thursday, May 7, 2020 11:08 AM
To: [email protected]
Cc: [email protected]
Subject: [PATCH 03/36] drm/todo: mention i915 in the struct_mutex section

Quoted 6 lines

From: Emil Velikov <[email protected]>

---
i915 uses the _unlocked version of the grm_gem_object API. Yet makes an extensive use of the struct_mutex.

s/grm_/drm_/ ?

M

Quoted 25 lines

Did not check how exactly it all work though.
---
Documentation/gpu/todo.rst | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/gpu/todo.rst +0 -0
index 658b52f7ffc6..2ce52c5917f8 100644
@@ -157,8 +157,8 @@ private lock. The tricky part is the BO free functions,

since those can't
reliably take that lock any more. Instead state needs to be protected with suitable subordinate locks or some cleanup work pushed to a worker thread. For
performance-critical drivers it might also be better to go with a more -fine-grained per-buffer object and per-context lockings scheme. Currently only the
-``msm`` driver still use ``struct_mutex``.
+fine-grained per-buffer object and per-context lockings scheme. Currently only
+the ``msm`` and i915 drivers use ``struct_mutex``.

Contact: Daniel Vetter, respective driver maintainers

Quoted 7 lines

--
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

PATCH 4/36 drm/doc: drop struct_mutex references

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

There's little point in providing partial and ancient information about the struct_mutex. Some drivers are using it, new ones should not.

As-it this only provides for confusion.

---
 Documentation/gpu/drm-mm.rst | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Documentation/gpu/drm-mm.rst +2 -5
index 1839762044be..5ba2ead8f317 100644
@@ -178,11 +178,8 @@ GEM Objects Lifetime
 --------------------
 
 All GEM objects are reference-counted by the GEM core. References can be
-acquired and release by calling drm_gem_object_get() and drm_gem_object_put()
-respectively. The caller must hold the :c:type:`struct drm_device <drm_device>`
-struct_mutex lock when calling drm_gem_object_get(). As a convenience, GEM
-provides drm_gem_object_put_unlocked() functions that can be called without
-holding the lock.
+acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked()
+respectively.
 
 When the last reference to a GEM object is released the GEM core calls
 the :c:type:`struct drm_driver <drm_driver>` gem_free_object_unlocked
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#9 lore raw

Re: [PATCH 04/36] drm/doc: drop struct_mutex references

Hi Emil.

Quoted 17 lines · Emil Velikov

From: Emil Velikov <[email protected]>

There's little point in providing partial and ancient information about the struct_mutex. Some drivers are using it, new ones should not.

As-it this only provides for confusion.

---
 Documentation/gpu/drm-mm.rst | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Documentation/gpu/drm-mm.rst +0 -0
index 1839762044be..5ba2ead8f317 100644

Documentation/gpu/drm-mm.rst GEM Objects Lifetime · line 182

Quoted 10 lines
Documentation/gpu/drm-mm.rst +2 -5
@@ -178,11 +178,8 @@ GEM Objects Lifetime
 --------------------
 
 All GEM objects are reference-counted by the GEM core. References can be
-acquired and release by calling drm_gem_object_get() and drm_gem_object_put()
-respectively. The caller must hold the :c:type:`struct drm_device <drm_device>`
-struct_mutex lock when calling drm_gem_object_get(). As a convenience, GEM
-provides drm_gem_object_put_unlocked() functions that can be called without
-holding the lock.
+acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked()
+respectively.

Nice to get rid of struct_mutex lock stuff.
But no need to s/drm_gem_object_put/drm_gem_object_put_unlocked()/ as this will be renamed a bit later.

Sam

Quoted 10 lines
Documentation/gpu/drm-mm.rst +0 -0
 When the last reference to a GEM object is released the GEM core calls
 the :c:type:`struct drm_driver <drm_driver>` gem_free_object_unlocked
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw

Re: [PATCH 04/36] drm/doc: drop struct_mutex references

Hi Sam,

Quoted 23 lines · Sam Ravnborg

Hi Emil.

Quoted 19 lines · Emil Velikov

From: Emil Velikov <[email protected]>

There's little point in providing partial and ancient information about the struct_mutex. Some drivers are using it, new ones should not.

As-it this only provides for confusion.

---
 Documentation/gpu/drm-mm.rst | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Documentation/gpu/drm-mm.rst +0 -0
index 1839762044be..5ba2ead8f317 100644
@@ -178,11 +178,8 @@ GEM Objects Lifetime
 --------------------
 
Quoted 13 lines

Documentation/gpu/drm-mm.rst GEM Objects Lifetime · line 182

Quoted 8 lines
Documentation/gpu/drm-mm.rst +2 -5
 All GEM objects are reference-counted by the GEM core. References can be
-acquired and release by calling drm_gem_object_get() and drm_gem_object_put()
-respectively. The caller must hold the :c:type:`struct drm_device <drm_device>`
-struct_mutex lock when calling drm_gem_object_get(). As a convenience, GEM
-provides drm_gem_object_put_unlocked() functions that can be called without
-holding the lock.
+acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked()
+respectively.

Nice to get rid of struct_mutex lock stuff.
But no need to s/drm_gem_object_put/drm_gem_object_put_unlocked()/ as this will be renamed a bit later.

This patch fixes the documentation, for people looking it today.

While I would love to see the s/_unlocked//g part of the series land, it is rather invasive albeit mechanical.
So driver maintainers are in their right to request that we push it at a later point.

Thus it makes perfect sense to address the two things in separate patches.

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Acked-by
#11 lore raw

Re: [PATCH 04/36] drm/doc: drop struct_mutex references

Hi Emil.

Quoted 39 lines · Emil Velikov

Hi Sam,

Quoted 23 lines · Sam Ravnborg

Hi Emil.

Quoted 19 lines · Emil Velikov

From: Emil Velikov <[email protected]>

There's little point in providing partial and ancient information about the struct_mutex. Some drivers are using it, new ones should not.

As-it this only provides for confusion.

---
 Documentation/gpu/drm-mm.rst | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Documentation/gpu/drm-mm.rst +0 -0
index 1839762044be..5ba2ead8f317 100644
@@ -178,11 +178,8 @@ GEM Objects Lifetime
 --------------------
 
Quoted 13 lines

Documentation/gpu/drm-mm.rst GEM Objects Lifetime · line 182

Quoted 8 lines
Documentation/gpu/drm-mm.rst +2 -5
 All GEM objects are reference-counted by the GEM core. References can be
-acquired and release by calling drm_gem_object_get() and drm_gem_object_put()
-respectively. The caller must hold the :c:type:`struct drm_device <drm_device>`
-struct_mutex lock when calling drm_gem_object_get(). As a convenience, GEM
-provides drm_gem_object_put_unlocked() functions that can be called without
-holding the lock.
+acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked()
+respectively.

Nice to get rid of struct_mutex lock stuff.
But no need to s/drm_gem_object_put/drm_gem_object_put_unlocked()/ as this will be renamed a bit later.

Quoted 6 lines

This patch fixes the documentation, for people looking it today.

While I would love to see the s/_unlocked//g part of the series land, it is rather invasive albeit mechanical.
So driver maintainers are in their right to request that we push it at a later point.

Well, unless there is push-back within a week from one of the maintainers then we should apply the full series at drm-misc-next. Maybe wiht a gently ping in mid next week.

No reason to wait for individual maintaintes to pick it up driver-by-driver. This would make such nice refactoring as this far to hard to do especially due to the dependencies to the first patches.

But I see your rationale for keeping it like it is. So you can stick an

on the rest of the patches.

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#12 lore raw

Re: [PATCH 04/36] drm/doc: drop struct_mutex references

In reply to Emil Velikov
Quoted 8 lines · Emil Velikov

From: Emil Velikov <[email protected]>

There's little point in providing partial and ancient information about the struct_mutex. Some drivers are using it, new ones should not.

As-it this only provides for confusion.

I think a doc patch to add a big warning for drm_device.struct_mutex would also be good. The current text is kinda unhelpful.
-Daniel

Quoted 29 lines
---
 Documentation/gpu/drm-mm.rst | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Documentation/gpu/drm-mm.rst +2 -5
index 1839762044be..5ba2ead8f317 100644
@@ -178,11 +178,8 @@ GEM Objects Lifetime
 --------------------
 
 All GEM objects are reference-counted by the GEM core. References can be
-acquired and release by calling drm_gem_object_get() and drm_gem_object_put()
-respectively. The caller must hold the :c:type:`struct drm_device <drm_device>`
-struct_mutex lock when calling drm_gem_object_get(). As a convenience, GEM
-provides drm_gem_object_put_unlocked() functions that can be called without
-holding the lock.
+acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked()
+respectively.
 
 When the last reference to a GEM object is released the GEM core calls
 the :c:type:`struct drm_driver <drm_driver>` gem_free_object_unlocked
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw

Re: [PATCH 04/36] drm/doc: drop struct_mutex references

Quoted 7 lines · Daniel Vetter
Quoted 5 lines · Emil Velikov

From: Emil Velikov <[email protected]>

There's little point in providing partial and ancient information about the struct_mutex. Some drivers are using it, new ones should not.

Quoted 6 lines
Quoted 3 lines

As-it this only provides for confusion.

I think a doc patch to add a big warning for drm_device.struct_mutex would also be good. The current text is kinda unhelpful.

Would something like this be enough?

include/drm/drm_device.h +3 -0
index a55874db9dd4..0988351d743c 100644
@@ -146,6 +146,9 @@ struct drm_device {
  * @struct_mutex:
  *
  * Lock for others (not &drm_minor.master and &drm_file.is_master)
+ *
+ * WARNING:
+ * Only drivers annotated with DRIVER_LEGACY should be using this.
  */
  struct mutex struct_mutex;
 

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by
#14 lore raw

Re: [PATCH 04/36] drm/doc: drop struct_mutex references

Quoted 22 lines · Emil Velikov
Quoted 7 lines · Daniel Vetter
Quoted 5 lines · Emil Velikov

From: Emil Velikov <[email protected]>

There's little point in providing partial and ancient information about the struct_mutex. Some drivers are using it, new ones should not.

Quoted 6 lines
Quoted 3 lines

As-it this only provides for confusion.

I think a doc patch to add a big warning for drm_device.struct_mutex would also be good. The current text is kinda unhelpful.

Would something like this be enough?

include/drm/drm_device.h +0 -0
index a55874db9dd4..0988351d743c 100644

include/drm/drm_device.h struct drm_device { · line 151

Quoted 6 lines
include/drm/drm_device.h +3 -0
@@ -146,6 +146,9 @@ struct drm_device {
  * @struct_mutex:
  *
  * Lock for others (not &drm_minor.master and &drm_file.is_master)
+ *
+ * WARNING:
+ * Only drivers annotated with DRIVER_LEGACY should be using this.

Assuming you wrap it in some suitable commit and all that. -Daniel

Quoted 4 lines
include/drm/drm_device.h +0 -1
  */
  struct mutex struct_mutex;
 
-Emil
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#15 lore raw

PATCH 5/36 drm/doc: drop struct_mutex refernce for drm_gem_object_free

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

The comment that struct_mutex must be held is misleading. It is only required when .gem_free_object() is used.

Since that one is going with the next patches, drop the reference.

---
 drivers/gpu/drm/drm_gem.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_gem.c +0 -1
index 918d1ba25f63..12fa121d0966 100644
@@ -965,7 +965,6 @@ EXPORT_SYMBOL(drm_gem_object_release);
  * @kref: kref of the object to free
  *
  * Called after the last reference to the object has been lost.
- * Must be called holding &drm_device.struct_mutex.
  *
  * Frees the object
  */
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 5/36
#16 lore raw

Re: [PATCH 05/36] drm/doc: drop struct_mutex refernce for drm_gem_object_free

Quoted 8 lines · Emil Velikov

From: Emil Velikov <[email protected]>

The comment that struct_mutex must be held is misleading. It is only required when .gem_free_object() is used.

Since that one is going with the next patches, drop the reference.

Quoted 23 lines
---
 drivers/gpu/drm/drm_gem.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_gem.c +0 -1
index 918d1ba25f63..12fa121d0966 100644
@@ -965,7 +965,6 @@ EXPORT_SYMBOL(drm_gem_object_release);
  * @kref: kref of the object to free
  *
  * Called after the last reference to the object has been lost.
- * Must be called holding &drm_device.struct_mutex.
  *
  * Frees the object
  */
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#17 lore raw

PATCH 6/36 drm/amdgpu: use the unlocked drm_gem_object_put

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

The driver does not hold struct_mutex, thus using the locked version of the helper is incorrect.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Fixes a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
index 43d8ed7dbd00..652c57a3b847 100644
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
 	attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
 					&amdgpu_dma_buf_attach_ops, obj);
 	if (IS_ERR(attach)) {
-		drm_gem_object_put(obj);
+		drm_gem_object_put_unlocked(obj);
 		return ERR_CAST(attach);
 	}
 
Signature · 6 lines
2.25.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#18 lore raw

Re: [PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put

Hi Emil.

Quoted 19 lines · Emil Velikov

From: Emil Velikov <[email protected]>

The driver does not hold struct_mutex, thus using the locked version of the helper is incorrect.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Fixes a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +0 -0
index 43d8ed7dbd00..652c57a3b847 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, · line 592

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
 	attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
 					&amdgpu_dma_buf_attach_ops, obj);
 	if (IS_ERR(attach)) {
-		drm_gem_object_put(obj);
+		drm_gem_object_put_unlocked(obj);
 		return ERR_CAST(attach);
 	}

Likewise previous patch.
Drop this as the patch is correct after the rename a few pathces later.

Sam

Quoted 8 lines
Signature · 7 lines
-- 
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

maintainer
#19 lore raw

Re: [PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put

Am 07.05.20 um 20:03 schrieb Sam Ravnborg:

Quoted 17 lines

Hi Emil.

Quoted 14 lines · Emil Velikov

From: Emil Velikov <[email protected]>

The driver does not hold struct_mutex, thus using the locked version of the helper is incorrect.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Fixes a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, · line 592

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
index 43d8ed7dbd00..652c57a3b847 100644
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
  	attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
  					&amdgpu_dma_buf_attach_ops, obj);
  	if (IS_ERR(attach)) {
-		drm_gem_object_put(obj);
+		drm_gem_object_put_unlocked(obj);
  		return ERR_CAST(attach);
  	}

Likewise previous patch.
Drop this as the patch is correct after the rename a few pathces later.

Well this is a bug fix in the error path and should probably be back ported, so having a separate patch is certainly a good idea.

Christian.

Quoted 11 lines

Sam

Quoted 8 lines
Signature · 7 lines
-- 
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Fdri-devel&amp;data=02%7C01%7Cchristian.koenig%40amd.com%7C41036bd7ab804d8bebdf08d7f2b0e938%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637244713989571165&amp;sdata=d0LysMNmsc%2BSzSkYsZDmE43azU0nmAb%2B1tFHn%2BMNxDg%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#20 lore raw

Re: [PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put

Quoted 34 lines · Christian König

Am 07.05.20 um 20:03 schrieb Sam Ravnborg:

Quoted 17 lines

Hi Emil.

Quoted 14 lines · Emil Velikov

From: Emil Velikov <[email protected]>

The driver does not hold struct_mutex, thus using the locked version of the helper is incorrect.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Fixes a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, · line 592

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
index 43d8ed7dbd00..652c57a3b847 100644
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
     attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
                                     &amdgpu_dma_buf_attach_ops, obj);
     if (IS_ERR(attach)) {
-            drm_gem_object_put(obj);
+            drm_gem_object_put_unlocked(obj);
             return ERR_CAST(attach);
     }

Likewise previous patch.
Drop this as the patch is correct after the rename a few pathces later.

Quoted 3 lines

Well this is a bug fix in the error path and should probably be back ported, so having a separate patch is certainly a good idea.

Precisely the goal here. The fixes tag should allow Greg and team to pick/port it where applicable.

-Emil
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#21 lore raw

Re: [PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put

Quoted 35 lines · Emil Velikov
Quoted 34 lines · Christian König

Am 07.05.20 um 20:03 schrieb Sam Ravnborg:

Quoted 31 lines

Hi Emil.

Quoted 19 lines · Emil Velikov

From: Emil Velikov <[email protected]>

The driver does not hold struct_mutex, thus using the locked version of the helper is incorrect.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Fixes a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +0 -0
index 43d8ed7dbd00..652c57a3b847 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, · line 592

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
     attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
                                     &amdgpu_dma_buf_attach_ops, obj);
     if (IS_ERR(attach)) {
-            drm_gem_object_put(obj);
+            drm_gem_object_put_unlocked(obj);
             return ERR_CAST(attach);
     }

Likewise previous patch.
Drop this as the patch is correct after the rename a few pathces later.

Quoted 5 lines
Quoted 3 lines

Well this is a bug fix in the error path and should probably be back ported, so having a separate patch is certainly a good idea.

Precisely the goal here. The fixes tag should allow Greg and team to pick/port it where applicable.

I got it now... Thanks for spelling it out for my dense mind.

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 6/36
#22 lore raw

Re: [PATCH 06/36] drm/amdgpu: use the unlocked drm_gem_object_put

In reply to Emil Velikov

Am 07.05.20 um 17:07 schrieb Emil Velikov:

Quoted 10 lines

From: Emil Velikov <[email protected]>

The driver does not hold struct_mutex, thus using the locked version of the helper is incorrect.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Fixes a39414716ca0 ("drm/amdgpu: add independent DMA-buf import v9"):
Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +0 -0
index 43d8ed7dbd00..652c57a3b847 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, · line 593

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
  	attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
  					&amdgpu_dma_buf_attach_ops, obj);
  	if (IS_ERR(attach)) {
-		drm_gem_object_put(obj);
+		drm_gem_object_put_unlocked(obj);
  		return ERR_CAST(attach);
  	}
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#23 lore raw

PATCH 7/36 drm/gma500: Use lockless gem BO free callback

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

No dev->struct_mutex anywhere to be seen.

Cc Patrik Jakobsson <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/gma500/psb_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/gma500/psb_drv.c +1 -1
index 2411eb9827b8..34b4aae9a15e 100644
@@ -507,7 +507,7 @@ static struct drm_driver driver = {
 	.irq_uninstall = psb_irq_uninstall,
 	.irq_handler = psb_irq_handler,
 
-	.gem_free_object = psb_gem_free_object,
+	.gem_free_object_unlocked = psb_gem_free_object,
 	.gem_vm_ops = &psb_gem_vm_ops,
 
 	.dumb_create = psb_gem_dumb_create,
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 7/36
#24 lore raw

Re: [PATCH 07/36] drm/gma500: Use lockless gem BO free callback

Hi

Am 07.05.20 um 17:07 schrieb Emil Velikov:

Quoted 16 lines

From: Emil Velikov <[email protected]>

No dev->struct_mutex anywhere to be seen.

Cc Patrik Jakobsson <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/gma500/psb_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/gma500/psb_drv.c +0 -0
index 2411eb9827b8..34b4aae9a15e 100644

drivers/gpu/drm/gma500/psb_drv.c static struct drm_driver driver = { · line 510

Quoted 5 lines
drivers/gpu/drm/gma500/psb_drv.c +1 -1
@@ -507,7 +507,7 @@ static struct drm_driver driver = {
 	.irq_uninstall = psb_irq_uninstall,
 	.irq_handler = psb_irq_handler,
 
-	.gem_free_object = psb_gem_free_object,
+	.gem_free_object_unlocked = psb_gem_free_object,

I'd also rename the function to psb_gem_free_object_unlocked(). In any case

Quoted 4 lines
drivers/gpu/drm/gma500/psb_drv.c +0 -0
 	.gem_vm_ops = &psb_gem_vm_ops,
 
 	.dumb_create = psb_gem_dumb_create,
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#25 lore raw

PATCH 8/36 drm: remove drm_driver::gem_free_object

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

No drivers set the callback, so remove it all together.

---
 drivers/gpu/drm/drm_gem.c | 22 +++-------------------
 include/drm/drm_drv.h     |  8 --------
 include/drm/drm_gem.h     |  5 +++--
 3 files changed, 6 insertions(+), 29 deletions(-)
drivers/gpu/drm/drm_gem.c +3 -19
index 12fa121d0966..dab8763b2e73 100644
@@ -975,15 +975,10 @@ drm_gem_object_free(struct kref *kref)
 		container_of(kref, struct drm_gem_object, refcount);
 	struct drm_device *dev = obj->dev;
 
-	if (obj->funcs) {
+	if (obj->funcs)
 		obj->funcs->free(obj);
-	} else if (dev->driver->gem_free_object_unlocked) {
+	else if (dev->driver->gem_free_object_unlocked)
 		dev->driver->gem_free_object_unlocked(obj);
-	} else if (dev->driver->gem_free_object) {
-		WARN_ON(!mutex_is_locked(&dev->struct_mutex));
-
-		dev->driver->gem_free_object(obj);
-	}
 }
 EXPORT_SYMBOL(drm_gem_object_free);
 
@@ -999,21 +994,10 @@ EXPORT_SYMBOL(drm_gem_object_free);
 void
 drm_gem_object_put_unlocked(struct drm_gem_object *obj)
 {
-	struct drm_device *dev;
-
 	if (!obj)
 		return;
 
-	dev = obj->dev;
-
-	if (dev->driver->gem_free_object) {
-		might_lock(&dev->struct_mutex);
-		if (kref_put_mutex(&obj->refcount, drm_gem_object_free,
-				&dev->struct_mutex))
-			mutex_unlock(&dev->struct_mutex);
-	} else {
-		kref_put(&obj->refcount, drm_gem_object_free);
-	}
+	kref_put(&obj->refcount, drm_gem_object_free);
 }
 EXPORT_SYMBOL(drm_gem_object_put_unlocked);
 
include/drm/drm_drv.h +0 -8
index 6d457652f199..e6eff508f687 100644
@@ -327,14 +327,6 @@ struct drm_driver {
 	 */
 	void (*debugfs_init)(struct drm_minor *minor);
 
-	/**
-	 * @gem_free_object: deconstructor for drm_gem_objects
-	 *
-	 * This is deprecated and should not be used by new drivers. Use
-	 * &drm_gem_object_funcs.free instead.
-	 */
-	void (*gem_free_object) (struct drm_gem_object *obj);
-
 	/**
 	 * @gem_free_object_unlocked: deconstructor for drm_gem_objects
 	 *
include/drm/drm_gem.h +3 -2
index 0b375069cd48..ec2d24a60a76 100644
@@ -272,8 +272,9 @@ struct drm_gem_object {
 	 * attachment point for the device. This is invariant over the lifetime
 	 * of a gem object.
 	 *
-	 * The &drm_driver.gem_free_object callback is responsible for cleaning
-	 * up the dma_buf attachment and references acquired at import time.
+	 * The &drm_driver.gem_free_object_unlocked callback is responsible for
+	 * cleaning up the dma_buf attachment and references acquired at import
+	 * time.
 	 *
 	 * Note that the drm gem/prime core does not depend upon drivers setting
 	 * this field any more. So for drivers where this doesn't make sense
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 8/36
#26 lore raw

Re: [PATCH 08/36] drm: remove drm_driver::gem_free_object

Am 07.05.20 um 17:07 schrieb Emil Velikov:

Quoted 5 lines

From: Emil Velikov <[email protected]>

No drivers set the callback, so remove it all together.

Quoted 87 lines
---
 drivers/gpu/drm/drm_gem.c | 22 +++-------------------
 include/drm/drm_drv.h     |  8 --------
 include/drm/drm_gem.h     |  5 +++--
 3 files changed, 6 insertions(+), 29 deletions(-)
drivers/gpu/drm/drm_gem.c +3 -19
index 12fa121d0966..dab8763b2e73 100644
@@ -975,15 +975,10 @@ drm_gem_object_free(struct kref *kref)
 		container_of(kref, struct drm_gem_object, refcount);
 	struct drm_device *dev = obj->dev;
 
-	if (obj->funcs) {
+	if (obj->funcs)
 		obj->funcs->free(obj);
-	} else if (dev->driver->gem_free_object_unlocked) {
+	else if (dev->driver->gem_free_object_unlocked)
 		dev->driver->gem_free_object_unlocked(obj);
-	} else if (dev->driver->gem_free_object) {
-		WARN_ON(!mutex_is_locked(&dev->struct_mutex));
-
-		dev->driver->gem_free_object(obj);
-	}
 }
 EXPORT_SYMBOL(drm_gem_object_free);
 
@@ -999,21 +994,10 @@ EXPORT_SYMBOL(drm_gem_object_free);
 void
 drm_gem_object_put_unlocked(struct drm_gem_object *obj)
 {
-	struct drm_device *dev;
-
 	if (!obj)
 		return;
 
-	dev = obj->dev;
-
-	if (dev->driver->gem_free_object) {
-		might_lock(&dev->struct_mutex);
-		if (kref_put_mutex(&obj->refcount, drm_gem_object_free,
-				&dev->struct_mutex))
-			mutex_unlock(&dev->struct_mutex);
-	} else {
-		kref_put(&obj->refcount, drm_gem_object_free);
-	}
+	kref_put(&obj->refcount, drm_gem_object_free);
 }
 EXPORT_SYMBOL(drm_gem_object_put_unlocked);
 
include/drm/drm_drv.h +0 -8
index 6d457652f199..e6eff508f687 100644
@@ -327,14 +327,6 @@ struct drm_driver {
 	 */
 	void (*debugfs_init)(struct drm_minor *minor);
 
-	/**
-	 * @gem_free_object: deconstructor for drm_gem_objects
-	 *
-	 * This is deprecated and should not be used by new drivers. Use
-	 * &drm_gem_object_funcs.free instead.
-	 */
-	void (*gem_free_object) (struct drm_gem_object *obj);
-
 	/**
 	 * @gem_free_object_unlocked: deconstructor for drm_gem_objects
 	 *
include/drm/drm_gem.h +3 -2
index 0b375069cd48..ec2d24a60a76 100644
@@ -272,8 +272,9 @@ struct drm_gem_object {
 	 * attachment point for the device. This is invariant over the lifetime
 	 * of a gem object.
 	 *
-	 * The &drm_driver.gem_free_object callback is responsible for cleaning
-	 * up the dma_buf attachment and references acquired at import time.
+	 * The &drm_driver.gem_free_object_unlocked callback is responsible for
+	 * cleaning up the dma_buf attachment and references acquired at import
+	 * time.
 	 *
 	 * Note that the drm gem/prime core does not depend upon drivers setting
 	 * this field any more. So for drivers where this doesn't make sense
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#27 lore raw

PATCH 9/36 drm/gem: fold drm_gem_object_put_unlocked and __drm_gem_object_put()

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

With earlier patch we removed the normal overhead so now we can lift the helper to the header, folding it __drm_object_put.

---
 drivers/gpu/drm/drm_gem.c                  | 19 -------------------
 drivers/gpu/drm/i915/gem/i915_gem_object.h |  2 +-
 include/drm/drm_gem.h                      | 17 ++++-------------
 3 files changed, 5 insertions(+), 33 deletions(-)
drivers/gpu/drm/drm_gem.c +0 -19
index dab8763b2e73..599d5ff53b73 100644
@@ -982,25 +982,6 @@ drm_gem_object_free(struct kref *kref)
 }
 EXPORT_SYMBOL(drm_gem_object_free);
 
-/**
- * drm_gem_object_put_unlocked - drop a GEM buffer object reference
- * @obj: GEM buffer object
- *
- * This releases a reference to @obj. Callers must not hold the
- * &drm_device.struct_mutex lock when calling this function.
- *
- * See also __drm_gem_object_put().
- */
-void
-drm_gem_object_put_unlocked(struct drm_gem_object *obj)
-{
-	if (!obj)
-		return;
-
-	kref_put(&obj->refcount, drm_gem_object_free);
-}
-EXPORT_SYMBOL(drm_gem_object_put_unlocked);
-
 /**
  * drm_gem_object_put - release a GEM buffer object reference
  * @obj: GEM buffer object
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -1
index 2faa481cc18f..41351cbf31b5 100644
@@ -105,7 +105,7 @@ __attribute__((nonnull))
 static inline void
 i915_gem_object_put(struct drm_i915_gem_object *obj)
 {
-	__drm_gem_object_put(&obj->base);
+	drm_gem_object_put_unlocked(&obj->base);
 }
 
 #define assert_object_held(obj) dma_resv_assert_held((obj)->base.resv)
include/drm/drm_gem.h +4 -13
index ec2d24a60a76..7c877bea7b3a 100644
@@ -364,27 +364,18 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj)
 }
 
 /**
- * __drm_gem_object_put - raw function to release a GEM buffer object reference
+ * drm_gem_object_put_unlocked - drop a GEM buffer object reference
  * @obj: GEM buffer object
  *
- * This function is meant to be used by drivers which are not encumbered with
- * &drm_device.struct_mutex legacy locking and which are using the
- * gem_free_object_unlocked callback. It avoids all the locking checks and
- * locking overhead of drm_gem_object_put() and drm_gem_object_put_unlocked().
- *
- * Drivers should never call this directly in their code. Instead they should
- * wrap it up into a ``driver_gem_object_put(struct driver_gem_object *obj)``
- * wrapper function, and use that. Shared code should never call this, to
- * avoid breaking drivers by accident which still depend upon
- * &drm_device.struct_mutex locking.
+ * This releases a reference to @obj. Callers must not hold the
+ * &drm_device.struct_mutex lock when calling this function.
  */
 static inline void
-__drm_gem_object_put(struct drm_gem_object *obj)
+drm_gem_object_put_unlocked(struct drm_gem_object *obj)
 {
 	kref_put(&obj->refcount, drm_gem_object_free);
 }
 
-void drm_gem_object_put_unlocked(struct drm_gem_object *obj);
 void drm_gem_object_put(struct drm_gem_object *obj);
 
 int drm_gem_handle_create(struct drm_file *file_priv,
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 9/36
#28 lore raw

Re: [PATCH 09/36] drm/gem: fold drm_gem_object_put_unlocked and __drm_gem_object_put()

Quoted 69 lines · Emil Velikov

From: Emil Velikov <[email protected]>

With earlier patch we removed the normal overhead so now we can lift the helper to the header, folding it __drm_object_put.

---
 drivers/gpu/drm/drm_gem.c                  | 19 -------------------
 drivers/gpu/drm/i915/gem/i915_gem_object.h |  2 +-
 include/drm/drm_gem.h                      | 17 ++++-------------
 3 files changed, 5 insertions(+), 33 deletions(-)
drivers/gpu/drm/drm_gem.c +0 -19
index dab8763b2e73..599d5ff53b73 100644
@@ -982,25 +982,6 @@ drm_gem_object_free(struct kref *kref)
 }
 EXPORT_SYMBOL(drm_gem_object_free);
 
-/**
- * drm_gem_object_put_unlocked - drop a GEM buffer object reference
- * @obj: GEM buffer object
- *
- * This releases a reference to @obj. Callers must not hold the
- * &drm_device.struct_mutex lock when calling this function.
- *
- * See also __drm_gem_object_put().
- */
-void
-drm_gem_object_put_unlocked(struct drm_gem_object *obj)
-{
-	if (!obj)
-		return;
-
-	kref_put(&obj->refcount, drm_gem_object_free);
-}
-EXPORT_SYMBOL(drm_gem_object_put_unlocked);
-
 /**
  * drm_gem_object_put - release a GEM buffer object reference
  * @obj: GEM buffer object
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -1
index 2faa481cc18f..41351cbf31b5 100644
@@ -105,7 +105,7 @@ __attribute__((nonnull))
 static inline void
 i915_gem_object_put(struct drm_i915_gem_object *obj)
 {
-	__drm_gem_object_put(&obj->base);
+	drm_gem_object_put_unlocked(&obj->base);
 }
 
 #define assert_object_held(obj) dma_resv_assert_held((obj)->base.resv)
include/drm/drm_gem.h +1 -3
index ec2d24a60a76..7c877bea7b3a 100644
@@ -364,27 +364,18 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj)
 }
 
 /**
- * __drm_gem_object_put - raw function to release a GEM buffer object reference
+ * drm_gem_object_put_unlocked - drop a GEM buffer object reference
  * @obj: GEM buffer object
  *
- * This function is meant to be used by drivers which are not encumbered with
- * &drm_device.struct_mutex legacy locking and which are using the

include/drm/drm_gem.h static inline void drm_gem_object_get(struct drm_gem_object *obj) · line 371

Quoted 10 lines
include/drm/drm_gem.h +2 -8
- * gem_free_object_unlocked callback. It avoids all the locking checks and
- * locking overhead of drm_gem_object_put() and drm_gem_object_put_unlocked().
- *
- * Drivers should never call this directly in their code. Instead they should
- * wrap it up into a ``driver_gem_object_put(struct driver_gem_object *obj)``
- * wrapper function, and use that. Shared code should never call this, to
- * avoid breaking drivers by accident which still depend upon
- * &drm_device.struct_mutex locking.
+ * This releases a reference to @obj. Callers must not hold the
+ * &drm_device.struct_mutex lock when calling this function.

2nd sentence talking about struct_mutex isn't true anymore, since nothing in here calls mutex_lock(obj->dev->struct_mutex); With your cleanup here we officially don't care about struct_mutex in the drm core!

Aside from that lgtm, with that sentence removed:

Quoted 19 lines
include/drm/drm_gem.h +1 -2
  */
 static inline void
-__drm_gem_object_put(struct drm_gem_object *obj)
+drm_gem_object_put_unlocked(struct drm_gem_object *obj)
 {
 	kref_put(&obj->refcount, drm_gem_object_free);
 }
 
-void drm_gem_object_put_unlocked(struct drm_gem_object *obj);
 void drm_gem_object_put(struct drm_gem_object *obj);
 
 int drm_gem_handle_create(struct drm_file *file_priv,
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#29 lore raw

Re: [PATCH 09/36] drm/gem: fold drm_gem_object_put_unlocked and __drm_gem_object_put()

Quoted 86 lines · Daniel Vetter
Quoted 69 lines · Emil Velikov

From: Emil Velikov <[email protected]>

With earlier patch we removed the normal overhead so now we can lift the helper to the header, folding it __drm_object_put.

---
 drivers/gpu/drm/drm_gem.c                  | 19 -------------------
 drivers/gpu/drm/i915/gem/i915_gem_object.h |  2 +-
 include/drm/drm_gem.h                      | 17 ++++-------------
 3 files changed, 5 insertions(+), 33 deletions(-)
drivers/gpu/drm/drm_gem.c +0 -19
index dab8763b2e73..599d5ff53b73 100644
@@ -982,25 +982,6 @@ drm_gem_object_free(struct kref *kref)
 }
 EXPORT_SYMBOL(drm_gem_object_free);
 
-/**
- * drm_gem_object_put_unlocked - drop a GEM buffer object reference
- * @obj: GEM buffer object
- *
- * This releases a reference to @obj. Callers must not hold the
- * &drm_device.struct_mutex lock when calling this function.
- *
- * See also __drm_gem_object_put().
- */
-void
-drm_gem_object_put_unlocked(struct drm_gem_object *obj)
-{
-     if (!obj)
-             return;
-
-     kref_put(&obj->refcount, drm_gem_object_free);
-}
-EXPORT_SYMBOL(drm_gem_object_put_unlocked);
-
 /**
  * drm_gem_object_put - release a GEM buffer object reference
  * @obj: GEM buffer object
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -1
index 2faa481cc18f..41351cbf31b5 100644
@@ -105,7 +105,7 @@ __attribute__((nonnull))
 static inline void
 i915_gem_object_put(struct drm_i915_gem_object *obj)
 {
-     __drm_gem_object_put(&obj->base);
+     drm_gem_object_put_unlocked(&obj->base);
 }
 
 #define assert_object_held(obj) dma_resv_assert_held((obj)->base.resv)
include/drm/drm_gem.h +1 -3
index ec2d24a60a76..7c877bea7b3a 100644
@@ -364,27 +364,18 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj)
 }
 
 /**
- * __drm_gem_object_put - raw function to release a GEM buffer object reference
+ * drm_gem_object_put_unlocked - drop a GEM buffer object reference
  * @obj: GEM buffer object
  *
- * This function is meant to be used by drivers which are not encumbered with
- * &drm_device.struct_mutex legacy locking and which are using the

include/drm/drm_gem.h static inline void drm_gem_object_get(struct drm_gem_object *obj) · line 371

Quoted 10 lines
include/drm/drm_gem.h +2 -8
- * gem_free_object_unlocked callback. It avoids all the locking checks and
- * locking overhead of drm_gem_object_put() and drm_gem_object_put_unlocked().
- *
- * Drivers should never call this directly in their code. Instead they should
- * wrap it up into a ``driver_gem_object_put(struct driver_gem_object *obj)``
- * wrapper function, and use that. Shared code should never call this, to
- * avoid breaking drivers by accident which still depend upon
- * &drm_device.struct_mutex locking.
+ * This releases a reference to @obj. Callers must not hold the
+ * &drm_device.struct_mutex lock when calling this function.

2nd sentence talking about struct_mutex isn't true anymore, since nothing in here calls mutex_lock(obj->dev->struct_mutex); With your cleanup here we officially don't care about struct_mutex in the drm core!

Quoted 2 lines

Aside from that lgtm, with that sentence removed:

Seems like I've forgot another reference in the documentation for "gem_free_object_unlocked"

Quoted 2 lines

Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#30 lore raw

PATCH 10/36 drm/gem: add _locked suffix to drm_object_put

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Vast majority of DRM (core and drivers) are struct_mutex free.

As such we have only a handful of cases where the locked helper should be used. Make that stand out a little bit better.

Done via the following script:

__from=drm_gem_object_put
__to=drm_gem_object_put_locked

for __file in $(git grep --name-only --word-regexp $__from); do
sed -i "s/\<$__from\>/$__to/g" $__file;
done

---
 drivers/gpu/drm/drm_gem.c                 | 6 +++---
 drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 4 ++--
 drivers/gpu/drm/msm/msm_drv.c             | 2 +-
 drivers/gpu/drm/msm/msm_gem.c             | 6 +++---
 drivers/gpu/drm/msm/msm_gem_submit.c      | 2 +-
 drivers/gpu/drm/msm/msm_gpu.c             | 2 +-
 include/drm/drm_gem.h                     | 4 ++--
 7 files changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_gem.c +3 -3
index 599d5ff53b73..f21327ebc562 100644
@@ -983,7 +983,7 @@ drm_gem_object_free(struct kref *kref)
 EXPORT_SYMBOL(drm_gem_object_free);
 
 /**
- * drm_gem_object_put - release a GEM buffer object reference
+ * drm_gem_object_put_locked - release a GEM buffer object reference
  * @obj: GEM buffer object
  *
  * This releases a reference to @obj. Callers must hold the
@@ -994,7 +994,7 @@ EXPORT_SYMBOL(drm_gem_object_free);
  * drm_gem_object_put_unlocked() instead.
  */
 void
-drm_gem_object_put(struct drm_gem_object *obj)
+drm_gem_object_put_locked(struct drm_gem_object *obj)
 {
 	if (obj) {
 		WARN_ON(!mutex_is_locked(&obj->dev->struct_mutex));
@@ -1002,7 +1002,7 @@ drm_gem_object_put(struct drm_gem_object *obj)
 		kref_put(&obj->refcount, drm_gem_object_free);
 	}
 }
-EXPORT_SYMBOL(drm_gem_object_put);
+EXPORT_SYMBOL(drm_gem_object_put_locked);
 
 /**
  * drm_gem_vm_open - vma->ops->open implementation for GEM
drivers/gpu/drm/msm/adreno/a5xx_debugfs.c +2 -2
index 8cae2ca4af6b..68eddac7771c 100644
@@ -124,13 +124,13 @@ reset_set(void *data, u64 val)
 
 	if (a5xx_gpu->pm4_bo) {
 		msm_gem_unpin_iova(a5xx_gpu->pm4_bo, gpu->aspace);
-		drm_gem_object_put(a5xx_gpu->pm4_bo);
+		drm_gem_object_put_locked(a5xx_gpu->pm4_bo);
 		a5xx_gpu->pm4_bo = NULL;
 	}
 
 	if (a5xx_gpu->pfp_bo) {
 		msm_gem_unpin_iova(a5xx_gpu->pfp_bo, gpu->aspace);
-		drm_gem_object_put(a5xx_gpu->pfp_bo);
+		drm_gem_object_put_locked(a5xx_gpu->pfp_bo);
 		a5xx_gpu->pfp_bo = NULL;
 	}
 
drivers/gpu/drm/msm/msm_drv.c +1 -1
index 29295dee2a2e..6baed5b43ea3 100644
@@ -932,7 +932,7 @@ static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data,
 		ret = 0;
 	}
 
-	drm_gem_object_put(obj);
+	drm_gem_object_put_locked(obj);
 
 unlock:
 	mutex_unlock(&dev->struct_mutex);
drivers/gpu/drm/msm/msm_gem.c +3 -3
index 5a6a79fbc9d6..8696c405f709 100644
@@ -879,7 +879,7 @@ void msm_gem_describe_objects(struct list_head *list, struct seq_file *m)
 }
 #endif
 
-/* don't call directly!  Use drm_gem_object_put() and friends */
+/* don't call directly!  Use drm_gem_object_put_locked() and friends */
 void msm_gem_free_object(struct drm_gem_object *obj)
 {
 	struct msm_gem_object *msm_obj = to_msm_bo(obj);
@@ -1183,7 +1183,7 @@ static void *_msm_gem_kernel_new(struct drm_device *dev, uint32_t size,
 	return vaddr;
 err:
 	if (locked)
-		drm_gem_object_put(obj);
+		drm_gem_object_put_locked(obj);
 	else
 		drm_gem_object_put_unlocked(obj);
 
@@ -1215,7 +1215,7 @@ void msm_gem_kernel_put(struct drm_gem_object *bo,
 	msm_gem_unpin_iova(bo, aspace);
 
 	if (locked)
-		drm_gem_object_put(bo);
+		drm_gem_object_put_locked(bo);
 	else
 		drm_gem_object_put_unlocked(bo);
 }
drivers/gpu/drm/msm/msm_gem_submit.c +1 -1
index 385d4965a8d0..8f450a245cfb 100644
@@ -387,7 +387,7 @@ static void submit_cleanup(struct msm_gem_submit *submit)
 		struct msm_gem_object *msm_obj = submit->bos[i].obj;
 		submit_unlock_unpin_bo(submit, i, false);
 		list_del_init(&msm_obj->submit_entry);
-		drm_gem_object_put(&msm_obj->base);
+		drm_gem_object_put_locked(&msm_obj->base);
 	}
 }
 
drivers/gpu/drm/msm/msm_gpu.c +1 -1
index 615c5cda5389..86a68f96c48d 100644
@@ -694,7 +694,7 @@ static void retire_submit(struct msm_gpu *gpu, struct msm_ringbuffer *ring,
 		/* move to inactive: */
 		msm_gem_move_to_inactive(&msm_obj->base);
 		msm_gem_unpin_iova(&msm_obj->base, submit->aspace);
-		drm_gem_object_put(&msm_obj->base);
+		drm_gem_object_put_locked(&msm_obj->base);
 	}
 
 	pm_runtime_mark_last_busy(&gpu->pdev->dev);
include/drm/drm_gem.h +2 -2
index 7c877bea7b3a..0f22f3320dcb 100644
@@ -187,7 +187,7 @@ struct drm_gem_object {
 	 *
 	 * Reference count of this object
 	 *
-	 * Please use drm_gem_object_get() to acquire and drm_gem_object_put()
+	 * Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked()
 	 * or drm_gem_object_put_unlocked() to release a reference to a GEM
 	 * buffer object.
 	 */
@@ -376,7 +376,7 @@ drm_gem_object_put_unlocked(struct drm_gem_object *obj)
 	kref_put(&obj->refcount, drm_gem_object_free);
 }
 
-void drm_gem_object_put(struct drm_gem_object *obj);
+void drm_gem_object_put_locked(struct drm_gem_object *obj);
 
 int drm_gem_handle_create(struct drm_file *file_priv,
 			  struct drm_gem_object *obj,
Signature · 1 line
2.25.1
#31 lore raw

Re: [PATCH 10/36] drm/gem: add _locked suffix to drm_object_put

Quoted 12 lines · Emil Velikov

From: Emil Velikov <[email protected]>

Vast majority of DRM (core and drivers) are struct_mutex free.

As such we have only a handful of cases where the locked helper should be used. Make that stand out a little bit better.

Done via the following script:

__from=drm_gem_object_put
__to=drm_gem_object_put_locked

Quoted 8 lines

for __file in $(git grep --name-only --word-regexp $__from); do
sed -i "s/\<$__from\>/$__to/g" $__file;
done

Since

commit 48e7f18392c66f9b69ebac11c54f1a2e033ced54

Author: Kristian H. Kristensen <[email protected]>
Date:   Wed Mar 20 10:09:08 2019 -0700

drm/msm: Implement .gem_free_object_unlocked

msm doesn't need the struct_mutex in the bo_put anymore, the only reason we had to use the _locked version here is historical accidents I think.

I think you could convert these all to the _unlocked variant and then entirely drop the _locked version.

Once we have that we could move struct_mutex into each driver (at least for msm and i915) since it's purely internal, and then wrap it in an #ifdef CONFIG_DRM_LEGACY to gloriously sunset it all :-)

Cheers, Daniel

Quoted 160 lines
---
 drivers/gpu/drm/drm_gem.c                 | 6 +++---
 drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 4 ++--
 drivers/gpu/drm/msm/msm_drv.c             | 2 +-
 drivers/gpu/drm/msm/msm_gem.c             | 6 +++---
 drivers/gpu/drm/msm/msm_gem_submit.c      | 2 +-
 drivers/gpu/drm/msm/msm_gpu.c             | 2 +-
 include/drm/drm_gem.h                     | 4 ++--
 7 files changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_gem.c +3 -3
index 599d5ff53b73..f21327ebc562 100644
@@ -983,7 +983,7 @@ drm_gem_object_free(struct kref *kref)
 EXPORT_SYMBOL(drm_gem_object_free);
 
 /**
- * drm_gem_object_put - release a GEM buffer object reference
+ * drm_gem_object_put_locked - release a GEM buffer object reference
  * @obj: GEM buffer object
  *
  * This releases a reference to @obj. Callers must hold the
@@ -994,7 +994,7 @@ EXPORT_SYMBOL(drm_gem_object_free);
  * drm_gem_object_put_unlocked() instead.
  */
 void
-drm_gem_object_put(struct drm_gem_object *obj)
+drm_gem_object_put_locked(struct drm_gem_object *obj)
 {
 	if (obj) {
 		WARN_ON(!mutex_is_locked(&obj->dev->struct_mutex));
@@ -1002,7 +1002,7 @@ drm_gem_object_put(struct drm_gem_object *obj)
 		kref_put(&obj->refcount, drm_gem_object_free);
 	}
 }
-EXPORT_SYMBOL(drm_gem_object_put);
+EXPORT_SYMBOL(drm_gem_object_put_locked);
 
 /**
  * drm_gem_vm_open - vma->ops->open implementation for GEM
drivers/gpu/drm/msm/adreno/a5xx_debugfs.c +2 -2
index 8cae2ca4af6b..68eddac7771c 100644
@@ -124,13 +124,13 @@ reset_set(void *data, u64 val)
 
 	if (a5xx_gpu->pm4_bo) {
 		msm_gem_unpin_iova(a5xx_gpu->pm4_bo, gpu->aspace);
-		drm_gem_object_put(a5xx_gpu->pm4_bo);
+		drm_gem_object_put_locked(a5xx_gpu->pm4_bo);
 		a5xx_gpu->pm4_bo = NULL;
 	}
 
 	if (a5xx_gpu->pfp_bo) {
 		msm_gem_unpin_iova(a5xx_gpu->pfp_bo, gpu->aspace);
-		drm_gem_object_put(a5xx_gpu->pfp_bo);
+		drm_gem_object_put_locked(a5xx_gpu->pfp_bo);
 		a5xx_gpu->pfp_bo = NULL;
 	}
 
drivers/gpu/drm/msm/msm_drv.c +1 -1
index 29295dee2a2e..6baed5b43ea3 100644
@@ -932,7 +932,7 @@ static int msm_ioctl_gem_madvise(struct drm_device *dev, void *data,
 		ret = 0;
 	}
 
-	drm_gem_object_put(obj);
+	drm_gem_object_put_locked(obj);
 
 unlock:
 	mutex_unlock(&dev->struct_mutex);
drivers/gpu/drm/msm/msm_gem.c +3 -3
index 5a6a79fbc9d6..8696c405f709 100644
@@ -879,7 +879,7 @@ void msm_gem_describe_objects(struct list_head *list, struct seq_file *m)
 }
 #endif
 
-/* don't call directly!  Use drm_gem_object_put() and friends */
+/* don't call directly!  Use drm_gem_object_put_locked() and friends */
 void msm_gem_free_object(struct drm_gem_object *obj)
 {
 	struct msm_gem_object *msm_obj = to_msm_bo(obj);
@@ -1183,7 +1183,7 @@ static void *_msm_gem_kernel_new(struct drm_device *dev, uint32_t size,
 	return vaddr;
 err:
 	if (locked)
-		drm_gem_object_put(obj);
+		drm_gem_object_put_locked(obj);
 	else
 		drm_gem_object_put_unlocked(obj);
 
@@ -1215,7 +1215,7 @@ void msm_gem_kernel_put(struct drm_gem_object *bo,
 	msm_gem_unpin_iova(bo, aspace);
 
 	if (locked)
-		drm_gem_object_put(bo);
+		drm_gem_object_put_locked(bo);
 	else
 		drm_gem_object_put_unlocked(bo);
 }
drivers/gpu/drm/msm/msm_gem_submit.c +1 -1
index 385d4965a8d0..8f450a245cfb 100644
@@ -387,7 +387,7 @@ static void submit_cleanup(struct msm_gem_submit *submit)
 		struct msm_gem_object *msm_obj = submit->bos[i].obj;
 		submit_unlock_unpin_bo(submit, i, false);
 		list_del_init(&msm_obj->submit_entry);
-		drm_gem_object_put(&msm_obj->base);
+		drm_gem_object_put_locked(&msm_obj->base);
 	}
 }
 
drivers/gpu/drm/msm/msm_gpu.c +1 -1
index 615c5cda5389..86a68f96c48d 100644
@@ -694,7 +694,7 @@ static void retire_submit(struct msm_gpu *gpu, struct msm_ringbuffer *ring,
 		/* move to inactive: */
 		msm_gem_move_to_inactive(&msm_obj->base);
 		msm_gem_unpin_iova(&msm_obj->base, submit->aspace);
-		drm_gem_object_put(&msm_obj->base);
+		drm_gem_object_put_locked(&msm_obj->base);
 	}
 
 	pm_runtime_mark_last_busy(&gpu->pdev->dev);
include/drm/drm_gem.h +2 -2
index 7c877bea7b3a..0f22f3320dcb 100644
@@ -187,7 +187,7 @@ struct drm_gem_object {
 	 *
 	 * Reference count of this object
 	 *
-	 * Please use drm_gem_object_get() to acquire and drm_gem_object_put()
+	 * Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked()
 	 * or drm_gem_object_put_unlocked() to release a reference to a GEM
 	 * buffer object.
 	 */
@@ -376,7 +376,7 @@ drm_gem_object_put_unlocked(struct drm_gem_object *obj)
 	kref_put(&obj->refcount, drm_gem_object_free);
 }
 
-void drm_gem_object_put(struct drm_gem_object *obj);
+void drm_gem_object_put_locked(struct drm_gem_object *obj);
 
 int drm_gem_handle_create(struct drm_file *file_priv,
 			  struct drm_gem_object *obj,
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#32 lore raw

Re: [PATCH 10/36] drm/gem: add _locked suffix to drm_object_put

Quoted 29 lines · Daniel Vetter
Quoted 12 lines · Emil Velikov

From: Emil Velikov <[email protected]>

Vast majority of DRM (core and drivers) are struct_mutex free.

As such we have only a handful of cases where the locked helper should be used. Make that stand out a little bit better.

Done via the following script:

__from=drm_gem_object_put
__to=drm_gem_object_put_locked

Quoted 8 lines

for __file in $(git grep --name-only --word-regexp $__from); do
sed -i "s/\<$__from\>/$__to/g" $__file;
done

Since

commit 48e7f18392c66f9b69ebac11c54f1a2e033ced54

Author: Kristian H. Kristensen <[email protected]>
Date:   Wed Mar 20 10:09:08 2019 -0700
Quoted 8 lines

drm/msm: Implement .gem_free_object_unlocked

msm doesn't need the struct_mutex in the bo_put anymore, the only reason we had to use the _locked version here is historical accidents I think.

I think you could convert these all to the _unlocked variant and then entirely drop the _locked version.

Did not check the msm driver closely, but it makes sense. Let's keep that as follow-up series?
We're already at 36 patches, plus mixing mostly mechanical and locking changes doesn't sound wise.

Quoted 4 lines

Once we have that we could move struct_mutex into each driver (at least for msm and i915) since it's purely internal, and then wrap it in an #ifdef CONFIG_DRM_LEGACY to gloriously sunset it all :-)

Indeed, we're nearly there.

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#33 lore raw

Re: [PATCH 10/36] drm/gem: add _locked suffix to drm_object_put

Quoted 35 lines · Emil Velikov
Quoted 34 lines · Daniel Vetter
Quoted 12 lines · Emil Velikov

From: Emil Velikov <[email protected]>

Vast majority of DRM (core and drivers) are struct_mutex free.

As such we have only a handful of cases where the locked helper should be used. Make that stand out a little bit better.

Done via the following script:

__from=drm_gem_object_put
__to=drm_gem_object_put_locked

Quoted 8 lines

for __file in $(git grep --name-only --word-regexp $__from); do
sed -i "s/\<$__from\>/$__to/g" $__file;
done

Since

commit 48e7f18392c66f9b69ebac11c54f1a2e033ced54

Author: Kristian H. Kristensen <[email protected]>
Date:   Wed Mar 20 10:09:08 2019 -0700

drm/msm: Implement .gem_free_object_unlocked

msm doesn't need the struct_mutex in the bo_put anymore, the only reason we had to use the _locked version here is historical accidents I think.

Quoted 7 lines
Quoted 3 lines

I think you could convert these all to the _unlocked variant and then entirely drop the _locked version.

Did not check the msm driver closely, but it makes sense. Let's keep that as follow-up series?
We're already at 36 patches, plus mixing mostly mechanical and locking changes doesn't sound wise.

My idea was to simply throw this patch out, and replace it by an msm patch to switch over to the unlocked variant.

Well maybe then needs 2nd patch to throw the locked version out.

So feels a bit a detour to touch msm twice, which is why I suggested to do the more direct route. But if you feel strongly I guess we can go this way and then follow up with converting msm to unlocked and throwing the _locked variant out for good too.
-Daniel

Quoted 7 lines
Quoted 4 lines

Once we have that we could move struct_mutex into each driver (at least for msm and i915) since it's purely internal, and then wrap it in an #ifdef CONFIG_DRM_LEGACY to gloriously sunset it all :-)

Indeed, we're nearly there.

-Emil

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#34 lore raw

PATCH 11/36 drm/gem: add drm_object_put helper

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Add helper, which will allow us to transition the drivers one by one, dropping the suffix.

---
 include/drm/drm_gem.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
include/drm/drm_gem.h +4 -2
index 0f22f3320dcb..70c0059ee72b 100644
@@ -364,18 +364,20 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj)
 }
 
 /**
- * drm_gem_object_put_unlocked - drop a GEM buffer object reference
+ * drm_gem_object_put- drop a GEM buffer object reference
  * @obj: GEM buffer object
  *
  * This releases a reference to @obj. Callers must not hold the
  * &drm_device.struct_mutex lock when calling this function.
  */
 static inline void
-drm_gem_object_put_unlocked(struct drm_gem_object *obj)
+drm_gem_object_put(struct drm_gem_object *obj)
 {
 	kref_put(&obj->refcount, drm_gem_object_free);
 }
 
+#define drm_gem_object_put_unlocked drm_gem_object_put
+
 void drm_gem_object_put_locked(struct drm_gem_object *obj);
 
 int drm_gem_handle_create(struct drm_file *file_priv,
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#35 lore raw

Re: [PATCH 11/36] drm/gem: add drm_object_put helper

Quoted 19 lines · Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Add helper, which will allow us to transition the drivers one by one, dropping the suffix.

---
 include/drm/drm_gem.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
include/drm/drm_gem.h +0 -0
index 0f22f3320dcb..70c0059ee72b 100644

include/drm/drm_gem.h static inline void drm_gem_object_get(struct drm_gem_object *obj) · line 367

Quoted 5 lines
include/drm/drm_gem.h +1 -1
@@ -364,18 +364,20 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj)
 }
 
 /**
- * drm_gem_object_put_unlocked - drop a GEM buffer object reference
+ * drm_gem_object_put- drop a GEM buffer object reference
                        ^

Missing space.

Quoted 17 lines
include/drm/drm_gem.h +3 -1
  * @obj: GEM buffer object
  *
  * This releases a reference to @obj. Callers must not hold the
  * &drm_device.struct_mutex lock when calling this function.
  */
 static inline void
-drm_gem_object_put_unlocked(struct drm_gem_object *obj)
+drm_gem_object_put(struct drm_gem_object *obj)
 {
 	kref_put(&obj->refcount, drm_gem_object_free);
 }
 
+#define drm_gem_object_put_unlocked drm_gem_object_put
+
 void drm_gem_object_put_locked(struct drm_gem_object *obj);
 
 int drm_gem_handle_create(struct drm_file *file_priv,
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#36 lore raw

Re: [PATCH 11/36] drm/gem: add drm_object_put helper

Quoted 23 lines · Jani Nikula
Quoted 21 lines · Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Add helper, which will allow us to transition the drivers one by one, dropping the suffix.

---
 include/drm/drm_gem.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
include/drm/drm_gem.h +0 -0
index 0f22f3320dcb..70c0059ee72b 100644
@@ -364,18 +364,20 @@ static inline void drm_gem_object_get(struct drm_gem_object *obj)
 }
 
Quoted 7 lines

include/drm/drm_gem.h static inline void drm_gem_object_get(struct drm_gem_object *obj) · line 367

Quoted 3 lines
include/drm/drm_gem.h +1 -1
 /**
- * drm_gem_object_put_unlocked - drop a GEM buffer object reference
+ * drm_gem_object_put- drop a GEM buffer object reference
                        ^

Missing space.

Thanks fixed.

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#37 lore raw

PATCH 12/36 drm/amd: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Alex Deucher <[email protected]>
Cc "Christian König" <[email protected]>
Cc "David (ChunMing) Zhou" <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c      |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |  4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c      |  4 ++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c     | 20 ++++++++++----------
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c      |  6 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c      |  6 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c       |  6 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c       |  6 +++---
 10 files changed, 29 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +1 -1
index 85b0515c0fdc..4053597b3af2 100644
@@ -102,7 +102,7 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
 		}
 
 		bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj));
-		drm_gem_object_put_unlocked(gobj);
+		drm_gem_object_put(gobj);
 
 		usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm);
 		if (usermm) {
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
index af91627b19b0..76ea245f2106 100644
@@ -57,7 +57,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p,
 	/* One for TTM and one for the CS job */
 	p->uf_entry.tv.num_shared = 2;
 
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 
 	size = amdgpu_bo_size(bo);
 	if (size != PAGE_SIZE || (data->offset + 8) > size) {
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 -2
index 84cee27cd7ef..de9b62e2800a 100644
@@ -575,14 +575,14 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
 
 	amdgpu_fb = kzalloc(sizeof(*amdgpu_fb), GFP_KERNEL);
 	if (amdgpu_fb == NULL) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ERR_PTR(-ENOMEM);
 	}
 
 	ret = amdgpu_display_framebuffer_init(dev, amdgpu_fb, mode_cmd, obj);
 	if (ret) {
 		kfree(amdgpu_fb);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ERR_PTR(ret);
 	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
index 652c57a3b847..43d8ed7dbd00 100644
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
 	attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
 					&amdgpu_dma_buf_attach_ops, obj);
 	if (IS_ERR(attach)) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ERR_CAST(attach);
 	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +2 -2
index 9ae7b61f696a..ca5dde4ec47d 100644
@@ -114,7 +114,7 @@ static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)
 		amdgpu_bo_unpin(abo);
 		amdgpu_bo_unreserve(abo);
 	}
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 }
 
 static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
@@ -279,7 +279,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 
 	}
 	if (fb && ret) {
-		drm_gem_object_put_unlocked(gobj);
+		drm_gem_object_put(gobj);
 		drm_framebuffer_unregister_private(fb);
 		drm_framebuffer_cleanup(fb);
 		kfree(fb);
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +10 -10
index e42608115c99..8c0597f306ec 100644
@@ -106,7 +106,7 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
 		spin_lock(&file->table_lock);
 		idr_for_each_entry(&file->object_idr, gobj, handle) {
 			WARN_ONCE(1, "And also active allocations!\n");
-			drm_gem_object_put_unlocked(gobj);
+			drm_gem_object_put(gobj);
 		}
 		idr_destroy(&file->object_idr);
 		spin_unlock(&file->table_lock);
@@ -272,7 +272,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
 
 	r = drm_gem_handle_create(filp, gobj, &handle);
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	if (r)
 		return r;
 
@@ -356,7 +356,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
 		amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm);
 
 release_object:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 
 	return r;
 }
@@ -375,11 +375,11 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp,
 	robj = gem_to_amdgpu_bo(gobj);
 	if (amdgpu_ttm_tt_get_usermm(robj->tbo.ttm) ||
 	    (robj->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)) {
-		drm_gem_object_put_unlocked(gobj);
+		drm_gem_object_put(gobj);
 		return -EPERM;
 	}
 	*offset_p = amdgpu_bo_mmap_offset(robj);
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return 0;
 }
 
@@ -449,7 +449,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
 	} else
 		r = ret;
 
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return r;
 }
 
@@ -492,7 +492,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
 unreserve:
 	amdgpu_bo_unreserve(robj);
 out:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return r;
 }
 
@@ -691,7 +691,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
 	ttm_eu_backoff_reservation(&ticket, &list);
 
 error_unref:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return r;
 }
 
@@ -767,7 +767,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
 	}
 
 out:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return r;
 }
 
@@ -804,7 +804,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
 
 	r = drm_gem_handle_create(file_priv, gobj, &handle);
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	if (r) {
 		return r;
 	}
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +3 -3
index 2512e7ebfedf..47a6e3d0aa96 100644
@@ -2404,7 +2404,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
 	aobj = gem_to_amdgpu_bo(obj);
 	ret = amdgpu_bo_reserve(aobj, false);
 	if (ret != 0) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ret;
 	}
 
@@ -2412,7 +2412,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
 	amdgpu_bo_unreserve(aobj);
 	if (ret) {
 		DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ret;
 	}
 	amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);
@@ -2447,7 +2447,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
 			amdgpu_bo_unpin(aobj);
 			amdgpu_bo_unreserve(aobj);
 		}
-		drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo);
+		drm_gem_object_put(amdgpu_crtc->cursor_bo);
 	}
 
 	amdgpu_crtc->cursor_bo = obj;
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +3 -3
index 0dde22db9848..7d16fb5a9482 100644
@@ -2483,7 +2483,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
 	aobj = gem_to_amdgpu_bo(obj);
 	ret = amdgpu_bo_reserve(aobj, false);
 	if (ret != 0) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ret;
 	}
 
@@ -2491,7 +2491,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
 	amdgpu_bo_unreserve(aobj);
 	if (ret) {
 		DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ret;
 	}
 	amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);
@@ -2526,7 +2526,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
 			amdgpu_bo_unpin(aobj);
 			amdgpu_bo_unreserve(aobj);
 		}
-		drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo);
+		drm_gem_object_put(amdgpu_crtc->cursor_bo);
 	}
 
 	amdgpu_crtc->cursor_bo = obj;
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +3 -3
index 84219534bd38..1ab33aa3980e 100644
@@ -2299,7 +2299,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
 	aobj = gem_to_amdgpu_bo(obj);
 	ret = amdgpu_bo_reserve(aobj, false);
 	if (ret != 0) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ret;
 	}
 
@@ -2307,7 +2307,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
 	amdgpu_bo_unreserve(aobj);
 	if (ret) {
 		DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ret;
 	}
 	amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);
@@ -2342,7 +2342,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
 			amdgpu_bo_unpin(aobj);
 			amdgpu_bo_unreserve(aobj);
 		}
-		drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo);
+		drm_gem_object_put(amdgpu_crtc->cursor_bo);
 	}
 
 	amdgpu_crtc->cursor_bo = obj;
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +3 -3
index 3a640702d7d1..8a8f1aa49212 100644
@@ -2305,7 +2305,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
 	aobj = gem_to_amdgpu_bo(obj);
 	ret = amdgpu_bo_reserve(aobj, false);
 	if (ret != 0) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ret;
 	}
 
@@ -2313,7 +2313,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
 	amdgpu_bo_unreserve(aobj);
 	if (ret) {
 		DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ret;
 	}
 	amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);
@@ -2348,7 +2348,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
 			amdgpu_bo_unpin(aobj);
 			amdgpu_bo_unreserve(aobj);
 		}
-		drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo);
+		drm_gem_object_put(amdgpu_crtc->cursor_bo);
 	}
 
 	amdgpu_crtc->cursor_bo = obj;
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#38 lore raw

Re: [PATCH 12/36] drm/amd: remove _unlocked suffix in drm_object_put_unlocked

Am 07.05.20 um 17:07 schrieb Emil Velikov:

Quoted 7 lines

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

In general sounds like a good idea to me, but I don't see the full patchset in my mailbox.

With the current code this change would probably trigger the "WARN_ON(!mutex_is_locked(&obj->dev->struct_mutex));" in drm_gem_object_put().

Christian.

Quoted 314 lines

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Alex Deucher <[email protected]>
Cc "Christian König" <[email protected]>
Cc "David (ChunMing) Zhou" <[email protected]>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c      |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |  4 ++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c      |  4 ++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c     | 20 ++++++++++----------
  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c      |  6 +++---
  drivers/gpu/drm/amd/amdgpu/dce_v11_0.c      |  6 +++---
  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c       |  6 +++---
  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c       |  6 +++---
  10 files changed, 29 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +1 -1
index 85b0515c0fdc..4053597b3af2 100644
@@ -102,7 +102,7 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
  		}
 
  		bo = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj));
-		drm_gem_object_put_unlocked(gobj);
+		drm_gem_object_put(gobj);
 
  		usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm);
  		if (usermm) {
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +1 -1
index af91627b19b0..76ea245f2106 100644
@@ -57,7 +57,7 @@ static int amdgpu_cs_user_fence_chunk(struct amdgpu_cs_parser *p,
  	/* One for TTM and one for the CS job */
  	p->uf_entry.tv.num_shared = 2;
 
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 
  	size = amdgpu_bo_size(bo);
  	if (size != PAGE_SIZE || (data->offset + 8) > size) {
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 -2
index 84cee27cd7ef..de9b62e2800a 100644
@@ -575,14 +575,14 @@ amdgpu_display_user_framebuffer_create(struct drm_device *dev,
 
  	amdgpu_fb = kzalloc(sizeof(*amdgpu_fb), GFP_KERNEL);
  	if (amdgpu_fb == NULL) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
  		return ERR_PTR(-ENOMEM);
  	}
 
  	ret = amdgpu_display_framebuffer_init(dev, amdgpu_fb, mode_cmd, obj);
  	if (ret) {
  		kfree(amdgpu_fb);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
  		return ERR_PTR(ret);
  	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
index 652c57a3b847..43d8ed7dbd00 100644
@@ -587,7 +587,7 @@ struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev,
  	attach = dma_buf_dynamic_attach(dma_buf, dev->dev,
  					&amdgpu_dma_buf_attach_ops, obj);
  	if (IS_ERR(attach)) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
  		return ERR_CAST(attach);
  	}
 
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +2 -2
index 9ae7b61f696a..ca5dde4ec47d 100644
@@ -114,7 +114,7 @@ static void amdgpufb_destroy_pinned_object(struct drm_gem_object *gobj)
  		amdgpu_bo_unpin(abo);
  		amdgpu_bo_unreserve(abo);
  	}
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
  }
 
  static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
@@ -279,7 +279,7 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 
  	}
  	if (fb && ret) {
-		drm_gem_object_put_unlocked(gobj);
+		drm_gem_object_put(gobj);
  		drm_framebuffer_unregister_private(fb);
  		drm_framebuffer_cleanup(fb);
  		kfree(fb);
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +10 -10
index e42608115c99..8c0597f306ec 100644
@@ -106,7 +106,7 @@ void amdgpu_gem_force_release(struct amdgpu_device *adev)
  		spin_lock(&file->table_lock);
  		idr_for_each_entry(&file->object_idr, gobj, handle) {
  			WARN_ONCE(1, "And also active allocations!\n");
-			drm_gem_object_put_unlocked(gobj);
+			drm_gem_object_put(gobj);
  		}
  		idr_destroy(&file->object_idr);
  		spin_unlock(&file->table_lock);
@@ -272,7 +272,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
 
  	r = drm_gem_handle_create(filp, gobj, &handle);
  	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
  	if (r)
  		return r;
 
@@ -356,7 +356,7 @@ int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
  		amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm);
 
  release_object:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 
  	return r;
  }
@@ -375,11 +375,11 @@ int amdgpu_mode_dumb_mmap(struct drm_file *filp,
  	robj = gem_to_amdgpu_bo(gobj);
  	if (amdgpu_ttm_tt_get_usermm(robj->tbo.ttm) ||
  	    (robj->flags & AMDGPU_GEM_CREATE_NO_CPU_ACCESS)) {
-		drm_gem_object_put_unlocked(gobj);
+		drm_gem_object_put(gobj);
  		return -EPERM;
  	}
  	*offset_p = amdgpu_bo_mmap_offset(robj);
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
  	return 0;
  }
 
@@ -449,7 +449,7 @@ int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
  	} else
  		r = ret;
 
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
  	return r;
  }
 
@@ -492,7 +492,7 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data,
  unreserve:
  	amdgpu_bo_unreserve(robj);
  out:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
  	return r;
  }
 
@@ -691,7 +691,7 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,
  	ttm_eu_backoff_reservation(&ticket, &list);
 
  error_unref:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
  	return r;
  }
 
@@ -767,7 +767,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data,
  	}
 
  out:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
  	return r;
  }
 
@@ -804,7 +804,7 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
 
  	r = drm_gem_handle_create(file_priv, gobj, &handle);
  	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
  	if (r) {
  		return r;
  	}
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +3 -3
index 2512e7ebfedf..47a6e3d0aa96 100644
@@ -2404,7 +2404,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
  	aobj = gem_to_amdgpu_bo(obj);
  	ret = amdgpu_bo_reserve(aobj, false);
  	if (ret != 0) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
  		return ret;
  	}
 
@@ -2412,7 +2412,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
  	amdgpu_bo_unreserve(aobj);
  	if (ret) {
  		DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
  		return ret;
  	}
  	amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);
@@ -2447,7 +2447,7 @@ static int dce_v10_0_crtc_cursor_set2(struct drm_crtc *crtc,
  			amdgpu_bo_unpin(aobj);
  			amdgpu_bo_unreserve(aobj);
  		}
-		drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo);
+		drm_gem_object_put(amdgpu_crtc->cursor_bo);
  	}
 
  	amdgpu_crtc->cursor_bo = obj;
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +3 -3
index 0dde22db9848..7d16fb5a9482 100644
@@ -2483,7 +2483,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
  	aobj = gem_to_amdgpu_bo(obj);
  	ret = amdgpu_bo_reserve(aobj, false);
  	if (ret != 0) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
  		return ret;
  	}
 
@@ -2491,7 +2491,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
  	amdgpu_bo_unreserve(aobj);
  	if (ret) {
  		DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
  		return ret;
  	}
  	amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);
@@ -2526,7 +2526,7 @@ static int dce_v11_0_crtc_cursor_set2(struct drm_crtc *crtc,
  			amdgpu_bo_unpin(aobj);
  			amdgpu_bo_unreserve(aobj);
  		}
-		drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo);
+		drm_gem_object_put(amdgpu_crtc->cursor_bo);
  	}
 
  	amdgpu_crtc->cursor_bo = obj;
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +3 -3
index 84219534bd38..1ab33aa3980e 100644
@@ -2299,7 +2299,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
  	aobj = gem_to_amdgpu_bo(obj);
  	ret = amdgpu_bo_reserve(aobj, false);
  	if (ret != 0) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
  		return ret;
  	}
 
@@ -2307,7 +2307,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
  	amdgpu_bo_unreserve(aobj);
  	if (ret) {
  		DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
  		return ret;
  	}
  	amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);
@@ -2342,7 +2342,7 @@ static int dce_v6_0_crtc_cursor_set2(struct drm_crtc *crtc,
  			amdgpu_bo_unpin(aobj);
  			amdgpu_bo_unreserve(aobj);
  		}
-		drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo);
+		drm_gem_object_put(amdgpu_crtc->cursor_bo);
  	}
 
  	amdgpu_crtc->cursor_bo = obj;
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +2 -2
index 3a640702d7d1..8a8f1aa49212 100644
@@ -2305,7 +2305,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
  	aobj = gem_to_amdgpu_bo(obj);
  	ret = amdgpu_bo_reserve(aobj, false);
  	if (ret != 0) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
  		return ret;
  	}
 
@@ -2313,7 +2313,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
  	amdgpu_bo_unreserve(aobj);
  	if (ret) {
  		DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
  		return ret;
  	}
  	amdgpu_crtc->cursor_addr = amdgpu_bo_gpu_offset(aobj);

drivers/gpu/drm/amd/amdgpu/dce_v8_0.c static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc, · line 2354

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +1 -1
@@ -2348,7 +2348,7 @@ static int dce_v8_0_crtc_cursor_set2(struct drm_crtc *crtc,
  			amdgpu_bo_unpin(aobj);
  			amdgpu_bo_unreserve(aobj);
  		}
-		drm_gem_object_put_unlocked(amdgpu_crtc->cursor_bo);
+		drm_gem_object_put(amdgpu_crtc->cursor_bo);
  	}
 
  	amdgpu_crtc->cursor_bo = obj;

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#39 lore raw

Re: [PATCH 12/36] drm/amd: remove _unlocked suffix in drm_object_put_unlocked

Hi Christian,

Quoted 4 lines · Christian König

Am 07.05.20 um 17:07 schrieb Emil Velikov:

Quoted 2 lines

From: Emil Velikov <[email protected]>

Quoted 9 lines
Quoted 5 lines

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

In general sounds like a good idea to me, but I don't see the full patchset in my mailbox.

The series is quite long, you can see it here
https://patchwork.freedesktop.org/series/77043/

Quoted 4 lines

With the current code this change would probably trigger the "WARN_ON(!mutex_is_locked(&obj->dev->struct_mutex));" in drm_gem_object_put().

Earlier patch renames drm_gem_object_put, adding explicit "_locked" suffix to it.

If the series is applied atomically, then that issue will not happen. Doing so might cause trivial merge conflicts, for individual drivers. Nothing a simple build check won't highlight/catch.

Although if the AMD team has pending work which will seriously clash with this, could delay the "remove _unlocked suffix" part of the series.

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#40 lore raw

PATCH 13/36 drm/arm: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Liviu Dudau <[email protected]>
Cc Brian Starkey <[email protected]>
Cc David Airlie <[email protected]>
---
 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 6 +++---
 drivers/gpu/drm/arm/malidp_drv.c                        | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c +3 -3
index 1b01a625f40e..170f9dc8ec19 100644
@@ -19,7 +19,7 @@ static void komeda_fb_destroy(struct drm_framebuffer *fb)
 	u32 i;
 
 	for (i = 0; i < fb->format->num_planes; i++)
-		drm_gem_object_put_unlocked(fb->obj[i]);
+		drm_gem_object_put(fb->obj[i]);
 
 	drm_framebuffer_cleanup(fb);
 	kfree(kfb);
@@ -103,7 +103,7 @@ komeda_fb_afbc_size_check(struct komeda_fb *kfb, struct drm_file *file,
 	return 0;
 
 check_failed:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return -EINVAL;
 }
 
@@ -199,7 +199,7 @@ komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 
 err_cleanup:
 	for (i = 0; i < kfb->base.format->num_planes; i++)
-		drm_gem_object_put_unlocked(kfb->base.obj[i]);
+		drm_gem_object_put(kfb->base.obj[i]);
 
 	kfree(kfb);
 	return ERR_PTR(ret);
drivers/gpu/drm/arm/malidp_drv.c +2 -2
index def8c9ffafca..c2507b7d8512 100644
@@ -349,11 +349,11 @@ malidp_verify_afbc_framebuffer_size(struct drm_device *dev,
 	if (objs->size < afbc_size) {
 		DRM_DEBUG_KMS("buffer size (%zu) too small for AFBC buffer size = %u\n",
 			      objs->size, afbc_size);
-		drm_gem_object_put_unlocked(objs);
+		drm_gem_object_put(objs);
 		return false;
 	}
 
-	drm_gem_object_put_unlocked(objs);
+	drm_gem_object_put(objs);
 
 	return true;
 }
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Acked-by on v1 13/36
#41 lore raw

Re: [PATCH 13/36] drm/arm: remove _unlocked suffix in drm_object_put_unlocked

Quoted 10 lines · Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

Quoted 7 lines

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Liviu Dudau <[email protected]>

Thanks for the cleanup!

Best regards,
Liviu

Quoted 60 lines
Cc Brian Starkey <[email protected]>
Cc David Airlie <[email protected]>
---
 drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c | 6 +++---
 drivers/gpu/drm/arm/malidp_drv.c                        | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_framebuffer.c +3 -3
index 1b01a625f40e..170f9dc8ec19 100644
@@ -19,7 +19,7 @@ static void komeda_fb_destroy(struct drm_framebuffer *fb)
 	u32 i;
 
 	for (i = 0; i < fb->format->num_planes; i++)
-		drm_gem_object_put_unlocked(fb->obj[i]);
+		drm_gem_object_put(fb->obj[i]);
 
 	drm_framebuffer_cleanup(fb);
 	kfree(kfb);
@@ -103,7 +103,7 @@ komeda_fb_afbc_size_check(struct komeda_fb *kfb, struct drm_file *file,
 	return 0;
 
 check_failed:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return -EINVAL;
 }
 
@@ -199,7 +199,7 @@ komeda_fb_create(struct drm_device *dev, struct drm_file *file,
 
 err_cleanup:
 	for (i = 0; i < kfb->base.format->num_planes; i++)
-		drm_gem_object_put_unlocked(kfb->base.obj[i]);
+		drm_gem_object_put(kfb->base.obj[i]);
 
 	kfree(kfb);
 	return ERR_PTR(ret);
drivers/gpu/drm/arm/malidp_drv.c +2 -2
index def8c9ffafca..c2507b7d8512 100644
@@ -349,11 +349,11 @@ malidp_verify_afbc_framebuffer_size(struct drm_device *dev,
 	if (objs->size < afbc_size) {
 		DRM_DEBUG_KMS("buffer size (%zu) too small for AFBC buffer size = %u\n",
 			      objs->size, afbc_size);
-		drm_gem_object_put_unlocked(objs);
+		drm_gem_object_put(objs);
 		return false;
 	}
 
-	drm_gem_object_put_unlocked(objs);
+	drm_gem_object_put(objs);
 
 	return true;
 }
Signature · 1 line
2.25.1
Signature · 12 lines
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#42 lore raw

PATCH 14/36 drm/armada: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Russell King <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/armada/armada_crtc.c  |  8 ++++----
 drivers/gpu/drm/armada/armada_fb.c    |  4 ++--
 drivers/gpu/drm/armada/armada_fbdev.c |  6 +++---
 drivers/gpu/drm/armada/armada_gem.c   | 10 +++++-----
 4 files changed, 14 insertions(+), 14 deletions(-)
drivers/gpu/drm/armada/armada_crtc.c +4 -4
index c2b92acd1e9a..38dfaa46d306 100644
@@ -710,13 +710,13 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,
 
 		/* Must be a kernel-mapped object */
 		if (!obj->addr) {
-			drm_gem_object_put_unlocked(&obj->obj);
+			drm_gem_object_put(&obj->obj);
 			return -EINVAL;
 		}
 
 		if (obj->obj.size < w * h * 4) {
 			DRM_ERROR("buffer is too small\n");
-			drm_gem_object_put_unlocked(&obj->obj);
+			drm_gem_object_put(&obj->obj);
 			return -ENOMEM;
 		}
 	}
@@ -724,7 +724,7 @@ static int armada_drm_crtc_cursor_set(struct drm_crtc *crtc,
 	if (dcrtc->cursor_obj) {
 		dcrtc->cursor_obj->update = NULL;
 		dcrtc->cursor_obj->update_data = NULL;
-		drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj);
+		drm_gem_object_put(&dcrtc->cursor_obj->obj);
 	}
 	dcrtc->cursor_obj = obj;
 	dcrtc->cursor_w = w;
@@ -760,7 +760,7 @@ static void armada_drm_crtc_destroy(struct drm_crtc *crtc)
 	struct armada_private *priv = crtc->dev->dev_private;
 
 	if (dcrtc->cursor_obj)
-		drm_gem_object_put_unlocked(&dcrtc->cursor_obj->obj);
+		drm_gem_object_put(&dcrtc->cursor_obj->obj);
 
 	priv->dcrtc[dcrtc->num] = NULL;
 	drm_crtc_cleanup(&dcrtc->crtc);
drivers/gpu/drm/armada/armada_fb.c +2 -2
index 426ca383d696..b87c71703c85 100644
@@ -129,12 +129,12 @@ struct drm_framebuffer *armada_fb_create(struct drm_device *dev,
 		goto err;
 	}
 
-	drm_gem_object_put_unlocked(&obj->obj);
+	drm_gem_object_put(&obj->obj);
 
 	return &dfb->fb;
 
  err_unref:
-	drm_gem_object_put_unlocked(&obj->obj);
+	drm_gem_object_put(&obj->obj);
  err:
 	DRM_ERROR("failed to initialize framebuffer: %d\n", ret);
 	return ERR_PTR(ret);
drivers/gpu/drm/armada/armada_fbdev.c +3 -3
index f2dc371bd8e5..0c4601275507 100644
@@ -51,13 +51,13 @@ static int armada_fbdev_create(struct drm_fb_helper *fbh,
 
 	ret = armada_gem_linear_back(dev, obj);
 	if (ret) {
-		drm_gem_object_put_unlocked(&obj->obj);
+		drm_gem_object_put(&obj->obj);
 		return ret;
 	}
 
 	ptr = armada_gem_map_object(dev, obj);
 	if (!ptr) {
-		drm_gem_object_put_unlocked(&obj->obj);
+		drm_gem_object_put(&obj->obj);
 		return -ENOMEM;
 	}
 
@@ -67,7 +67,7 @@ static int armada_fbdev_create(struct drm_fb_helper *fbh,
 	 * A reference is now held by the framebuffer object if
 	 * successful, otherwise this drops the ref for the error path.
 	 */
-	drm_gem_object_put_unlocked(&obj->obj);
+	drm_gem_object_put(&obj->obj);
 
 	if (IS_ERR(dfb))
 		return PTR_ERR(dfb);
drivers/gpu/drm/armada/armada_gem.c +5 -5
index 976685f2939e..8005614d2e6b 100644
@@ -256,7 +256,7 @@ int armada_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
 	/* drop reference from allocate - handle holds it now */
 	DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle);
  err:
-	drm_gem_object_put_unlocked(&dobj->obj);
+	drm_gem_object_put(&dobj->obj);
 	return ret;
 }
 
@@ -288,7 +288,7 @@ int armada_gem_create_ioctl(struct drm_device *dev, void *data,
 	/* drop reference from allocate - handle holds it now */
 	DRM_DEBUG_DRIVER("obj %p size %zu handle %#x\n", dobj, size, handle);
  err:
-	drm_gem_object_put_unlocked(&dobj->obj);
+	drm_gem_object_put(&dobj->obj);
 	return ret;
 }
 
@@ -305,13 +305,13 @@ int armada_gem_mmap_ioctl(struct drm_device *dev, void *data,
 		return -ENOENT;
 
 	if (!dobj->obj.filp) {
-		drm_gem_object_put_unlocked(&dobj->obj);
+		drm_gem_object_put(&dobj->obj);
 		return -EINVAL;
 	}
 
 	addr = vm_mmap(dobj->obj.filp, 0, args->size, PROT_READ | PROT_WRITE,
 		       MAP_SHARED, args->offset);
-	drm_gem_object_put_unlocked(&dobj->obj);
+	drm_gem_object_put(&dobj->obj);
 	if (IS_ERR_VALUE(addr))
 		return addr;
 
@@ -366,7 +366,7 @@ int armada_gem_pwrite_ioctl(struct drm_device *dev, void *data,
 	}
 
  unref:
-	drm_gem_object_put_unlocked(&dobj->obj);
+	drm_gem_object_put(&dobj->obj);
 	return ret;
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#43 lore raw

PATCH 15/36 drm/etnaviv: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Lucas Stach <[email protected]>
Cc Russell King <[email protected]>
Cc Christian Gmeiner <[email protected]>
---
 drivers/gpu/drm/etnaviv/etnaviv_drv.c        | 8 ++++----
 drivers/gpu/drm/etnaviv/etnaviv_gem.c        | 6 +++---
 drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c  | 2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_drv.c +4 -4
index 27c948f5dfeb..a2b649a8248e 100644
@@ -289,7 +289,7 @@ static int etnaviv_ioctl_gem_cpu_prep(struct drm_device *dev, void *data,
 
 	ret = etnaviv_gem_cpu_prep(obj, args->op, &args->timeout);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -310,7 +310,7 @@ static int etnaviv_ioctl_gem_cpu_fini(struct drm_device *dev, void *data,
 
 	ret = etnaviv_gem_cpu_fini(obj);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -330,7 +330,7 @@ static int etnaviv_ioctl_gem_info(struct drm_device *dev, void *data,
 		return -ENOENT;
 
 	ret = etnaviv_gem_mmap_offset(obj, &args->offset);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -413,7 +413,7 @@ static int etnaviv_ioctl_gem_wait(struct drm_device *dev, void *data,
 
 	ret = etnaviv_gem_wait_bo(gpu, obj, timeout);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
drivers/gpu/drm/etnaviv/etnaviv_gem.c +3 -3
index dc9ef302f517..b9bfb50ce7ee 100644
@@ -244,7 +244,7 @@ void etnaviv_gem_mapping_unreference(struct etnaviv_vram_mapping *mapping)
 	mapping->use -= 1;
 	mutex_unlock(&etnaviv_obj->lock);
 
-	drm_gem_object_put_unlocked(&etnaviv_obj->base);
+	drm_gem_object_put(&etnaviv_obj->base);
 }
 
 struct etnaviv_vram_mapping *etnaviv_gem_mapping_get(
@@ -633,7 +633,7 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
 
 	/* drop reference from allocate - handle holds it now */
 fail:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -742,6 +742,6 @@ int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file,
 	ret = drm_gem_handle_create(file, &etnaviv_obj->base, handle);
 
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(&etnaviv_obj->base);
+	drm_gem_object_put(&etnaviv_obj->base);
 	return ret;
 }
drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c +1 -1
index f24dd21c2363..6d9e5c3c4dd5 100644
@@ -136,7 +136,7 @@ struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev,
 	return &etnaviv_obj->base;
 
 fail:
-	drm_gem_object_put_unlocked(&etnaviv_obj->base);
+	drm_gem_object_put(&etnaviv_obj->base);
 
 	return ERR_PTR(ret);
 }
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +1 -1
index 3b0afa156d92..1b12b57d2406 100644
@@ -396,7 +396,7 @@ static void submit_cleanup(struct kref *kref)
 
 		/* if the GPU submit failed, objects might still be locked */
 		submit_unlock_object(submit, i);
-		drm_gem_object_put_unlocked(&etnaviv_obj->base);
+		drm_gem_object_put(&etnaviv_obj->base);
 	}
 
 	wake_up_all(&submit->gpu->fence_event);
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#44 lore raw

PATCH 16/36 drm/exynos: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Inki Dae <[email protected]>
Cc Joonyoung Shim <[email protected]>
Cc Seung-Woo Kim <[email protected]>
---
 drivers/gpu/drm/exynos/exynos_drm_gem.c | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_gem.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_gem.c +2 -2
index d734d9d51762..642a276e869b 100644
@@ -139,7 +139,7 @@ static int exynos_drm_gem_handle_create(struct drm_gem_object *obj,
 	DRM_DEV_DEBUG_KMS(to_dma_dev(obj->dev), "gem handle = 0x%x\n", *handle);
 
 	/* drop reference from allocate - handle holds it now. */
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return 0;
 }
@@ -333,7 +333,7 @@ int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data,
 	args->flags = exynos_gem->flags;
 	args->size = exynos_gem->size;
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return 0;
 }
drivers/gpu/drm/exynos/exynos_drm_gem.h +1 -1
index 42ec67bc262d..0e8d2306c08a 100644
@@ -86,7 +86,7 @@ struct exynos_drm_gem *exynos_drm_gem_get(struct drm_file *filp,
  */
 static inline void exynos_drm_gem_put(struct exynos_drm_gem *exynos_gem)
 {
-	drm_gem_object_put_unlocked(&exynos_gem->base);
+	drm_gem_object_put(&exynos_gem->base);
 }
 
 /* get buffer information to memory region allocated by gem. */
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#45 lore raw

PATCH 17/36 drm/gma500: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Patrik Jakobsson <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/gma500/framebuffer.c | 2 +-
 drivers/gpu/drm/gma500/gem.c         | 2 +-
 drivers/gpu/drm/gma500/gma_display.c | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/gma500/framebuffer.c +1 -1
index 23a78d755382..da02d7e8a8f5 100644
@@ -491,7 +491,7 @@ static int psb_fbdev_destroy(struct drm_device *dev,
 	drm_framebuffer_cleanup(fb);
 
 	if (fb->obj[0])
-		drm_gem_object_put_unlocked(fb->obj[0]);
+		drm_gem_object_put(fb->obj[0]);
 	kfree(fb);
 
 	return 0;
drivers/gpu/drm/gma500/gem.c +1 -1
index 83ee86f70b89..f9c4b1d76f56 100644
@@ -82,7 +82,7 @@ int psb_gem_create(struct drm_file *file, struct drm_device *dev, u64 size,
 		return ret;
 	}
 	/* We have the initial and handle reference but need only one now */
-	drm_gem_object_put_unlocked(&r->gem);
+	drm_gem_object_put(&r->gem);
 	*handlep = handle;
 	return 0;
 }
drivers/gpu/drm/gma500/gma_display.c +3 -3
index 17f136985d21..3df6d6e850f5 100644
@@ -351,7 +351,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
 			gt = container_of(gma_crtc->cursor_obj,
 					  struct gtt_range, gem);
 			psb_gtt_unpin(gt);
-			drm_gem_object_put_unlocked(gma_crtc->cursor_obj);
+			drm_gem_object_put(gma_crtc->cursor_obj);
 			gma_crtc->cursor_obj = NULL;
 		}
 		return 0;
@@ -427,7 +427,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
 	if (gma_crtc->cursor_obj) {
 		gt = container_of(gma_crtc->cursor_obj, struct gtt_range, gem);
 		psb_gtt_unpin(gt);
-		drm_gem_object_put_unlocked(gma_crtc->cursor_obj);
+		drm_gem_object_put(gma_crtc->cursor_obj);
 	}
 
 	gma_crtc->cursor_obj = obj;
@@ -435,7 +435,7 @@ int gma_crtc_cursor_set(struct drm_crtc *crtc,
 	return ret;
 
 unref_cursor:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return ret;
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#46 lore raw

PATCH 18/36 drm/i915: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Jani Nikula <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_object.h +1 -1
index 41351cbf31b5..aba7517c2837 100644
@@ -105,7 +105,7 @@ __attribute__((nonnull))
 static inline void
 i915_gem_object_put(struct drm_i915_gem_object *obj)
 {
-	drm_gem_object_put_unlocked(&obj->base);
+	drm_gem_object_put(&obj->base);
 }
 
 #define assert_object_held(obj) dma_resv_assert_held((obj)->base.resv)
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#47 lore raw

PATCH 19/36 drm/lima: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Qiang Yu <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/lima/lima_gem.c   | 10 +++++-----
 drivers/gpu/drm/lima/lima_sched.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/lima/lima_gem.c +5 -5
index 5404e0d668db..155f2b4b4030 100644
@@ -134,7 +134,7 @@ int lima_gem_create_handle(struct drm_device *dev, struct drm_file *file,
 
 out:
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return err;
 }
@@ -243,7 +243,7 @@ int lima_gem_get_info(struct drm_file *file, u32 handle, u32 *va, u64 *offset)
 
 	*offset = drm_vma_node_offset_addr(&obj->vma_node);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return 0;
 }
 
@@ -323,7 +323,7 @@ int lima_gem_submit(struct drm_file *file, struct lima_submit *submit)
 		 */
 		err = lima_vm_bo_add(vm, bo, false);
 		if (err) {
-			drm_gem_object_put_unlocked(obj);
+			drm_gem_object_put(obj);
 			goto err_out0;
 		}
 
@@ -368,7 +368,7 @@ int lima_gem_submit(struct drm_file *file, struct lima_submit *submit)
 				    submit->nr_bos, &ctx);
 
 	for (i = 0; i < submit->nr_bos; i++)
-		drm_gem_object_put_unlocked(&bos[i]->base.base);
+		drm_gem_object_put(&bos[i]->base.base);
 
 	if (out_sync) {
 		drm_syncobj_replace_fence(out_sync, fence);
@@ -389,7 +389,7 @@ int lima_gem_submit(struct drm_file *file, struct lima_submit *submit)
 		if (!bos[i])
 			break;
 		lima_vm_bo_del(vm, bos[i]);
-		drm_gem_object_put_unlocked(&bos[i]->base.base);
+		drm_gem_object_put(&bos[i]->base.base);
 	}
 	if (out_sync)
 		drm_syncobj_put(out_sync);
drivers/gpu/drm/lima/lima_sched.c +1 -1
index e6cefda00279..64ced6d0e6cf 100644
@@ -151,7 +151,7 @@ void lima_sched_task_fini(struct lima_sched_task *task)
 
 	if (task->bos) {
 		for (i = 0; i < task->num_bos; i++)
-			drm_gem_object_put_unlocked(&task->bos[i]->base.base);
+			drm_gem_object_put(&task->bos[i]->base.base);
 		kfree(task->bos);
 	}
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#48 lore raw

PATCH 20/36 drm/mediatek: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Chun-Kuang Hu <[email protected]>
Cc Philipp Zabel <[email protected]>
Cc David Airlie <[email protected]>
---
 drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_gem.c +1 -1
index b04a3c2b111e..fcb81f354224 100644
@@ -117,7 +117,7 @@ int mtk_drm_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev,
 		goto err_handle_create;
 
 	/* drop reference from allocate - handle holds it now. */
-	drm_gem_object_put_unlocked(&mtk_gem->base);
+	drm_gem_object_put(&mtk_gem->base);
 
 	return 0;
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Acked-by on v1 20/36
#49 lore raw

Re: [PATCH 20/36] drm/mediatek: remove _unlocked suffix in drm_object_put_unlocked

Hi, Emil:

Emil Velikov <[email protected]> 於 2020年5月7日 週四 下午11:11寫道:

Quoted 9 lines

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Quoted 7 lines

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Quoted 23 lines
Cc Chun-Kuang Hu <[email protected]>
Cc Philipp Zabel <[email protected]>
Cc David Airlie <[email protected]>
---
 drivers/gpu/drm/mediatek/mtk_drm_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_drm_gem.c +1 -2
index b04a3c2b111e..fcb81f354224 100644
@@ -117,7 +117,7 @@ int mtk_drm_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev,
                goto err_handle_create;
 
        /* drop reference from allocate - handle holds it now. */
-       drm_gem_object_put_unlocked(&mtk_gem->base);
+       drm_gem_object_put(&mtk_gem->base);
 
        return 0;
 
--
Quoted 2 lines

2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#50 lore raw

PATCH 21/36 drm/mgag200: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Dave Airlie <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/mgag200/mgag200_cursor.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/mgag200/mgag200_cursor.c +4 -4
index d491edd317ff..1a50836e003e 100644
@@ -286,7 +286,7 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 		ret = PTR_ERR(src);
 		dev_err(&dev->pdev->dev,
 			"failed to map user buffer updates\n");
-		goto err_drm_gem_object_put_unlocked;
+		goto err_drm_gem_object_put;
 	}
 
 	ret = mgag200_show_cursor(mdev, src, width, height);
@@ -295,13 +295,13 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 
 	/* Now update internal buffer pointers */
 	drm_gem_vram_vunmap(gbo, src);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return 0;
 err_drm_gem_vram_vunmap:
 	drm_gem_vram_vunmap(gbo, src);
-err_drm_gem_object_put_unlocked:
-	drm_gem_object_put_unlocked(obj);
+err_drm_gem_object_put:
+	drm_gem_object_put(obj);
 	return ret;
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer Reviewed-by on v1 21/36
#51 lore raw

Re: [PATCH 21/36] drm/mgag200: remove _unlocked suffix in drm_object_put_unlocked

Hi

Am 07.05.20 um 17:08 schrieb Emil Velikov:

Quoted 16 lines

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Quoted 4 lines
Cc Dave Airlie <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Quoted 35 lines
---
 drivers/gpu/drm/mgag200/mgag200_cursor.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/mgag200/mgag200_cursor.c +4 -4
index d491edd317ff..1a50836e003e 100644
@@ -286,7 +286,7 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 		ret = PTR_ERR(src);
 		dev_err(&dev->pdev->dev,
 			"failed to map user buffer updates\n");
-		goto err_drm_gem_object_put_unlocked;
+		goto err_drm_gem_object_put;
 	}
 
 	ret = mgag200_show_cursor(mdev, src, width, height);
@@ -295,13 +295,13 @@ int mgag200_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 
 	/* Now update internal buffer pointers */
 	drm_gem_vram_vunmap(gbo, src);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return 0;
 err_drm_gem_vram_vunmap:
 	drm_gem_vram_vunmap(gbo, src);
-err_drm_gem_object_put_unlocked:
-	drm_gem_object_put_unlocked(obj);
+err_drm_gem_object_put:
+	drm_gem_object_put(obj);
 	return ret;
 }
 
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#52 lore raw

PATCH 22/36 drm/msm: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc David Airlie <[email protected]>
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c     |  6 +++---
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c     |  2 +-
 drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c |  4 ++--
 drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c  |  2 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c |  2 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c        |  2 +-
 drivers/gpu/drm/msm/msm_drv.c             |  6 +++---
 drivers/gpu/drm/msm/msm_fb.c              |  4 ++--
 drivers/gpu/drm/msm/msm_gem.c             | 12 ++++++------
 9 files changed, 20 insertions(+), 20 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +3 -3
index 724024a2243a..ad41ff023a1a 100644
@@ -804,17 +804,17 @@ static void a5xx_destroy(struct msm_gpu *gpu)
 
 	if (a5xx_gpu->pm4_bo) {
 		msm_gem_unpin_iova(a5xx_gpu->pm4_bo, gpu->aspace);
-		drm_gem_object_put_unlocked(a5xx_gpu->pm4_bo);
+		drm_gem_object_put(a5xx_gpu->pm4_bo);
 	}
 
 	if (a5xx_gpu->pfp_bo) {
 		msm_gem_unpin_iova(a5xx_gpu->pfp_bo, gpu->aspace);
-		drm_gem_object_put_unlocked(a5xx_gpu->pfp_bo);
+		drm_gem_object_put(a5xx_gpu->pfp_bo);
 	}
 
 	if (a5xx_gpu->gpmu_bo) {
 		msm_gem_unpin_iova(a5xx_gpu->gpmu_bo, gpu->aspace);
-		drm_gem_object_put_unlocked(a5xx_gpu->gpmu_bo);
+		drm_gem_object_put(a5xx_gpu->gpmu_bo);
 	}
 
 	adreno_gpu_cleanup(adreno_gpu);
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +1 -1
index 68af24150de5..34b85aaec747 100644
@@ -795,7 +795,7 @@ static void a6xx_destroy(struct msm_gpu *gpu)
 
 	if (a6xx_gpu->sqe_bo) {
 		msm_gem_unpin_iova(a6xx_gpu->sqe_bo, gpu->aspace);
-		drm_gem_object_put_unlocked(a6xx_gpu->sqe_bo);
+		drm_gem_object_put(a6xx_gpu->sqe_bo);
 	}
 
 	a6xx_gmu_remove(a6xx_gpu);
drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c +2 -2
index c9239b07fe4f..a0253297bc76 100644
@@ -119,7 +119,7 @@ static void unref_cursor_worker(struct drm_flip_work *work, void *val)
 	struct msm_kms *kms = &mdp4_kms->base.base;
 
 	msm_gem_unpin_iova(val, kms->aspace);
-	drm_gem_object_put_unlocked(val);
+	drm_gem_object_put(val);
 }
 
 static void mdp4_crtc_destroy(struct drm_crtc *crtc)
@@ -452,7 +452,7 @@ static int mdp4_crtc_cursor_set(struct drm_crtc *crtc,
 	return 0;
 
 fail:
-	drm_gem_object_put_unlocked(cursor_bo);
+	drm_gem_object_put(cursor_bo);
 	return ret;
 }
 
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +1 -1
index dda05436f716..243584d4b1d7 100644
@@ -165,7 +165,7 @@ static void mdp4_destroy(struct msm_kms *kms)
 
 	if (mdp4_kms->blank_cursor_iova)
 		msm_gem_unpin_iova(mdp4_kms->blank_cursor_bo, kms->aspace);
-	drm_gem_object_put_unlocked(mdp4_kms->blank_cursor_bo);
+	drm_gem_object_put(mdp4_kms->blank_cursor_bo);
 
 	if (aspace) {
 		aspace->mmu->funcs->detach(aspace->mmu);
drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +1 -1
index 998bef1190a3..ca3368c828d0 100644
@@ -166,7 +166,7 @@ static void unref_cursor_worker(struct drm_flip_work *work, void *val)
 	struct msm_kms *kms = &mdp5_kms->base.base;
 
 	msm_gem_unpin_iova(val, kms->aspace);
-	drm_gem_object_put_unlocked(val);
+	drm_gem_object_put(val);
 }
 
 static void mdp5_crtc_destroy(struct drm_crtc *crtc)
drivers/gpu/drm/msm/dsi/dsi_host.c +1 -1
index 11ae5b8444c3..66ca0c009cfa 100644
@@ -1132,7 +1132,7 @@ static void dsi_tx_buf_free(struct msm_dsi_host *msm_host)
 	priv = dev->dev_private;
 	if (msm_host->tx_gem_obj) {
 		msm_gem_unpin_iova(msm_host->tx_gem_obj, priv->kms->aspace);
-		drm_gem_object_put_unlocked(msm_host->tx_gem_obj);
+		drm_gem_object_put(msm_host->tx_gem_obj);
 		msm_host->tx_gem_obj = NULL;
 	}
 
drivers/gpu/drm/msm/msm_drv.c +3 -3
index 6baed5b43ea3..bc28df4eedeb 100644
@@ -757,7 +757,7 @@ static int msm_ioctl_gem_cpu_prep(struct drm_device *dev, void *data,
 
 	ret = msm_gem_cpu_prep(obj, args->op, &timeout);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -775,7 +775,7 @@ static int msm_ioctl_gem_cpu_fini(struct drm_device *dev, void *data,
 
 	ret = msm_gem_cpu_fini(obj);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -867,7 +867,7 @@ static int msm_ioctl_gem_info(struct drm_device *dev, void *data,
 		break;
 	}
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
drivers/gpu/drm/msm/msm_fb.c +2 -2
index 37674e886e99..d42f0665359a 100644
@@ -123,7 +123,7 @@ struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev,
 
 out_unref:
 	for (i = 0; i < n; i++)
-		drm_gem_object_put_unlocked(bos[i]);
+		drm_gem_object_put(bos[i]);
 	return ERR_PTR(ret);
 }
 
@@ -238,7 +238,7 @@ msm_alloc_stolen_fb(struct drm_device *dev, int w, int h, int p, uint32_t format
 		/* note: if fb creation failed, we can't rely on fb destroy
 		 * to unref the bo:
 		 */
-		drm_gem_object_put_unlocked(bo);
+		drm_gem_object_put(bo);
 		return ERR_CAST(fb);
 	}
 
drivers/gpu/drm/msm/msm_gem.c +6 -6
index 8696c405f709..46e78993b69c 100644
@@ -543,7 +543,7 @@ int msm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
 
 	*offset = msm_gem_mmap_offset(obj);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 fail:
 	return ret;
@@ -970,7 +970,7 @@ int msm_gem_new_handle(struct drm_device *dev, struct drm_file *file,
 	ret = drm_gem_handle_create(file, obj, handle);
 
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -1089,7 +1089,7 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev,
 	return obj;
 
 fail:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return ERR_PTR(ret);
 }
 
@@ -1149,7 +1149,7 @@ struct drm_gem_object *msm_gem_import(struct drm_device *dev,
 	return obj;
 
 fail:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return ERR_PTR(ret);
 }
 
@@ -1185,7 +1185,7 @@ static void *_msm_gem_kernel_new(struct drm_device *dev, uint32_t size,
 	if (locked)
 		drm_gem_object_put_locked(obj);
 	else
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 
 	return ERR_PTR(ret);
 
@@ -1217,7 +1217,7 @@ void msm_gem_kernel_put(struct drm_gem_object *bo,
 	if (locked)
 		drm_gem_object_put_locked(bo);
 	else
-		drm_gem_object_put_unlocked(bo);
+		drm_gem_object_put(bo);
 }
 
 void msm_gem_object_set_name(struct drm_gem_object *bo, const char *fmt, ...)
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#53 lore raw

PATCH 23/36 drm/nouveau: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Ben Skeggs <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/nouveau/dispnv04/crtc.c   |  2 +-
 drivers/gpu/drm/nouveau/nouveau_abi16.c   |  2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c |  8 ++++----
 drivers/gpu/drm/nouveau/nouveau_gem.c     | 14 +++++++-------
 4 files changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/nouveau/dispnv04/crtc.c +1 -1
index 1f08de4241e0..27f511b9987b 100644
@@ -1017,7 +1017,7 @@ nv04_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
 	nv_crtc->cursor.set_offset(nv_crtc, nv_crtc->cursor.offset);
 	nv_crtc->cursor.show(nv_crtc, true);
 out:
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 	return ret;
 }
 
drivers/gpu/drm/nouveau/nouveau_abi16.c +1 -1
index e2bae1424502..72c91991b96a 100644
@@ -139,7 +139,7 @@ nouveau_abi16_chan_fini(struct nouveau_abi16 *abi16,
 	if (chan->ntfy) {
 		nouveau_vma_del(&chan->ntfy_vma);
 		nouveau_bo_unpin(chan->ntfy);
-		drm_gem_object_put_unlocked(&chan->ntfy->bo.base);
+		drm_gem_object_put(&chan->ntfy->bo.base);
 	}
 
 	if (chan->heap.block_size)
drivers/gpu/drm/nouveau/nouveau_display.c +4 -4
index 700817dc4fa0..60bef0ad028d 100644
@@ -185,7 +185,7 @@ nouveau_user_framebuffer_destroy(struct drm_framebuffer *drm_fb)
 	struct nouveau_framebuffer *fb = nouveau_framebuffer(drm_fb);
 
 	if (fb->nvbo)
-		drm_gem_object_put_unlocked(&fb->nvbo->bo.base);
+		drm_gem_object_put(&fb->nvbo->bo.base);
 
 	drm_framebuffer_cleanup(drm_fb);
 	kfree(fb);
@@ -267,7 +267,7 @@ nouveau_user_framebuffer_create(struct drm_device *dev,
 	if (ret == 0)
 		return &fb->base;
 
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 	return ERR_PTR(ret);
 }
 
@@ -648,7 +648,7 @@ nouveau_display_dumb_create(struct drm_file *file_priv, struct drm_device *dev,
 		return ret;
 
 	ret = drm_gem_handle_create(file_priv, &bo->bo.base, &args->handle);
-	drm_gem_object_put_unlocked(&bo->bo.base);
+	drm_gem_object_put(&bo->bo.base);
 	return ret;
 }
 
@@ -663,7 +663,7 @@ nouveau_display_dumb_map_offset(struct drm_file *file_priv,
 	if (gem) {
 		struct nouveau_bo *bo = nouveau_gem_object(gem);
 		*poffset = drm_vma_node_offset_addr(&bo->bo.base.vma_node);
-		drm_gem_object_put_unlocked(gem);
+		drm_gem_object_put(gem);
 		return 0;
 	}
 
drivers/gpu/drm/nouveau/nouveau_gem.c +7 -7
index f5ece1f94973..5631c484d10f 100644
@@ -279,7 +279,7 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data,
 	}
 
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(&nvbo->bo.base);
+	drm_gem_object_put(&nvbo->bo.base);
 	return ret;
 }
 
@@ -358,7 +358,7 @@ validate_fini_no_ticket(struct validate_op *op, struct nouveau_channel *chan,
 		list_del(&nvbo->entry);
 		nvbo->reserved_by = NULL;
 		ttm_bo_unreserve(&nvbo->bo);
-		drm_gem_object_put_unlocked(&nvbo->bo.base);
+		drm_gem_object_put(&nvbo->bo.base);
 	}
 }
 
@@ -405,14 +405,14 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
 		nvbo = nouveau_gem_object(gem);
 		if (nvbo == res_bo) {
 			res_bo = NULL;
-			drm_gem_object_put_unlocked(gem);
+			drm_gem_object_put(gem);
 			continue;
 		}
 
 		if (nvbo->reserved_by && nvbo->reserved_by == file_priv) {
 			NV_PRINTK(err, cli, "multiple instances of buffer %d on "
 				      "validation list\n", b->handle);
-			drm_gem_object_put_unlocked(gem);
+			drm_gem_object_put(gem);
 			ret = -EINVAL;
 			break;
 		}
@@ -929,7 +929,7 @@ nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,
 		ret = lret;
 
 	nouveau_bo_sync_for_cpu(nvbo);
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return ret;
 }
@@ -948,7 +948,7 @@ nouveau_gem_ioctl_cpu_fini(struct drm_device *dev, void *data,
 	nvbo = nouveau_gem_object(gem);
 
 	nouveau_bo_sync_for_device(nvbo);
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 	return 0;
 }
 
@@ -965,7 +965,7 @@ nouveau_gem_ioctl_info(struct drm_device *dev, void *data,
 		return -ENOENT;
 
 	ret = nouveau_gem_info(file_priv, gem, req);
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 	return ret;
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#54 lore raw

PATCH 24/36 drm/omapdrm: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Tomi Valkeinen <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/omapdrm/omap_drv.c   | 2 +-
 drivers/gpu/drm/omapdrm/omap_fb.c    | 2 +-
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +-
 drivers/gpu/drm/omapdrm/omap_gem.c   | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/omapdrm/omap_drv.c +1 -1
index cdafd7ef1c32..242d28281784 100644
@@ -503,7 +503,7 @@ static int ioctl_gem_info(struct drm_device *dev, void *data,
 	args->size = omap_gem_mmap_size(obj);
 	args->offset = omap_gem_mmap_offset(obj);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
drivers/gpu/drm/omapdrm/omap_fb.c +1 -1
index 9aeab81dfb90..05f30e2618c9 100644
@@ -326,7 +326,7 @@ struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev,
 
 error:
 	while (--i >= 0)
-		drm_gem_object_put_unlocked(bos[i]);
+		drm_gem_object_put(bos[i]);
 
 	return fb;
 }
drivers/gpu/drm/omapdrm/omap_fbdev.c +1 -1
index 09a84919ef73..3f6cfc24fb64 100644
@@ -140,7 +140,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 		/* note: if fb creation failed, we can't rely on fb destroy
 		 * to unref the bo:
 		 */
-		drm_gem_object_put_unlocked(fbdev->bo);
+		drm_gem_object_put(fbdev->bo);
 		ret = PTR_ERR(fb);
 		goto fail;
 	}
drivers/gpu/drm/omapdrm/omap_gem.c +2 -2
index d08ae95ecc0a..d0d12d5dd76c 100644
@@ -629,7 +629,7 @@ int omap_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
 
 	*offset = omap_gem_mmap_offset(obj);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 fail:
 	return ret;
@@ -1348,7 +1348,7 @@ int omap_gem_new_handle(struct drm_device *dev, struct drm_file *file,
 	}
 
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return 0;
 }
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#55 lore raw

PATCH 25/36 drm/panfrost: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Rob Herring <[email protected]>
Cc Tomeu Vizoso <[email protected]>
Cc Steven Price <[email protected]>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c     | 10 +++++-----
 drivers/gpu/drm/panfrost/panfrost_gem.c     |  4 ++--
 drivers/gpu/drm/panfrost/panfrost_job.c     |  2 +-
 drivers/gpu/drm/panfrost/panfrost_mmu.c     |  2 +-
 drivers/gpu/drm/panfrost/panfrost_perfcnt.c |  4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/panfrost/panfrost_drv.c +5 -5
index 882fecc33fdb..ada51df9a7a3 100644
@@ -99,7 +99,7 @@ static int panfrost_ioctl_create_bo(struct drm_device *dev, void *data,
 
 	mapping = panfrost_gem_mapping_get(bo, priv);
 	if (!mapping) {
-		drm_gem_object_put_unlocked(&bo->base.base);
+		drm_gem_object_put(&bo->base.base);
 		return -EINVAL;
 	}
 
@@ -317,7 +317,7 @@ panfrost_ioctl_wait_bo(struct drm_device *dev, void *data,
 	if (!ret)
 		ret = timeout ? -ETIMEDOUT : -EBUSY;
 
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 
 	return ret;
 }
@@ -351,7 +351,7 @@ static int panfrost_ioctl_mmap_bo(struct drm_device *dev, void *data,
 		args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node);
 
 out:
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 	return ret;
 }
 
@@ -372,7 +372,7 @@ static int panfrost_ioctl_get_bo_offset(struct drm_device *dev, void *data,
 	bo = to_panfrost_bo(gem_obj);
 
 	mapping = panfrost_gem_mapping_get(bo, priv);
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 
 	if (!mapping)
 		return -EINVAL;
@@ -438,7 +438,7 @@ static int panfrost_ioctl_madvise(struct drm_device *dev, void *data,
 	mutex_unlock(&bo->mappings.lock);
 	mutex_unlock(&pfdev->shrinker_lock);
 
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 	return ret;
 }
 
drivers/gpu/drm/panfrost/panfrost_gem.c +2 -2
index 17b654e1eb94..ac5d0aa80276 100644
@@ -93,7 +93,7 @@ static void panfrost_gem_mapping_release(struct kref *kref)
 	mapping = container_of(kref, struct panfrost_gem_mapping, refcount);
 
 	panfrost_gem_teardown_mapping(mapping);
-	drm_gem_object_put_unlocked(&mapping->obj->base.base);
+	drm_gem_object_put(&mapping->obj->base.base);
 	kfree(mapping);
 }
 
@@ -261,7 +261,7 @@ panfrost_gem_create_with_handle(struct drm_file *file_priv,
 	 */
 	ret = drm_gem_handle_create(file_priv, &shmem->base, handle);
 	/* drop reference from allocate - handle holds it now. */
-	drm_gem_object_put_unlocked(&shmem->base);
+	drm_gem_object_put(&shmem->base);
 	if (ret)
 		return ERR_PTR(ret);
 
drivers/gpu/drm/panfrost/panfrost_job.c +1 -1
index 7914b1570841..b2f09c038d35 100644
@@ -281,7 +281,7 @@ static void panfrost_job_cleanup(struct kref *ref)
 
 	if (job->bos) {
 		for (i = 0; i < job->bo_count; i++)
-			drm_gem_object_put_unlocked(job->bos[i]);
+			drm_gem_object_put(job->bos[i]);
 
 		kvfree(job->bos);
 	}
drivers/gpu/drm/panfrost/panfrost_mmu.c +1 -1
index ed28aeba6d59..0a339c6fbfaa 100644
@@ -538,7 +538,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_unlocked(&bo->base.base);
+	drm_gem_object_put(&bo->base.base);
 	return ret;
 }
 
drivers/gpu/drm/panfrost/panfrost_perfcnt.c +2 -2
index 6913578d5aa7..ec4695cf3caf 100644
@@ -156,7 +156,7 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev,
 		gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0xffffffff);
 
 	/* The BO ref is retained by the mapping. */
-	drm_gem_object_put_unlocked(&bo->base);
+	drm_gem_object_put(&bo->base);
 
 	return 0;
 
@@ -167,7 +167,7 @@ static int panfrost_perfcnt_enable_locked(struct panfrost_device *pfdev,
 err_close_bo:
 	panfrost_gem_close(&bo->base, file_priv);
 err_put_bo:
-	drm_gem_object_put_unlocked(&bo->base);
+	drm_gem_object_put(&bo->base);
 	return ret;
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#56 lore raw

PATCH 26/36 drm/qxl: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Dave Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc David Airlie <[email protected]>
---
 drivers/gpu/drm/qxl/qxl_cmd.c     | 2 +-
 drivers/gpu/drm/qxl/qxl_display.c | 6 +++---
 drivers/gpu/drm/qxl/qxl_dumb.c    | 2 +-
 drivers/gpu/drm/qxl/qxl_gem.c     | 2 +-
 drivers/gpu/drm/qxl/qxl_ioctl.c   | 4 ++--
 drivers/gpu/drm/qxl/qxl_object.c  | 4 ++--
 6 files changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/qxl/qxl_cmd.c +1 -1
index d1086b2a6892..3104af3d86b8 100644
@@ -377,7 +377,7 @@ void qxl_io_destroy_primary(struct qxl_device *qdev)
 {
 	wait_for_io_cmd(qdev, 0, QXL_IO_DESTROY_PRIMARY_ASYNC);
 	qdev->primary_bo->is_primary = false;
-	drm_gem_object_put_unlocked(&qdev->primary_bo->tbo.base);
+	drm_gem_object_put(&qdev->primary_bo->tbo.base);
 	qdev->primary_bo = NULL;
 }
 
drivers/gpu/drm/qxl/qxl_display.c +3 -3
index 1082cd5d2fd4..e403b37118d1 100644
@@ -783,7 +783,7 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane,
 		    qdev->dumb_shadow_bo->surf.width  != surf.width ||
 		    qdev->dumb_shadow_bo->surf.height != surf.height) {
 			if (qdev->dumb_shadow_bo) {
-				drm_gem_object_put_unlocked
+				drm_gem_object_put
 					(&qdev->dumb_shadow_bo->tbo.base);
 				qdev->dumb_shadow_bo = NULL;
 			}
@@ -793,7 +793,7 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane,
 		}
 		if (user_bo->shadow != qdev->dumb_shadow_bo) {
 			if (user_bo->shadow) {
-				drm_gem_object_put_unlocked
+				drm_gem_object_put
 					(&user_bo->shadow->tbo.base);
 				user_bo->shadow = NULL;
 			}
@@ -828,7 +828,7 @@ static void qxl_plane_cleanup_fb(struct drm_plane *plane,
 	qxl_bo_unpin(user_bo);
 
 	if (old_state->fb != plane->state->fb && user_bo->shadow) {
-		drm_gem_object_put_unlocked(&user_bo->shadow->tbo.base);
+		drm_gem_object_put(&user_bo->shadow->tbo.base);
 		user_bo->shadow = NULL;
 	}
 }
drivers/gpu/drm/qxl/qxl_dumb.c +1 -1
index 24e903383aa1..c04cd5a2553c 100644
@@ -83,6 +83,6 @@ int qxl_mode_dumb_mmap(struct drm_file *file_priv,
 		return -ENOENT;
 	qobj = gem_to_qxl_bo(gobj);
 	*offset_p = qxl_bo_mmap_offset(qobj);
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return 0;
 }
drivers/gpu/drm/qxl/qxl_gem.c +1 -1
index 5ff6fa9b799c..48e096285b4c 100644
@@ -97,7 +97,7 @@ int qxl_gem_object_create_with_handle(struct qxl_device *qdev,
 		return r;
 	/* drop reference from allocate - handle holds it now */
 	*qobj = gem_to_qxl_bo(gobj);
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return 0;
 }
 
drivers/gpu/drm/qxl/qxl_ioctl.c +2 -2
index d9a583966949..5dc78990990a 100644
@@ -125,7 +125,7 @@ static int qxlhw_handle_to_bo(struct drm_file *file_priv, uint64_t handle,
 	qobj = gem_to_qxl_bo(gobj);
 
 	ret = qxl_release_list_add(release, qobj);
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	if (ret)
 		return ret;
 
@@ -347,7 +347,7 @@ static int qxl_update_area_ioctl(struct drm_device *dev, void *data,
 	qxl_bo_unreserve(qobj);
 
 out:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return ret;
 }
 
drivers/gpu/drm/qxl/qxl_object.c +2 -2
index edc8a9916872..80e7a17aaddd 100644
@@ -224,7 +224,7 @@ void qxl_bo_unref(struct qxl_bo **bo)
 	if ((*bo) == NULL)
 		return;
 
-	drm_gem_object_put_unlocked(&(*bo)->tbo.base);
+	drm_gem_object_put(&(*bo)->tbo.base);
 	*bo = NULL;
 }
 
@@ -326,7 +326,7 @@ void qxl_bo_force_delete(struct qxl_device *qdev)
 		list_del_init(&bo->list);
 		mutex_unlock(&qdev->gem.mutex);
 		/* this should unref the ttm bo */
-		drm_gem_object_put_unlocked(&bo->tbo.base);
+		drm_gem_object_put(&bo->tbo.base);
 	}
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#57 lore raw

PATCH 27/36 drm/radeon: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Alex Deucher <[email protected]>
Cc "Christian König" <[email protected]>
Cc "David (ChunMing) Zhou" <[email protected]>
---
 drivers/gpu/drm/radeon/radeon_cs.c      |  2 +-
 drivers/gpu/drm/radeon/radeon_cursor.c  |  6 ++---
 drivers/gpu/drm/radeon/radeon_display.c |  8 +++----
 drivers/gpu/drm/radeon/radeon_fb.c      |  4 ++--
 drivers/gpu/drm/radeon/radeon_gem.c     | 30 ++++++++++++-------------
 drivers/gpu/drm/radeon/radeon_object.c  |  2 +-
 6 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/radeon/radeon_cs.c +1 -1
index 0d0ab8e0ff3b..af0bf78314e2 100644
@@ -443,7 +443,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo
 			if (bo == NULL)
 				continue;
 
-			drm_gem_object_put_unlocked(&bo->tbo.base);
+			drm_gem_object_put(&bo->tbo.base);
 		}
 	}
 	kfree(parser->track);
drivers/gpu/drm/radeon/radeon_cursor.c +3 -3
index 9180bb51b913..3507805b34bc 100644
@@ -309,7 +309,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,
 	robj = gem_to_radeon_bo(obj);
 	ret = radeon_bo_reserve(robj, false);
 	if (ret != 0) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ret;
 	}
 	/* Only 27 bit offset for legacy cursor */
@@ -319,7 +319,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,
 	radeon_bo_unreserve(robj);
 	if (ret) {
 		DRM_ERROR("Failed to pin new cursor BO (%d)\n", ret);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ret;
 	}
 
@@ -354,7 +354,7 @@ int radeon_crtc_cursor_set2(struct drm_crtc *crtc,
 			radeon_bo_unpin(robj);
 			radeon_bo_unreserve(robj);
 		}
-		drm_gem_object_put_unlocked(radeon_crtc->cursor_bo);
+		drm_gem_object_put(radeon_crtc->cursor_bo);
 	}
 
 	radeon_crtc->cursor_bo = obj;
drivers/gpu/drm/radeon/radeon_display.c +4 -4
index 35db79a168bf..6222bdb74825 100644
@@ -281,7 +281,7 @@ static void radeon_unpin_work_func(struct work_struct *__work)
 	} else
 		DRM_ERROR("failed to reserve buffer after flip\n");
 
-	drm_gem_object_put_unlocked(&work->old_rbo->tbo.base);
+	drm_gem_object_put(&work->old_rbo->tbo.base);
 	kfree(work);
 }
 
@@ -613,7 +613,7 @@ static int radeon_crtc_page_flip_target(struct drm_crtc *crtc,
 	radeon_bo_unreserve(new_rbo);
 
 cleanup:
-	drm_gem_object_put_unlocked(&work->old_rbo->tbo.base);
+	drm_gem_object_put(&work->old_rbo->tbo.base);
 	dma_fence_put(work->fence);
 	kfree(work);
 	return r;
@@ -1337,14 +1337,14 @@ radeon_user_framebuffer_create(struct drm_device *dev,
 
 	fb = kzalloc(sizeof(*fb), GFP_KERNEL);
 	if (fb == NULL) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ERR_PTR(-ENOMEM);
 	}
 
 	ret = radeon_framebuffer_init(dev, fb, mode_cmd, obj);
 	if (ret) {
 		kfree(fb);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return ERR_PTR(ret);
 	}
 
drivers/gpu/drm/radeon/radeon_fb.c +2 -2
index cf3156a65fc1..fc4212633bdf 100644
@@ -119,7 +119,7 @@ static void radeonfb_destroy_pinned_object(struct drm_gem_object *gobj)
 		radeon_bo_unpin(rbo);
 		radeon_bo_unreserve(rbo);
 	}
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 }
 
 static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev,
@@ -298,7 +298,7 @@ static int radeonfb_create(struct drm_fb_helper *helper,
 
 	}
 	if (fb && ret) {
-		drm_gem_object_put_unlocked(gobj);
+		drm_gem_object_put(gobj);
 		drm_framebuffer_unregister_private(fb);
 		drm_framebuffer_cleanup(fb);
 		kfree(fb);
drivers/gpu/drm/radeon/radeon_gem.c +15 -15
index 068c3e5da173..03640e3840be 100644
@@ -275,7 +275,7 @@ int radeon_gem_create_ioctl(struct drm_device *dev, void *data,
 	}
 	r = drm_gem_handle_create(filp, gobj, &handle);
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	if (r) {
 		up_read(&rdev->exclusive_lock);
 		r = radeon_gem_handle_lockup(rdev, r);
@@ -359,7 +359,7 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data,
 
 	r = drm_gem_handle_create(filp, gobj, &handle);
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	if (r)
 		goto handle_lockup;
 
@@ -368,7 +368,7 @@ int radeon_gem_userptr_ioctl(struct drm_device *dev, void *data,
 	return 0;
 
 release_object:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 
 handle_lockup:
 	up_read(&rdev->exclusive_lock);
@@ -402,7 +402,7 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data,
 
 	r = radeon_gem_set_domain(gobj, args->read_domains, args->write_domain);
 
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	up_read(&rdev->exclusive_lock);
 	r = radeon_gem_handle_lockup(robj->rdev, r);
 	return r;
@@ -421,11 +421,11 @@ int radeon_mode_dumb_mmap(struct drm_file *filp,
 	}
 	robj = gem_to_radeon_bo(gobj);
 	if (radeon_ttm_tt_has_userptr(robj->tbo.ttm)) {
-		drm_gem_object_put_unlocked(gobj);
+		drm_gem_object_put(gobj);
 		return -EPERM;
 	}
 	*offset_p = radeon_bo_mmap_offset(robj);
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return 0;
 }
 
@@ -460,7 +460,7 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data,
 
 	cur_placement = READ_ONCE(robj->tbo.mem.mem_type);
 	args->domain = radeon_mem_type_to_domain(cur_placement);
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return r;
 }
 
@@ -492,7 +492,7 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,
 	if (rdev->asic->mmio_hdp_flush &&
 	    radeon_mem_type_to_domain(cur_placement) == RADEON_GEM_DOMAIN_VRAM)
 		robj->rdev->asic->mmio_hdp_flush(rdev);
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	r = radeon_gem_handle_lockup(rdev, r);
 	return r;
 }
@@ -511,7 +511,7 @@ int radeon_gem_set_tiling_ioctl(struct drm_device *dev, void *data,
 		return -ENOENT;
 	robj = gem_to_radeon_bo(gobj);
 	r = radeon_bo_set_tiling_flags(robj, args->tiling_flags, args->pitch);
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return r;
 }
 
@@ -534,7 +534,7 @@ int radeon_gem_get_tiling_ioctl(struct drm_device *dev, void *data,
 	radeon_bo_get_tiling_flags(rbo, &args->tiling_flags, &args->pitch);
 	radeon_bo_unreserve(rbo);
 out:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return r;
 }
 
@@ -668,14 +668,14 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data,
 	r = radeon_bo_reserve(rbo, false);
 	if (r) {
 		args->operation = RADEON_VA_RESULT_ERROR;
-		drm_gem_object_put_unlocked(gobj);
+		drm_gem_object_put(gobj);
 		return r;
 	}
 	bo_va = radeon_vm_bo_find(&fpriv->vm, rbo);
 	if (!bo_va) {
 		args->operation = RADEON_VA_RESULT_ERROR;
 		radeon_bo_unreserve(rbo);
-		drm_gem_object_put_unlocked(gobj);
+		drm_gem_object_put(gobj);
 		return -ENOENT;
 	}
 
@@ -702,7 +702,7 @@ int radeon_gem_va_ioctl(struct drm_device *dev, void *data,
 		args->operation = RADEON_VA_RESULT_ERROR;
 	}
 out:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return r;
 }
 
@@ -743,7 +743,7 @@ int radeon_gem_op_ioctl(struct drm_device *dev, void *data,
 
 	radeon_bo_unreserve(robj);
 out:
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return r;
 }
 
@@ -769,7 +769,7 @@ int radeon_mode_dumb_create(struct drm_file *file_priv,
 
 	r = drm_gem_handle_create(file_priv, gobj, &handle);
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	if (r) {
 		return r;
 	}
drivers/gpu/drm/radeon/radeon_object.c +1 -1
index 140d94cc080d..f3dee01250da 100644
@@ -448,7 +448,7 @@ void radeon_bo_force_delete(struct radeon_device *rdev)
 		list_del_init(&bo->list);
 		mutex_unlock(&bo->rdev->gem.mutex);
 		/* this should unref the ttm bo */
-		drm_gem_object_put_unlocked(&bo->tbo.base);
+		drm_gem_object_put(&bo->tbo.base);
 	}
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#58 lore raw

PATCH 28/36 drm/rockchip: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Sandy Huang <[email protected]>
Cc "Heiko Stübner" <[email protected]>
Cc David Airlie <[email protected]>
---
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c  | 2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_fb.c +1 -1
index 9b13c784b347..3aa37e177667 100644
@@ -88,7 +88,7 @@ rockchip_fb_create(struct drm_device *dev, struct drm_file *file,
 			struct drm_gem_object **obj = afbc_fb->base.obj;
 
 			for (i = 0; i < info->num_planes; ++i)
-				drm_gem_object_put_unlocked(obj[i]);
+				drm_gem_object_put(obj[i]);
 
 			kfree(afbc_fb);
 			return ERR_PTR(ret);
drivers/gpu/drm/rockchip/rockchip_drm_gem.c +1 -1
index 0d1884684dcb..b9275ba7c5a5 100644
@@ -392,7 +392,7 @@ rockchip_gem_create_with_handle(struct drm_file *file_priv,
 		goto err_handle_create;
 
 	/* drop reference from allocate - handle holds it now. */
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return rk_obj;
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#59 lore raw

PATCH 29/36 drm/tegra: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Thierry Reding <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/tegra/drm.c | 12 ++++++------
 drivers/gpu/drm/tegra/fb.c  |  6 +++---
 drivers/gpu/drm/tegra/gem.c |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/tegra/drm.c +6 -6
index d4f51b5c7ee5..09d71c94985c 100644
@@ -328,7 +328,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
 
 fail:
 	while (num_refs--)
-		drm_gem_object_put_unlocked(refs[num_refs]);
+		drm_gem_object_put(refs[num_refs]);
 
 	kfree(refs);
 
@@ -368,7 +368,7 @@ static int tegra_gem_mmap(struct drm_device *drm, void *data,
 
 	args->offset = drm_vma_node_offset_addr(&bo->gem.vma_node);
 
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return 0;
 }
@@ -636,7 +636,7 @@ static int tegra_gem_set_tiling(struct drm_device *drm, void *data,
 	bo->tiling.mode = mode;
 	bo->tiling.value = value;
 
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return 0;
 }
@@ -676,7 +676,7 @@ static int tegra_gem_get_tiling(struct drm_device *drm, void *data,
 		break;
 	}
 
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return err;
 }
@@ -701,7 +701,7 @@ static int tegra_gem_set_flags(struct drm_device *drm, void *data,
 	if (args->flags & DRM_TEGRA_GEM_BOTTOM_UP)
 		bo->flags |= TEGRA_BO_BOTTOM_UP;
 
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return 0;
 }
@@ -723,7 +723,7 @@ static int tegra_gem_get_flags(struct drm_device *drm, void *data,
 	if (bo->flags & TEGRA_BO_BOTTOM_UP)
 		args->flags |= DRM_TEGRA_GEM_BOTTOM_UP;
 
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return 0;
 }
drivers/gpu/drm/tegra/fb.c +3 -3
index 2b0666ac681b..01939c57fc74 100644
@@ -171,7 +171,7 @@ struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
 
 unreference:
 	while (i--)
-		drm_gem_object_put_unlocked(&planes[i]->gem);
+		drm_gem_object_put(&planes[i]->gem);
 
 	return ERR_PTR(err);
 }
@@ -235,7 +235,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
 	info = drm_fb_helper_alloc_fbi(helper);
 	if (IS_ERR(info)) {
 		dev_err(drm->dev, "failed to allocate framebuffer info\n");
-		drm_gem_object_put_unlocked(&bo->gem);
+		drm_gem_object_put(&bo->gem);
 		return PTR_ERR(info);
 	}
 
@@ -244,7 +244,7 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
 		err = PTR_ERR(fbdev->fb);
 		dev_err(drm->dev, "failed to allocate DRM framebuffer: %d\n",
 			err);
-		drm_gem_object_put_unlocked(&bo->gem);
+		drm_gem_object_put(&bo->gem);
 		return PTR_ERR(fbdev->fb);
 	}
 
drivers/gpu/drm/tegra/gem.c +2 -2
index 623768100c6a..723df142a981 100644
@@ -24,7 +24,7 @@ static void tegra_bo_put(struct host1x_bo *bo)
 {
 	struct tegra_bo *obj = host1x_to_tegra_bo(bo);
 
-	drm_gem_object_put_unlocked(&obj->gem);
+	drm_gem_object_put(&obj->gem);
 }
 
 /* XXX move this into lib/scatterlist.c? */
@@ -385,7 +385,7 @@ struct tegra_bo *tegra_bo_create_with_handle(struct drm_file *file,
 		return ERR_PTR(err);
 	}
 
-	drm_gem_object_put_unlocked(&bo->gem);
+	drm_gem_object_put(&bo->gem);
 
 	return bo;
 }
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#60 lore raw

PATCH 30/36 drm/v3d: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Eric Anholt <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/v3d/v3d_bo.c  | 6 +++---
 drivers/gpu/drm/v3d/v3d_gem.c | 4 ++--
 drivers/gpu/drm/v3d/v3d_irq.c | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/v3d/v3d_bo.c +3 -3
index edd299ab53d8..8b52cb25877c 100644
@@ -185,7 +185,7 @@ int v3d_create_bo_ioctl(struct drm_device *dev, void *data,
 	args->offset = bo->node.start << PAGE_SHIFT;
 
 	ret = drm_gem_handle_create(file_priv, &bo->base.base, &args->handle);
-	drm_gem_object_put_unlocked(&bo->base.base);
+	drm_gem_object_put(&bo->base.base);
 
 	return ret;
 }
@@ -208,7 +208,7 @@ int v3d_mmap_bo_ioctl(struct drm_device *dev, void *data,
 	}
 
 	args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node);
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 
 	return 0;
 }
@@ -229,6 +229,6 @@ int v3d_get_bo_offset_ioctl(struct drm_device *dev, void *data,
 
 	args->offset = bo->node.start << PAGE_SHIFT;
 
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 	return 0;
 }
drivers/gpu/drm/v3d/v3d_gem.c +2 -2
index 09a7639cf161..915f8bfdb58c 100644
@@ -358,7 +358,7 @@ v3d_job_free(struct kref *ref)
 
 	for (i = 0; i < job->bo_count; i++) {
 		if (job->bo[i])
-			drm_gem_object_put_unlocked(job->bo[i]);
+			drm_gem_object_put(job->bo[i]);
 	}
 	kvfree(job->bo);
 
@@ -384,7 +384,7 @@ v3d_render_job_free(struct kref *ref)
 	struct v3d_bo *bo, *save;
 
 	list_for_each_entry_safe(bo, save, &job->unref_list, unref_head) {
-		drm_gem_object_put_unlocked(&bo->base.base);
+		drm_gem_object_put(&bo->base.base);
 	}
 
 	v3d_job_free(ref);
drivers/gpu/drm/v3d/v3d_irq.c +1 -1
index 51b65263c657..c88686489b88 100644
@@ -72,7 +72,7 @@ v3d_overflow_mem_work(struct work_struct *work)
 	V3D_CORE_WRITE(0, V3D_PTB_BPOS, obj->size);
 
 out:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 }
 
 static irqreturn_t
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#61 lore raw

PATCH 31/36 drm/vc4: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Eric Anholt <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/vc4/vc4_bo.c  | 14 +++++++-------
 drivers/gpu/drm/vc4/vc4_gem.c | 14 +++++++-------
 drivers/gpu/drm/vc4/vc4_kms.c |  2 +-
 drivers/gpu/drm/vc4/vc4_v3d.c |  4 ++--
 4 files changed, 17 insertions(+), 17 deletions(-)
drivers/gpu/drm/vc4/vc4_bo.c +7 -7
index 72d30d90b856..74ceebd62fbc 100644
@@ -490,7 +490,7 @@ int vc4_dumb_create(struct drm_file *file_priv,
 	bo->madv = VC4_MADV_WILLNEED;
 
 	ret = drm_gem_handle_create(file_priv, &bo->base.base, &args->handle);
-	drm_gem_object_put_unlocked(&bo->base.base);
+	drm_gem_object_put(&bo->base.base);
 
 	return ret;
 }
@@ -834,7 +834,7 @@ int vc4_create_bo_ioctl(struct drm_device *dev, void *data,
 	bo->madv = VC4_MADV_WILLNEED;
 
 	ret = drm_gem_handle_create(file_priv, &bo->base.base, &args->handle);
-	drm_gem_object_put_unlocked(&bo->base.base);
+	drm_gem_object_put(&bo->base.base);
 
 	return ret;
 }
@@ -854,7 +854,7 @@ int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data,
 	/* The mmap offset was set up at BO allocation time. */
 	args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node);
 
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 	return 0;
 }
 
@@ -918,7 +918,7 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data,
 	ret = drm_gem_handle_create(file_priv, &bo->base.base, &args->handle);
 
 fail:
-	drm_gem_object_put_unlocked(&bo->base.base);
+	drm_gem_object_put(&bo->base.base);
 
 	return ret;
 }
@@ -965,7 +965,7 @@ int vc4_set_tiling_ioctl(struct drm_device *dev, void *data,
 	bo = to_vc4_bo(gem_obj);
 	bo->t_format = t_format;
 
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 
 	return 0;
 }
@@ -1000,7 +1000,7 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data,
 	else
 		args->modifier = DRM_FORMAT_MOD_NONE;
 
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 
 	return 0;
 }
@@ -1091,7 +1091,7 @@ int vc4_label_bo_ioctl(struct drm_device *dev, void *data,
 		ret = -ENOMEM;
 	mutex_unlock(&vc4->bo_lock);
 
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 
 	return ret;
 }
drivers/gpu/drm/vc4/vc4_gem.c +7 -7
index e1cfc3ccd05a..9f01ddd5b932 100644
@@ -58,7 +58,7 @@ vc4_free_hang_state(struct drm_device *dev, struct vc4_hang_state *state)
 	unsigned int i;
 
 	for (i = 0; i < state->user_state.bo_count; i++)
-		drm_gem_object_put_unlocked(state->bo[i]);
+		drm_gem_object_put(state->bo[i]);
 
 	kfree(state);
 }
@@ -808,7 +808,7 @@ vc4_cl_lookup_bos(struct drm_device *dev,
 fail_put_bo:
 	/* Release any reference to acquired objects. */
 	for (i = 0; i < exec->bo_count && exec->bo[i]; i++)
-		drm_gem_object_put_unlocked(&exec->bo[i]->base);
+		drm_gem_object_put(&exec->bo[i]->base);
 
 fail:
 	kvfree(handles);
@@ -957,7 +957,7 @@ vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec)
 			struct vc4_bo *bo = to_vc4_bo(&exec->bo[i]->base);
 
 			vc4_bo_dec_usecnt(bo);
-			drm_gem_object_put_unlocked(&exec->bo[i]->base);
+			drm_gem_object_put(&exec->bo[i]->base);
 		}
 		kvfree(exec->bo);
 	}
@@ -966,7 +966,7 @@ vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec)
 		struct vc4_bo *bo = list_first_entry(&exec->unref_list,
 						     struct vc4_bo, unref_head);
 		list_del(&bo->unref_head);
-		drm_gem_object_put_unlocked(&bo->base.base);
+		drm_gem_object_put(&bo->base.base);
 	}
 
 	/* Free up the allocation of any bin slots we used. */
@@ -1107,7 +1107,7 @@ vc4_wait_bo_ioctl(struct drm_device *dev, void *data,
 	ret = vc4_wait_for_seqno_ioctl_helper(dev, bo->seqno,
 					      &args->timeout_ns);
 
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 	return ret;
 }
 
@@ -1301,7 +1301,7 @@ vc4_gem_destroy(struct drm_device *dev)
 	 * the overflow allocation registers.  Now free the object.
 	 */
 	if (vc4->bin_bo) {
-		drm_gem_object_put_unlocked(&vc4->bin_bo->base.base);
+		drm_gem_object_put(&vc4->bin_bo->base.base);
 		vc4->bin_bo = NULL;
 	}
 
@@ -1382,7 +1382,7 @@ int vc4_gem_madvise_ioctl(struct drm_device *dev, void *data,
 	ret = 0;
 
 out_put_gem:
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 
 	return ret;
 }
drivers/gpu/drm/vc4/vc4_kms.c +1 -1
index 78d4fb0499e3..08318e69061b 100644
@@ -330,7 +330,7 @@ static struct drm_framebuffer *vc4_fb_create(struct drm_device *dev,
 			mode_cmd_local.modifier[0] = DRM_FORMAT_MOD_NONE;
 		}
 
-		drm_gem_object_put_unlocked(gem_obj);
+		drm_gem_object_put(gem_obj);
 
 		mode_cmd = &mode_cmd_local;
 	}
drivers/gpu/drm/vc4/vc4_v3d.c +2 -2
index cea77a21b205..f7ab979721b3 100644
@@ -308,7 +308,7 @@ static int bin_bo_alloc(struct vc4_dev *vc4)
 						    struct vc4_bo, unref_head);
 
 		list_del(&bo->unref_head);
-		drm_gem_object_put_unlocked(&bo->base.base);
+		drm_gem_object_put(&bo->base.base);
 	}
 
 	return ret;
@@ -344,7 +344,7 @@ static void bin_bo_release(struct kref *ref)
 	if (WARN_ON_ONCE(!vc4->bin_bo))
 		return;
 
-	drm_gem_object_put_unlocked(&vc4->bin_bo->base.base);
+	drm_gem_object_put(&vc4->bin_bo->base.base);
 	vc4->bin_bo = NULL;
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#62 lore raw

PATCH 32/36 drm/vgem: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Emil Velikov <[email protected]>
---
 drivers/gpu/drm/vgem/vgem_drv.c   | 6 +++---
 drivers/gpu/drm/vgem/vgem_fence.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/vgem/vgem_drv.c +3 -3
index ec1a8ebb6f1b..e4dc7b267a0b 100644
@@ -198,7 +198,7 @@ static struct drm_gem_object *vgem_gem_create(struct drm_device *dev,
 
 	ret = drm_gem_handle_create(file, &obj->base, handle);
 	if (ret) {
-		drm_gem_object_put_unlocked(&obj->base);
+		drm_gem_object_put(&obj->base);
 		return ERR_PTR(ret);
 	}
 
@@ -223,7 +223,7 @@ static int vgem_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
 	args->size = gem_object->size;
 	args->pitch = pitch;
 
-	drm_gem_object_put_unlocked(gem_object);
+	drm_gem_object_put(gem_object);
 
 	DRM_DEBUG("Created object of size %llu\n", args->size);
 
@@ -251,7 +251,7 @@ static int vgem_gem_dumb_map(struct drm_file *file, struct drm_device *dev,
 
 	*offset = drm_vma_node_offset_addr(&obj->vma_node);
 unref:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
drivers/gpu/drm/vgem/vgem_fence.c +1 -1
index 9268f6fc3f66..17f32f550dd9 100644
@@ -182,7 +182,7 @@ int vgem_fence_attach_ioctl(struct drm_device *dev,
 		dma_fence_put(fence);
 	}
 err:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return ret;
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#63 lore raw

PATCH 33/36 drm/virtio: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc David Airlie <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/virtio/virtgpu_display.c | 2 +-
 drivers/gpu/drm/virtio/virtgpu_gem.c     | 6 +++---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c   | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/virtio/virtgpu_display.c +1 -1
index cc7fd957a307..f3ce49c5a34c 100644
@@ -307,7 +307,7 @@ virtio_gpu_user_framebuffer_create(struct drm_device *dev,
 	ret = virtio_gpu_framebuffer_init(dev, virtio_gpu_fb, mode_cmd, obj);
 	if (ret) {
 		kfree(virtio_gpu_fb);
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return NULL;
 	}
 
drivers/gpu/drm/virtio/virtgpu_gem.c +3 -3
index 1025658be4df..3dcd61aa6649 100644
@@ -52,7 +52,7 @@ static int virtio_gpu_gem_create(struct drm_file *file,
 	*obj_p = &obj->base.base;
 
 	/* drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(&obj->base.base);
+	drm_gem_object_put(&obj->base.base);
 
 	*handle_p = handle;
 	return 0;
@@ -102,7 +102,7 @@ int virtio_gpu_mode_dumb_mmap(struct drm_file *file_priv,
 	if (gobj == NULL)
 		return -ENOENT;
 	*offset_p = drm_vma_node_offset_addr(&gobj->vma_node);
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return 0;
 }
 
@@ -237,7 +237,7 @@ void virtio_gpu_array_put_free(struct virtio_gpu_object_array *objs)
 	u32 i;
 
 	for (i = 0; i < objs->nents; i++)
-		drm_gem_object_put_unlocked(objs->objs[i]);
+		drm_gem_object_put(objs->objs[i]);
 	virtio_gpu_array_free(objs);
 }
 
drivers/gpu/drm/virtio/virtgpu_ioctl.c +3 -3
index 867c5e239d55..584766be8d64 100644
@@ -278,7 +278,7 @@ static int virtio_gpu_resource_create_ioctl(struct drm_device *dev, void *data,
 		drm_gem_object_release(obj);
 		return ret;
 	}
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	rc->res_handle = qobj->hw_res_handle; /* similiar to a VM address */
 	rc->bo_handle = handle;
@@ -300,7 +300,7 @@ static int virtio_gpu_resource_info_ioctl(struct drm_device *dev, void *data,
 
 	ri->size = qobj->base.base.size;
 	ri->res_handle = qobj->hw_res_handle;
-	drm_gem_object_put_unlocked(gobj);
+	drm_gem_object_put(gobj);
 	return 0;
 }
 
@@ -417,7 +417,7 @@ static int virtio_gpu_wait_ioctl(struct drm_device *dev, void *data,
 	else if (ret > 0)
 		ret = 0;
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return ret;
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#64 lore raw

PATCH 34/36 drm/vkms: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Rodrigo Siqueira <[email protected]>
Cc Haneen Mohammed <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/vkms/vkms_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vkms/vkms_gem.c +1 -1
index 2e01186fb943..dd348162fe5a 100644
@@ -113,7 +113,7 @@ struct drm_gem_object *vkms_gem_create(struct drm_device *dev,
 		return ERR_CAST(obj);
 
 	ret = drm_gem_handle_create(file, &obj->gem, handle);
-	drm_gem_object_put_unlocked(&obj->gem);
+	drm_gem_object_put(&obj->gem);
 	if (ret)
 		return ERR_PTR(ret);
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#65 lore raw

PATCH 35/36 drm/xen: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Cc Oleksandr Andrushchenko <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/xen/xen_drm_front.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xen/xen_drm_front.c +2 -2
index 1fd458e877ca..3e660fb111b3 100644
@@ -419,7 +419,7 @@ static int xen_drm_drv_dumb_create(struct drm_file *filp,
 		goto fail_handle;
 
 	/* Drop reference from allocate - handle holds it now */
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return 0;
 
 fail_handle:
@@ -427,7 +427,7 @@ static int xen_drm_drv_dumb_create(struct drm_file *filp,
 				   xen_drm_front_dbuf_to_cookie(obj));
 fail_backend:
 	/* drop reference from allocate */
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 fail:
 	DRM_ERROR("Failed to create dumb buffer: %d\n", ret);
 	return ret;
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#66 lore raw

PATCH 36/36 drm/gem: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

With this patch, the _unlocked define is no longer needed - remove it.

Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 Documentation/gpu/drm-mm.rst                 |  2 +-
 drivers/gpu/drm/drm_client.c                 |  2 +-
 drivers/gpu/drm/drm_gem.c                    | 26 ++++++++++----------
 drivers/gpu/drm/drm_gem_cma_helper.c         |  8 +++---
 drivers/gpu/drm/drm_gem_framebuffer_helper.c |  6 ++---
 drivers/gpu/drm/drm_gem_shmem_helper.c       |  4 +--
 drivers/gpu/drm/drm_gem_ttm_helper.c         |  2 +-
 drivers/gpu/drm/drm_gem_vram_helper.c        | 10 ++++----
 drivers/gpu/drm/drm_prime.c                  |  6 ++---
 include/drm/drm_gem.h                        |  4 +--
 10 files changed, 34 insertions(+), 36 deletions(-)
Documentation/gpu/drm-mm.rst +1 -1
index 5ba2ead8f317..8c8540ee859c 100644
@@ -178,7 +178,7 @@ GEM Objects Lifetime
 --------------------
 
 All GEM objects are reference-counted by the GEM core. References can be
-acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked()
+acquired and release by calling drm_gem_object_get() and drm_gem_object_put()
 respectively.
 
 When the last reference to a GEM object is released the GEM core calls
drivers/gpu/drm/drm_client.c +1 -1
index 8cb93f5209a4..536a22747b51 100644
@@ -237,7 +237,7 @@ static void drm_client_buffer_delete(struct drm_client_buffer *buffer)
 	drm_gem_vunmap(buffer->gem, buffer->vaddr);
 
 	if (buffer->gem)
-		drm_gem_object_put_unlocked(buffer->gem);
+		drm_gem_object_put(buffer->gem);
 
 	if (buffer->handle)
 		drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file);
drivers/gpu/drm/drm_gem.c +13 -13
index f21327ebc562..ae02b3842c90 100644
@@ -235,7 +235,7 @@ drm_gem_object_handle_put_unlocked(struct drm_gem_object *obj)
 	mutex_unlock(&dev->object_name_lock);
 
 	if (final)
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 }
 
 /*
@@ -331,7 +331,7 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
 
 	*offset = drm_vma_node_offset_addr(&obj->vma_node);
 out:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -690,7 +690,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,
  * Returns:
  *
  * @objs filled in with GEM object pointers. Returned GEM objects need to be
- * released with drm_gem_object_put_unlocked(). -ENOENT is returned on a lookup
+ * released with drm_gem_object_put(). -ENOENT is returned on a lookup
  * failure. 0 is returned on success.
  *
  */
@@ -785,7 +785,7 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,
 	else if (ret > 0)
 		ret = 0;
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -860,7 +860,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
 
 err:
 	mutex_unlock(&dev->object_name_lock);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return ret;
 }
 
@@ -898,7 +898,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
 
 	/* drm_gem_handle_create_tail unlocks dev->object_name_lock. */
 	ret = drm_gem_handle_create_tail(file_priv, obj, &handle);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	if (ret)
 		return ret;
 
@@ -991,7 +991,7 @@ EXPORT_SYMBOL(drm_gem_object_free);
  * driver doesn't use &drm_device.struct_mutex for anything.
  *
  * For drivers not encumbered with legacy locking use
- * drm_gem_object_put_unlocked() instead.
+ * drm_gem_object_put() instead.
  */
 void
 drm_gem_object_put_locked(struct drm_gem_object *obj)
@@ -1030,7 +1030,7 @@ void drm_gem_vm_close(struct vm_area_struct *vma)
 {
 	struct drm_gem_object *obj = vma->vm_private_data;
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 }
 EXPORT_SYMBOL(drm_gem_vm_close);
 
@@ -1079,7 +1079,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
 	if (obj->funcs && obj->funcs->mmap) {
 		ret = obj->funcs->mmap(obj, vma);
 		if (ret) {
-			drm_gem_object_put_unlocked(obj);
+			drm_gem_object_put(obj);
 			return ret;
 		}
 		WARN_ON(!(vma->vm_flags & VM_DONTEXPAND));
@@ -1089,7 +1089,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
 		else if (dev->driver->gem_vm_ops)
 			vma->vm_ops = dev->driver->gem_vm_ops;
 		else {
-			drm_gem_object_put_unlocked(obj);
+			drm_gem_object_put(obj);
 			return -EINVAL;
 		}
 
@@ -1155,13 +1155,13 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
 		return -EINVAL;
 
 	if (!drm_vma_node_is_allowed(node, priv)) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return -EACCES;
 	}
 
 	if (node->readonly) {
 		if (vma->vm_flags & VM_WRITE) {
-			drm_gem_object_put_unlocked(obj);
+			drm_gem_object_put(obj);
 			return -EINVAL;
 		}
 
@@ -1171,7 +1171,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
 	ret = drm_gem_mmap_obj(obj, drm_vma_node_size(node) << PAGE_SHIFT,
 			       vma);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
drivers/gpu/drm/drm_gem_cma_helper.c +4 -4
index 12e98fb28229..b3db3ca7bd7a 100644
@@ -114,7 +114,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
 	return cma_obj;
 
 error:
-	drm_gem_object_put_unlocked(&cma_obj->base);
+	drm_gem_object_put(&cma_obj->base);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(drm_gem_cma_create);
@@ -156,7 +156,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,
 	 */
 	ret = drm_gem_handle_create(file_priv, gem_obj, handle);
 	/* drop reference from allocate - handle holds it now. */
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 	if (ret)
 		return ERR_PTR(ret);
 
@@ -380,13 +380,13 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
 		return -EINVAL;
 
 	if (!drm_vma_node_is_allowed(node, priv)) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return -EACCES;
 	}
 
 	cma_obj = to_drm_gem_cma_obj(obj);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return cma_obj->vaddr ? (unsigned long)cma_obj->vaddr : -EINVAL;
 }
drivers/gpu/drm/drm_gem_framebuffer_helper.c +3 -3
index ccc2c71fa491..109d11fb4cd4 100644
@@ -95,7 +95,7 @@ void drm_gem_fb_destroy(struct drm_framebuffer *fb)
 	int i;
 
 	for (i = 0; i < 4; i++)
-		drm_gem_object_put_unlocked(fb->obj[i]);
+		drm_gem_object_put(fb->obj[i]);
 
 	drm_framebuffer_cleanup(fb);
 	kfree(fb);
@@ -175,7 +175,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev,
 			 + mode_cmd->offsets[i];
 
 		if (objs[i]->size < min_size) {
-			drm_gem_object_put_unlocked(objs[i]);
+			drm_gem_object_put(objs[i]);
 			ret = -EINVAL;
 			goto err_gem_object_put;
 		}
@@ -189,7 +189,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev,
 
 err_gem_object_put:
 	for (i--; i >= 0; i--)
-		drm_gem_object_put_unlocked(objs[i]);
+		drm_gem_object_put(objs[i]);
 
 	return ret;
 }
drivers/gpu/drm/drm_gem_shmem_helper.c +2 -2
index df31e5782eed..339eee79ea52 100644
@@ -360,7 +360,7 @@ drm_gem_shmem_create_with_handle(struct drm_file *file_priv,
 	 */
 	ret = drm_gem_handle_create(file_priv, &shmem->base, handle);
 	/* drop reference from allocate - handle holds it now. */
-	drm_gem_object_put_unlocked(&shmem->base);
+	drm_gem_object_put(&shmem->base);
 	if (ret)
 		return ERR_PTR(ret);
 
@@ -684,7 +684,7 @@ drm_gem_shmem_prime_import_sg_table(struct drm_device *dev,
 err_free_array:
 	kvfree(shmem->pages);
 err_free_gem:
-	drm_gem_object_put_unlocked(&shmem->base);
+	drm_gem_object_put(&shmem->base);
 
 	return ERR_PTR(ret);
 }
drivers/gpu/drm/drm_gem_ttm_helper.c +1 -1
index 605a8a3da7f9..892b2288a104 100644
@@ -74,7 +74,7 @@ int drm_gem_ttm_mmap(struct drm_gem_object *gem,
 	 * ttm has its own object refcounting, so drop gem reference
 	 * to avoid double accounting counting.
 	 */
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return 0;
 }
drivers/gpu/drm/drm_gem_vram_helper.c +5 -5
index 8b2d5c945c95..0023ce1d2cf7 100644
@@ -618,9 +618,9 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
 
 	ret = drm_gem_handle_create(file, &gbo->bo.base, &handle);
 	if (ret)
-		goto err_drm_gem_object_put_unlocked;
+		goto err_drm_gem_object_put;
 
-	drm_gem_object_put_unlocked(&gbo->bo.base);
+	drm_gem_object_put(&gbo->bo.base);
 
 	args->pitch = pitch;
 	args->size = size;
@@ -628,8 +628,8 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
 
 	return 0;
 
-err_drm_gem_object_put_unlocked:
-	drm_gem_object_put_unlocked(&gbo->bo.base);
+err_drm_gem_object_put:
+	drm_gem_object_put(&gbo->bo.base);
 	return ret;
 }
 EXPORT_SYMBOL(drm_gem_vram_fill_create_dumb);
@@ -737,7 +737,7 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file,
 	gbo = drm_gem_vram_of_gem(gem);
 	*offset = drm_gem_vram_mmap_offset(gbo);
 
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return 0;
 }
drivers/gpu/drm/drm_prime.c +3 -3
index 282774e469ac..bbfc713bfdc3 100644
@@ -270,7 +270,7 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
 	struct drm_device *dev = obj->dev;
 
 	/* drop the reference on the export fd holds */
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	drm_dev_put(dev);
 }
@@ -329,7 +329,7 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,
 
 	/* _handle_create_tail unconditionally unlocks dev->object_name_lock. */
 	ret = drm_gem_handle_create_tail(file_priv, obj, handle);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	if (ret)
 		goto out_put;
 
@@ -500,7 +500,7 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev,
 fail_put_dmabuf:
 	dma_buf_put(dmabuf);
 out:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 out_unlock:
 	mutex_unlock(&file_priv->prime.lock);
 
include/drm/drm_gem.h +1 -3
index 70c0059ee72b..eeb6f2cd5d24 100644
@@ -188,7 +188,7 @@ struct drm_gem_object {
 	 * Reference count of this object
 	 *
 	 * Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked()
-	 * or drm_gem_object_put_unlocked() to release a reference to a GEM
+	 * or drm_gem_object_put() to release a reference to a GEM
 	 * buffer object.
 	 */
 	struct kref refcount;
@@ -376,8 +376,6 @@ drm_gem_object_put(struct drm_gem_object *obj)
 	kref_put(&obj->refcount, drm_gem_object_free);
 }
 
-#define drm_gem_object_put_unlocked drm_gem_object_put
-
 void drm_gem_object_put_locked(struct drm_gem_object *obj);
 
 int drm_gem_handle_create(struct drm_file *file_priv,
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#67 lore raw

Re: [PATCH 36/36] drm/gem: remove _unlocked suffix in drm_object_put_unlocked

Hi Emil.

Quoted 16 lines · Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Quoted 5 lines

With this patch, the _unlocked define is no longer needed - remove it.

Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

I had prefeered this was spilt in three patches:
1) drm_gem*
2) drm_client, drm_prime, drm-mm
3) Removal of the define

Maybe just squash 1) and 2) in the above, but I like it spelled out that the backward compatible define is dropped.

Sam

Quoted 358 lines
---
 Documentation/gpu/drm-mm.rst                 |  2 +-
 drivers/gpu/drm/drm_client.c                 |  2 +-
 drivers/gpu/drm/drm_gem.c                    | 26 ++++++++++----------
 drivers/gpu/drm/drm_gem_cma_helper.c         |  8 +++---
 drivers/gpu/drm/drm_gem_framebuffer_helper.c |  6 ++---
 drivers/gpu/drm/drm_gem_shmem_helper.c       |  4 +--
 drivers/gpu/drm/drm_gem_ttm_helper.c         |  2 +-
 drivers/gpu/drm/drm_gem_vram_helper.c        | 10 ++++----
 drivers/gpu/drm/drm_prime.c                  |  6 ++---
 include/drm/drm_gem.h                        |  4 +--
 10 files changed, 34 insertions(+), 36 deletions(-)
Documentation/gpu/drm-mm.rst +1 -1
index 5ba2ead8f317..8c8540ee859c 100644
@@ -178,7 +178,7 @@ GEM Objects Lifetime
 --------------------
 
 All GEM objects are reference-counted by the GEM core. References can be
-acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked()
+acquired and release by calling drm_gem_object_get() and drm_gem_object_put()
 respectively.
 
 When the last reference to a GEM object is released the GEM core calls
drivers/gpu/drm/drm_client.c +1 -1
index 8cb93f5209a4..536a22747b51 100644
@@ -237,7 +237,7 @@ static void drm_client_buffer_delete(struct drm_client_buffer *buffer)
 	drm_gem_vunmap(buffer->gem, buffer->vaddr);
 
 	if (buffer->gem)
-		drm_gem_object_put_unlocked(buffer->gem);
+		drm_gem_object_put(buffer->gem);
 
 	if (buffer->handle)
 		drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file);
drivers/gpu/drm/drm_gem.c +13 -13
index f21327ebc562..ae02b3842c90 100644
@@ -235,7 +235,7 @@ drm_gem_object_handle_put_unlocked(struct drm_gem_object *obj)
 	mutex_unlock(&dev->object_name_lock);
 
 	if (final)
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 }
 
 /*
@@ -331,7 +331,7 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
 
 	*offset = drm_vma_node_offset_addr(&obj->vma_node);
 out:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -690,7 +690,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,
  * Returns:
  *
  * @objs filled in with GEM object pointers. Returned GEM objects need to be
- * released with drm_gem_object_put_unlocked(). -ENOENT is returned on a lookup
+ * released with drm_gem_object_put(). -ENOENT is returned on a lookup
  * failure. 0 is returned on success.
  *
  */
@@ -785,7 +785,7 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,
 	else if (ret > 0)
 		ret = 0;
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -860,7 +860,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
 
 err:
 	mutex_unlock(&dev->object_name_lock);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return ret;
 }
 
@@ -898,7 +898,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
 
 	/* drm_gem_handle_create_tail unlocks dev->object_name_lock. */
 	ret = drm_gem_handle_create_tail(file_priv, obj, &handle);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	if (ret)
 		return ret;
 
@@ -991,7 +991,7 @@ EXPORT_SYMBOL(drm_gem_object_free);
  * driver doesn't use &drm_device.struct_mutex for anything.
  *
  * For drivers not encumbered with legacy locking use
- * drm_gem_object_put_unlocked() instead.
+ * drm_gem_object_put() instead.
  */
 void
 drm_gem_object_put_locked(struct drm_gem_object *obj)
@@ -1030,7 +1030,7 @@ void drm_gem_vm_close(struct vm_area_struct *vma)
 {
 	struct drm_gem_object *obj = vma->vm_private_data;
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 }
 EXPORT_SYMBOL(drm_gem_vm_close);
 
@@ -1079,7 +1079,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
 	if (obj->funcs && obj->funcs->mmap) {
 		ret = obj->funcs->mmap(obj, vma);
 		if (ret) {
-			drm_gem_object_put_unlocked(obj);
+			drm_gem_object_put(obj);
 			return ret;
 		}
 		WARN_ON(!(vma->vm_flags & VM_DONTEXPAND));
@@ -1089,7 +1089,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
 		else if (dev->driver->gem_vm_ops)
 			vma->vm_ops = dev->driver->gem_vm_ops;
 		else {
-			drm_gem_object_put_unlocked(obj);
+			drm_gem_object_put(obj);
 			return -EINVAL;
 		}
 
@@ -1155,13 +1155,13 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
 		return -EINVAL;
 
 	if (!drm_vma_node_is_allowed(node, priv)) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return -EACCES;
 	}
 
 	if (node->readonly) {
 		if (vma->vm_flags & VM_WRITE) {
-			drm_gem_object_put_unlocked(obj);
+			drm_gem_object_put(obj);
 			return -EINVAL;
 		}
 
@@ -1171,7 +1171,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
 	ret = drm_gem_mmap_obj(obj, drm_vma_node_size(node) << PAGE_SHIFT,
 			       vma);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
drivers/gpu/drm/drm_gem_cma_helper.c +4 -4
index 12e98fb28229..b3db3ca7bd7a 100644
@@ -114,7 +114,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
 	return cma_obj;
 
 error:
-	drm_gem_object_put_unlocked(&cma_obj->base);
+	drm_gem_object_put(&cma_obj->base);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(drm_gem_cma_create);
@@ -156,7 +156,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,
 	 */
 	ret = drm_gem_handle_create(file_priv, gem_obj, handle);
 	/* drop reference from allocate - handle holds it now. */
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 	if (ret)
 		return ERR_PTR(ret);
 
@@ -380,13 +380,13 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
 		return -EINVAL;
 
 	if (!drm_vma_node_is_allowed(node, priv)) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return -EACCES;
 	}
 
 	cma_obj = to_drm_gem_cma_obj(obj);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return cma_obj->vaddr ? (unsigned long)cma_obj->vaddr : -EINVAL;
 }
drivers/gpu/drm/drm_gem_framebuffer_helper.c +3 -3
index ccc2c71fa491..109d11fb4cd4 100644
@@ -95,7 +95,7 @@ void drm_gem_fb_destroy(struct drm_framebuffer *fb)
 	int i;
 
 	for (i = 0; i < 4; i++)
-		drm_gem_object_put_unlocked(fb->obj[i]);
+		drm_gem_object_put(fb->obj[i]);
 
 	drm_framebuffer_cleanup(fb);
 	kfree(fb);
@@ -175,7 +175,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev,
 			 + mode_cmd->offsets[i];
 
 		if (objs[i]->size < min_size) {
-			drm_gem_object_put_unlocked(objs[i]);
+			drm_gem_object_put(objs[i]);
 			ret = -EINVAL;
 			goto err_gem_object_put;
 		}
@@ -189,7 +189,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev,
 
 err_gem_object_put:
 	for (i--; i >= 0; i--)
-		drm_gem_object_put_unlocked(objs[i]);
+		drm_gem_object_put(objs[i]);
 
 	return ret;
 }
drivers/gpu/drm/drm_gem_shmem_helper.c +2 -2
index df31e5782eed..339eee79ea52 100644
@@ -360,7 +360,7 @@ drm_gem_shmem_create_with_handle(struct drm_file *file_priv,
 	 */
 	ret = drm_gem_handle_create(file_priv, &shmem->base, handle);
 	/* drop reference from allocate - handle holds it now. */
-	drm_gem_object_put_unlocked(&shmem->base);
+	drm_gem_object_put(&shmem->base);
 	if (ret)
 		return ERR_PTR(ret);
 
@@ -684,7 +684,7 @@ drm_gem_shmem_prime_import_sg_table(struct drm_device *dev,
 err_free_array:
 	kvfree(shmem->pages);
 err_free_gem:
-	drm_gem_object_put_unlocked(&shmem->base);
+	drm_gem_object_put(&shmem->base);
 
 	return ERR_PTR(ret);
 }
drivers/gpu/drm/drm_gem_ttm_helper.c +1 -1
index 605a8a3da7f9..892b2288a104 100644
@@ -74,7 +74,7 @@ int drm_gem_ttm_mmap(struct drm_gem_object *gem,
 	 * ttm has its own object refcounting, so drop gem reference
 	 * to avoid double accounting counting.
 	 */
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return 0;
 }
drivers/gpu/drm/drm_gem_vram_helper.c +5 -5
index 8b2d5c945c95..0023ce1d2cf7 100644
@@ -618,9 +618,9 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
 
 	ret = drm_gem_handle_create(file, &gbo->bo.base, &handle);
 	if (ret)
-		goto err_drm_gem_object_put_unlocked;
+		goto err_drm_gem_object_put;
 
-	drm_gem_object_put_unlocked(&gbo->bo.base);
+	drm_gem_object_put(&gbo->bo.base);
 
 	args->pitch = pitch;
 	args->size = size;
@@ -628,8 +628,8 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
 
 	return 0;
 
-err_drm_gem_object_put_unlocked:
-	drm_gem_object_put_unlocked(&gbo->bo.base);
+err_drm_gem_object_put:
+	drm_gem_object_put(&gbo->bo.base);
 	return ret;
 }
 EXPORT_SYMBOL(drm_gem_vram_fill_create_dumb);
@@ -737,7 +737,7 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file,
 	gbo = drm_gem_vram_of_gem(gem);
 	*offset = drm_gem_vram_mmap_offset(gbo);
 
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return 0;
 }
drivers/gpu/drm/drm_prime.c +3 -3
index 282774e469ac..bbfc713bfdc3 100644
@@ -270,7 +270,7 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
 	struct drm_device *dev = obj->dev;
 
 	/* drop the reference on the export fd holds */
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	drm_dev_put(dev);
 }
@@ -329,7 +329,7 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,
 
 	/* _handle_create_tail unconditionally unlocks dev->object_name_lock. */
 	ret = drm_gem_handle_create_tail(file_priv, obj, handle);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	if (ret)
 		goto out_put;
 
@@ -500,7 +500,7 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev,
 fail_put_dmabuf:
 	dma_buf_put(dmabuf);
 out:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 out_unlock:
 	mutex_unlock(&file_priv->prime.lock);
 
include/drm/drm_gem.h +1 -3
index 70c0059ee72b..eeb6f2cd5d24 100644
@@ -188,7 +188,7 @@ struct drm_gem_object {
 	 * Reference count of this object
 	 *
 	 * Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked()
-	 * or drm_gem_object_put_unlocked() to release a reference to a GEM
+	 * or drm_gem_object_put() to release a reference to a GEM
 	 * buffer object.
 	 */
 	struct kref refcount;
@@ -376,8 +376,6 @@ drm_gem_object_put(struct drm_gem_object *obj)
 	kref_put(&obj->refcount, drm_gem_object_free);
 }
 
-#define drm_gem_object_put_unlocked drm_gem_object_put
-
 void drm_gem_object_put_locked(struct drm_gem_object *obj);
 
 int drm_gem_handle_create(struct drm_file *file_priv,
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#68 lore raw

Re: [PATCH 36/36] drm/gem: remove _unlocked suffix in drm_object_put_unlocked

Quoted 26 lines · Sam Ravnborg

Hi Emil.

Quoted 16 lines · Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Quoted 5 lines

With this patch, the _unlocked define is no longer needed - remove it.

Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Quoted 8 lines

I had prefeered this was spilt in three patches:
1) drm_gem*
2) drm_client, drm_prime, drm-mm
3) Removal of the define

Maybe just squash 1) and 2) in the above, but I like it spelled out that the backward compatible define is dropped.

Think that we can combine your and Thomas' suggestions:
- fold all of drm in once patch - move it all to patch 11
- keep the #define removal as separate patch

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#69 lore raw

Re: [PATCH 36/36] drm/gem: remove _unlocked suffix in drm_object_put_unlocked

Hi Emil.

Quoted 32 lines · Emil Velikov
Quoted 31 lines · Sam Ravnborg

Hi Emil.

Quoted 16 lines · Emil Velikov

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

Quoted 5 lines

With this patch, the _unlocked define is no longer needed - remove it.

Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>

I had prefeered this was spilt in three patches:
1) drm_gem*
2) drm_client, drm_prime, drm-mm
3) Removal of the define

Quoted 6 lines
Quoted 3 lines

Maybe just squash 1) and 2) in the above, but I like it spelled out that the backward compatible define is dropped.

Think that we can combine your and Thomas' suggestions:
- fold all of drm in once patch - move it all to patch 11
- keep the #define removal as separate patch

Yup, sound like a good plan.

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#70 lore raw

Re: [PATCH 36/36] drm/gem: remove _unlocked suffix in drm_object_put_unlocked

In reply to Emil Velikov

Hi Emil,

one suggestion for this patch: it seems preferable to merge this patch with patch 11, so that the whole gem core gets converted at once. Afterwards all those other patches convert the drivers. Finally, patch 36 would only remove the define of drm_gem_object_put_unlocked().

Best regards
Thomas

Am 07.05.20 um 17:08 schrieb Emil Velikov:

Quoted 373 lines

From: Emil Velikov <[email protected]>

Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex.

Just drop the suffix. It makes the API cleaner.

Done via the following script:

__from=drm_gem_object_put_unlocked
__to=drm_gem_object_put
for __file in $(git grep --name-only $__from); do
sed -i "s/$__from/$__to/g" $__file;
done

With this patch, the _unlocked define is no longer needed - remove it.

Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 Documentation/gpu/drm-mm.rst                 |  2 +-
 drivers/gpu/drm/drm_client.c                 |  2 +-
 drivers/gpu/drm/drm_gem.c                    | 26 ++++++++++----------
 drivers/gpu/drm/drm_gem_cma_helper.c         |  8 +++---
 drivers/gpu/drm/drm_gem_framebuffer_helper.c |  6 ++---
 drivers/gpu/drm/drm_gem_shmem_helper.c       |  4 +--
 drivers/gpu/drm/drm_gem_ttm_helper.c         |  2 +-
 drivers/gpu/drm/drm_gem_vram_helper.c        | 10 ++++----
 drivers/gpu/drm/drm_prime.c                  |  6 ++---
 include/drm/drm_gem.h                        |  4 +--
 10 files changed, 34 insertions(+), 36 deletions(-)
Documentation/gpu/drm-mm.rst +1 -1
index 5ba2ead8f317..8c8540ee859c 100644
@@ -178,7 +178,7 @@ GEM Objects Lifetime
 --------------------
 
 All GEM objects are reference-counted by the GEM core. References can be
-acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked()
+acquired and release by calling drm_gem_object_get() and drm_gem_object_put()
 respectively.
 
 When the last reference to a GEM object is released the GEM core calls
drivers/gpu/drm/drm_client.c +1 -1
index 8cb93f5209a4..536a22747b51 100644
@@ -237,7 +237,7 @@ static void drm_client_buffer_delete(struct drm_client_buffer *buffer)
 	drm_gem_vunmap(buffer->gem, buffer->vaddr);
 
 	if (buffer->gem)
-		drm_gem_object_put_unlocked(buffer->gem);
+		drm_gem_object_put(buffer->gem);
 
 	if (buffer->handle)
 		drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file);
drivers/gpu/drm/drm_gem.c +13 -13
index f21327ebc562..ae02b3842c90 100644
@@ -235,7 +235,7 @@ drm_gem_object_handle_put_unlocked(struct drm_gem_object *obj)
 	mutex_unlock(&dev->object_name_lock);
 
 	if (final)
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 }
 
 /*
@@ -331,7 +331,7 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
 
 	*offset = drm_vma_node_offset_addr(&obj->vma_node);
 out:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -690,7 +690,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,
  * Returns:
  *
  * @objs filled in with GEM object pointers. Returned GEM objects need to be
- * released with drm_gem_object_put_unlocked(). -ENOENT is returned on a lookup
+ * released with drm_gem_object_put(). -ENOENT is returned on a lookup
  * failure. 0 is returned on success.
  *
  */
@@ -785,7 +785,7 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,
 	else if (ret > 0)
 		ret = 0;
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
@@ -860,7 +860,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
 
 err:
 	mutex_unlock(&dev->object_name_lock);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	return ret;
 }
 
@@ -898,7 +898,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
 
 	/* drm_gem_handle_create_tail unlocks dev->object_name_lock. */
 	ret = drm_gem_handle_create_tail(file_priv, obj, &handle);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	if (ret)
 		return ret;
 
@@ -991,7 +991,7 @@ EXPORT_SYMBOL(drm_gem_object_free);
  * driver doesn't use &drm_device.struct_mutex for anything.
  *
  * For drivers not encumbered with legacy locking use
- * drm_gem_object_put_unlocked() instead.
+ * drm_gem_object_put() instead.
  */
 void
 drm_gem_object_put_locked(struct drm_gem_object *obj)
@@ -1030,7 +1030,7 @@ void drm_gem_vm_close(struct vm_area_struct *vma)
 {
 	struct drm_gem_object *obj = vma->vm_private_data;
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 }
 EXPORT_SYMBOL(drm_gem_vm_close);
 
@@ -1079,7 +1079,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
 	if (obj->funcs && obj->funcs->mmap) {
 		ret = obj->funcs->mmap(obj, vma);
 		if (ret) {
-			drm_gem_object_put_unlocked(obj);
+			drm_gem_object_put(obj);
 			return ret;
 		}
 		WARN_ON(!(vma->vm_flags & VM_DONTEXPAND));
@@ -1089,7 +1089,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
 		else if (dev->driver->gem_vm_ops)
 			vma->vm_ops = dev->driver->gem_vm_ops;
 		else {
-			drm_gem_object_put_unlocked(obj);
+			drm_gem_object_put(obj);
 			return -EINVAL;
 		}
 
@@ -1155,13 +1155,13 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
 		return -EINVAL;
 
 	if (!drm_vma_node_is_allowed(node, priv)) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return -EACCES;
 	}
 
 	if (node->readonly) {
 		if (vma->vm_flags & VM_WRITE) {
-			drm_gem_object_put_unlocked(obj);
+			drm_gem_object_put(obj);
 			return -EINVAL;
 		}
 
@@ -1171,7 +1171,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
 	ret = drm_gem_mmap_obj(obj, drm_vma_node_size(node) << PAGE_SHIFT,
 			       vma);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return ret;
 }
drivers/gpu/drm/drm_gem_cma_helper.c +4 -4
index 12e98fb28229..b3db3ca7bd7a 100644
@@ -114,7 +114,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
 	return cma_obj;
 
 error:
-	drm_gem_object_put_unlocked(&cma_obj->base);
+	drm_gem_object_put(&cma_obj->base);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(drm_gem_cma_create);
@@ -156,7 +156,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,
 	 */
 	ret = drm_gem_handle_create(file_priv, gem_obj, handle);
 	/* drop reference from allocate - handle holds it now. */
-	drm_gem_object_put_unlocked(gem_obj);
+	drm_gem_object_put(gem_obj);
 	if (ret)
 		return ERR_PTR(ret);
 
@@ -380,13 +380,13 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
 		return -EINVAL;
 
 	if (!drm_vma_node_is_allowed(node, priv)) {
-		drm_gem_object_put_unlocked(obj);
+		drm_gem_object_put(obj);
 		return -EACCES;
 	}
 
 	cma_obj = to_drm_gem_cma_obj(obj);
 
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	return cma_obj->vaddr ? (unsigned long)cma_obj->vaddr : -EINVAL;
 }
drivers/gpu/drm/drm_gem_framebuffer_helper.c +3 -3
index ccc2c71fa491..109d11fb4cd4 100644
@@ -95,7 +95,7 @@ void drm_gem_fb_destroy(struct drm_framebuffer *fb)
 	int i;
 
 	for (i = 0; i < 4; i++)
-		drm_gem_object_put_unlocked(fb->obj[i]);
+		drm_gem_object_put(fb->obj[i]);
 
 	drm_framebuffer_cleanup(fb);
 	kfree(fb);
@@ -175,7 +175,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev,
 			 + mode_cmd->offsets[i];
 
 		if (objs[i]->size < min_size) {
-			drm_gem_object_put_unlocked(objs[i]);
+			drm_gem_object_put(objs[i]);
 			ret = -EINVAL;
 			goto err_gem_object_put;
 		}
@@ -189,7 +189,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev,
 
 err_gem_object_put:
 	for (i--; i >= 0; i--)
-		drm_gem_object_put_unlocked(objs[i]);
+		drm_gem_object_put(objs[i]);
 
 	return ret;
 }
drivers/gpu/drm/drm_gem_shmem_helper.c +2 -2
index df31e5782eed..339eee79ea52 100644
@@ -360,7 +360,7 @@ drm_gem_shmem_create_with_handle(struct drm_file *file_priv,
 	 */
 	ret = drm_gem_handle_create(file_priv, &shmem->base, handle);
 	/* drop reference from allocate - handle holds it now. */
-	drm_gem_object_put_unlocked(&shmem->base);
+	drm_gem_object_put(&shmem->base);
 	if (ret)
 		return ERR_PTR(ret);
 
@@ -684,7 +684,7 @@ drm_gem_shmem_prime_import_sg_table(struct drm_device *dev,
 err_free_array:
 	kvfree(shmem->pages);
 err_free_gem:
-	drm_gem_object_put_unlocked(&shmem->base);
+	drm_gem_object_put(&shmem->base);
 
 	return ERR_PTR(ret);
 }
drivers/gpu/drm/drm_gem_ttm_helper.c +1 -1
index 605a8a3da7f9..892b2288a104 100644
@@ -74,7 +74,7 @@ int drm_gem_ttm_mmap(struct drm_gem_object *gem,
 	 * ttm has its own object refcounting, so drop gem reference
 	 * to avoid double accounting counting.
 	 */
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return 0;
 }
drivers/gpu/drm/drm_gem_vram_helper.c +5 -5
index 8b2d5c945c95..0023ce1d2cf7 100644
@@ -618,9 +618,9 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
 
 	ret = drm_gem_handle_create(file, &gbo->bo.base, &handle);
 	if (ret)
-		goto err_drm_gem_object_put_unlocked;
+		goto err_drm_gem_object_put;
 
-	drm_gem_object_put_unlocked(&gbo->bo.base);
+	drm_gem_object_put(&gbo->bo.base);
 
 	args->pitch = pitch;
 	args->size = size;
@@ -628,8 +628,8 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
 
 	return 0;
 
-err_drm_gem_object_put_unlocked:
-	drm_gem_object_put_unlocked(&gbo->bo.base);
+err_drm_gem_object_put:
+	drm_gem_object_put(&gbo->bo.base);
 	return ret;
 }
 EXPORT_SYMBOL(drm_gem_vram_fill_create_dumb);
@@ -737,7 +737,7 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file,
 	gbo = drm_gem_vram_of_gem(gem);
 	*offset = drm_gem_vram_mmap_offset(gbo);
 
-	drm_gem_object_put_unlocked(gem);
+	drm_gem_object_put(gem);
 
 	return 0;
 }
drivers/gpu/drm/drm_prime.c +3 -3
index 282774e469ac..bbfc713bfdc3 100644
@@ -270,7 +270,7 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
 	struct drm_device *dev = obj->dev;
 
 	/* drop the reference on the export fd holds */
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 
 	drm_dev_put(dev);
 }
@@ -329,7 +329,7 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,
 
 	/* _handle_create_tail unconditionally unlocks dev->object_name_lock. */
 	ret = drm_gem_handle_create_tail(file_priv, obj, handle);
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 	if (ret)
 		goto out_put;
 
@@ -500,7 +500,7 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev,
 fail_put_dmabuf:
 	dma_buf_put(dmabuf);
 out:
-	drm_gem_object_put_unlocked(obj);
+	drm_gem_object_put(obj);
 out_unlock:
 	mutex_unlock(&file_priv->prime.lock);
 
include/drm/drm_gem.h +1 -3
index 70c0059ee72b..eeb6f2cd5d24 100644
@@ -188,7 +188,7 @@ struct drm_gem_object {
 	 * Reference count of this object
 	 *
 	 * Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked()
-	 * or drm_gem_object_put_unlocked() to release a reference to a GEM
+	 * or drm_gem_object_put() to release a reference to a GEM
 	 * buffer object.
 	 */
 	struct kref refcount;
@@ -376,8 +376,6 @@ drm_gem_object_put(struct drm_gem_object *obj)
 	kref_put(&obj->refcount, drm_gem_object_free);
 }
 
-#define drm_gem_object_put_unlocked drm_gem_object_put
-
 void drm_gem_object_put_locked(struct drm_gem_object *obj);
 
 int drm_gem_handle_create(struct drm_file *file_priv,
Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Acked-by on the v1 series
#71 lore raw
In reply to Emil Velikov

Hi Emil.

Quoted 17 lines · Emil Velikov

Hi all,

Recently I had a look at the new dmabuf AMDGPU implementation.

Seemingly it was using the wrong drm_gem_object_put API. Namely the locked one, even though the driver is struct_mutex free.

Upon checking with the documentation, I've noticed it's a bit misleading so I've went ahead and:

- tweaked the drm_gem_object_put/struct_mutex references in the docs
- fixed up the AMDGPU caller
- removed the gem_free_object driver hook - \o/
- fold drm_gem_object_put_unlocked and __drm_gem_object_put
- drm_gem_object_put - add _locked suffix
- drm_gem_object_put_unlocked - remove _unlocked suffix

Quoted 4 lines

Although the rename patches are a handful, it does make sense to have a consistent and obviously named API.

Input and reviews are highly appreciated.

All patches I did not comment are:

I see why you introduced _unlocked, and remove it again. So you could ask the compiler to help you.

But I see this as something that should not be committed and only part of your own tree.
But thats not something I feel too strong about - let's just say it confused me a lttle.

The driver patches was only skimmed, as they were mechanical anyway.

Sam

Quoted 134 lines

Emil

Cc Daniel Vetter <[email protected]>

Emil Velikov (36):
drm: remove unused drm_gem.h include
drm/gem: use _unlocked reference in drm_gem_objects_lookup docs drm/todo: mention i915 in the struct_mutex section drm/doc: drop struct_mutex references
drm/doc: drop struct_mutex refernce for drm_gem_object_free drm/amdgpu: use the unlocked drm_gem_object_put drm/gma500: Use lockless gem BO free callback
drm: remove drm_driver::gem_free_object
drm/gem: fold drm_gem_object_put_unlocked and __drm_gem_object_put() drm/gem: add _locked suffix to drm_object_put
drm/gem: add drm_object_put helper
drm/amd: remove _unlocked suffix in drm_object_put_unlocked drm/arm: remove _unlocked suffix in drm_object_put_unlocked drm/armada: remove _unlocked suffix in drm_object_put_unlocked drm/etnaviv: remove _unlocked suffix in drm_object_put_unlocked drm/exynos: remove _unlocked suffix in drm_object_put_unlocked drm/gma500: remove _unlocked suffix in drm_object_put_unlocked drm/i915: remove _unlocked suffix in drm_object_put_unlocked drm/lima: remove _unlocked suffix in drm_object_put_unlocked drm/mediatek: remove _unlocked suffix in drm_object_put_unlocked drm/mgag200: remove _unlocked suffix in drm_object_put_unlocked drm/msm: remove _unlocked suffix in drm_object_put_unlocked drm/nouveau: remove _unlocked suffix in drm_object_put_unlocked drm/omapdrm: remove _unlocked suffix in drm_object_put_unlocked drm/panfrost: remove _unlocked suffix in drm_object_put_unlocked drm/qxl: remove _unlocked suffix in drm_object_put_unlocked drm/radeon: remove _unlocked suffix in drm_object_put_unlocked drm/rockchip: remove _unlocked suffix in drm_object_put_unlocked drm/tegra: remove _unlocked suffix in drm_object_put_unlocked drm/v3d: remove _unlocked suffix in drm_object_put_unlocked drm/vc4: remove _unlocked suffix in drm_object_put_unlocked drm/vgem: remove _unlocked suffix in drm_object_put_unlocked drm/virtio: remove _unlocked suffix in drm_object_put_unlocked drm/vkms: remove _unlocked suffix in drm_object_put_unlocked drm/xen: remove _unlocked suffix in drm_object_put_unlocked drm/gem: remove _unlocked suffix in drm_object_put_unlocked

 Documentation/gpu/drm-mm.rst                  |  5 +-
 Documentation/gpu/todo.rst                    |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c        |  4 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c       | 20 +++---
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c        |  6 +-
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c        |  6 +-
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c         |  6 +-
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c         |  6 +-
 .../arm/display/komeda/komeda_framebuffer.c   |  6 +-
 drivers/gpu/drm/arm/malidp_drv.c              |  4 +-
 drivers/gpu/drm/armada/armada_crtc.c          |  8 +--
 drivers/gpu/drm/armada/armada_fb.c            |  4 +-
 drivers/gpu/drm/armada/armada_fbdev.c         |  6 +-
 drivers/gpu/drm/armada/armada_gem.c           | 10 +--
 drivers/gpu/drm/drm_client.c                  |  2 +-
 drivers/gpu/drm/drm_gem.c                     | 70 +++++--------------
 drivers/gpu/drm/drm_gem_cma_helper.c          |  8 +--
 drivers/gpu/drm/drm_gem_framebuffer_helper.c  |  6 +-
 drivers/gpu/drm/drm_gem_shmem_helper.c        |  4 +-
 drivers/gpu/drm/drm_gem_ttm_helper.c          |  2 +-
 drivers/gpu/drm/drm_gem_vram_helper.c         | 10 +--
 drivers/gpu/drm/drm_prime.c                   |  6 +-
 drivers/gpu/drm/drm_vm.c                      |  1 -
 drivers/gpu/drm/etnaviv/etnaviv_drv.c         |  8 +--
 drivers/gpu/drm/etnaviv/etnaviv_gem.c         |  6 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c   |  2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c  |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_gem.c       |  4 +-
 drivers/gpu/drm/exynos/exynos_drm_gem.h       |  2 +-
 drivers/gpu/drm/gma500/framebuffer.c          |  2 +-
 drivers/gpu/drm/gma500/gem.c                  |  2 +-
 drivers/gpu/drm/gma500/gma_display.c          |  6 +-
 drivers/gpu/drm/gma500/psb_drv.c              |  2 +-
 drivers/gpu/drm/i915/gem/i915_gem_object.h    |  2 +-
 drivers/gpu/drm/lima/lima_gem.c               | 10 +--
 drivers/gpu/drm/lima/lima_sched.c             |  2 +-
 drivers/gpu/drm/mediatek/mtk_drm_gem.c        |  2 +-
 drivers/gpu/drm/mgag200/mgag200_cursor.c      |  8 +--
 drivers/gpu/drm/msm/adreno/a5xx_debugfs.c     |  4 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c         |  6 +-
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c         |  2 +-
 drivers/gpu/drm/msm/disp/mdp4/mdp4_crtc.c     |  4 +-
 drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c      |  2 +-
 drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c     |  2 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c            |  2 +-
 drivers/gpu/drm/msm/msm_drv.c                 |  8 +--
 drivers/gpu/drm/msm/msm_fb.c                  |  4 +-
 drivers/gpu/drm/msm/msm_gem.c                 | 18 ++---
 drivers/gpu/drm/msm/msm_gem_submit.c          |  2 +-
 drivers/gpu/drm/msm/msm_gpu.c                 |  2 +-
 drivers/gpu/drm/nouveau/dispnv04/crtc.c       |  2 +-
 drivers/gpu/drm/nouveau/nouveau_abi16.c       |  2 +-
 drivers/gpu/drm/nouveau/nouveau_display.c     |  8 +--
 drivers/gpu/drm/nouveau/nouveau_gem.c         | 14 ++--
 drivers/gpu/drm/omapdrm/omap_drv.c            |  2 +-
 drivers/gpu/drm/omapdrm/omap_fb.c             |  2 +-
 drivers/gpu/drm/omapdrm/omap_fbdev.c          |  2 +-
 drivers/gpu/drm/omapdrm/omap_gem.c            |  4 +-
 drivers/gpu/drm/panfrost/panfrost_drv.c       | 10 +--
 drivers/gpu/drm/panfrost/panfrost_gem.c       |  4 +-
 drivers/gpu/drm/panfrost/panfrost_job.c       |  2 +-
 drivers/gpu/drm/panfrost/panfrost_mmu.c       |  2 +-
 drivers/gpu/drm/panfrost/panfrost_perfcnt.c   |  4 +-
 drivers/gpu/drm/qxl/qxl_cmd.c                 |  2 +-
 drivers/gpu/drm/qxl/qxl_display.c             |  6 +-
 drivers/gpu/drm/qxl/qxl_dumb.c                |  2 +-
 drivers/gpu/drm/qxl/qxl_gem.c                 |  2 +-
 drivers/gpu/drm/qxl/qxl_ioctl.c               |  4 +-
 drivers/gpu/drm/qxl/qxl_object.c              |  4 +-
 drivers/gpu/drm/radeon/radeon_cs.c            |  2 +-
 drivers/gpu/drm/radeon/radeon_cursor.c        |  6 +-
 drivers/gpu/drm/radeon/radeon_display.c       |  8 +--
 drivers/gpu/drm/radeon/radeon_fb.c            |  4 +-
 drivers/gpu/drm/radeon/radeon_gem.c           | 30 ++++----
 drivers/gpu/drm/radeon/radeon_object.c        |  2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_fb.c    |  2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c   |  2 +-
 drivers/gpu/drm/tegra/drm.c                   | 12 ++--
 drivers/gpu/drm/tegra/fb.c                    |  6 +-
 drivers/gpu/drm/tegra/gem.c                   |  4 +-
 drivers/gpu/drm/v3d/v3d_bo.c                  |  6 +-
 drivers/gpu/drm/v3d/v3d_gem.c                 |  4 +-
 drivers/gpu/drm/v3d/v3d_irq.c                 |  2 +-
 drivers/gpu/drm/vc4/vc4_bo.c                  | 14 ++--
 drivers/gpu/drm/vc4/vc4_gem.c                 | 14 ++--
 drivers/gpu/drm/vc4/vc4_kms.c                 |  2 +-
 drivers/gpu/drm/vc4/vc4_v3d.c                 |  4 +-
 drivers/gpu/drm/vgem/vgem_drv.c               |  6 +-
 drivers/gpu/drm/vgem/vgem_fence.c             |  2 +-
Quoted 16 lines
 drivers/gpu/drm/virtio/virtgpu_display.c      |  2 +-
 drivers/gpu/drm/virtio/virtgpu_gem.c          |  6 +-
 drivers/gpu/drm/virtio/virtgpu_ioctl.c        |  6 +-
 drivers/gpu/drm/vkms/vkms_gem.c               |  2 +-
 drivers/gpu/drm/xen/xen_drm_front.c           |  4 +-
 include/drm/drm_drv.h                         |  8 ---
 include/drm/drm_gem.h                         | 28 +++-----
 99 files changed, 269 insertions(+), 325 deletions(-)
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#72 lore raw
Quoted 20 lines · Sam Ravnborg

Hi Emil.

Quoted 17 lines · Emil Velikov

Hi all,

Recently I had a look at the new dmabuf AMDGPU implementation.

Seemingly it was using the wrong drm_gem_object_put API. Namely the locked one, even though the driver is struct_mutex free.

Upon checking with the documentation, I've noticed it's a bit misleading so I've went ahead and:

- tweaked the drm_gem_object_put/struct_mutex references in the docs
- fixed up the AMDGPU caller
- removed the gem_free_object driver hook - \o/
- fold drm_gem_object_put_unlocked and __drm_gem_object_put
- drm_gem_object_put - add _locked suffix
- drm_gem_object_put_unlocked - remove _unlocked suffix

Quoted 7 lines
Quoted 4 lines

Although the rename patches are a handful, it does make sense to have a consistent and obviously named API.

Input and reviews are highly appreciated.

All patches I did not comment are:

Thanks Sam.

Quoted 8 lines

I see why you introduced _unlocked, and remove it again. So you could ask the compiler to help you.

But I see this as something that should not be committed and only part of your own tree.
But thats not something I feel too strong about - let's just say it confused me a lttle.

I believe the confusion should be addressed now.

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel