* [PATCH] drm/tegra: Use drm_gem_object_reference_unlocked
@ 2015-10-21 8:06 Daniel Vetter
2015-10-21 8:20 ` Daniel Vetter
2015-10-21 13:03 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Vetter @ 2015-10-21 8:06 UTC (permalink / raw)
To: Intel Graphics Development; +Cc: Daniel Vetter, Thierry Reding, Daniel Vetter
This only grabs the mutex when really needed, but still has a
might-acquire lockdep check to make sure that's always possible.
With this patch tegra is officially struct_mutex free, yay!
Cc: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
drivers/gpu/drm/tegra/drm.c | 4 +---
drivers/gpu/drm/tegra/gem.c | 8 ++------
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 159ef515cab1..5de9a4ead463 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -277,9 +277,7 @@ host1x_bo_lookup(struct drm_device *drm, struct drm_file *file, u32 handle)
if (!gem)
return NULL;
- mutex_lock(&drm->struct_mutex);
- drm_gem_object_unreference(gem);
- mutex_unlock(&drm->struct_mutex);
+ drm_gem_object_unreference_unlocked(gem);
bo = to_tegra_bo(gem);
return &bo->base;
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
index fb712316c522..1146fbe523d5 100644
--- a/drivers/gpu/drm/tegra/gem.c
+++ b/drivers/gpu/drm/tegra/gem.c
@@ -30,9 +30,7 @@ static void tegra_bo_put(struct host1x_bo *bo)
struct tegra_bo *obj = host1x_to_tegra_bo(bo);
struct drm_device *drm = obj->gem.dev;
- mutex_lock(&drm->struct_mutex);
- drm_gem_object_unreference(&obj->gem);
- mutex_unlock(&drm->struct_mutex);
+ drm_gem_object_unreference_unlocked(&obj->gem);
}
static dma_addr_t tegra_bo_pin(struct host1x_bo *bo, struct sg_table **sgt)
@@ -74,9 +72,7 @@ static struct host1x_bo *tegra_bo_get(struct host1x_bo *bo)
struct tegra_bo *obj = host1x_to_tegra_bo(bo);
struct drm_device *drm = obj->gem.dev;
- mutex_lock(&drm->struct_mutex);
- drm_gem_object_reference(&obj->gem);
- mutex_unlock(&drm->struct_mutex);
+ drm_gem_object_reference_unlocked(&obj->gem);
return bo;
}
--
2.5.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/tegra: Use drm_gem_object_reference_unlocked
2015-10-21 8:06 [PATCH] drm/tegra: Use drm_gem_object_reference_unlocked Daniel Vetter
@ 2015-10-21 8:20 ` Daniel Vetter
2015-10-21 13:03 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2015-10-21 8:20 UTC (permalink / raw)
To: Intel Graphics Development; +Cc: Daniel Vetter, Thierry Reding, Daniel Vetter
On Wed, Oct 21, 2015 at 10:06:31AM +0200, Daniel Vetter wrote:
> This only grabs the mutex when really needed, but still has a
> might-acquire lockdep check to make sure that's always possible.
> With this patch tegra is officially struct_mutex free, yay!
>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Please disregard this, wrong patch.
-Daniel
> ---
> drivers/gpu/drm/tegra/drm.c | 4 +---
> drivers/gpu/drm/tegra/gem.c | 8 ++------
> 2 files changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index 159ef515cab1..5de9a4ead463 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -277,9 +277,7 @@ host1x_bo_lookup(struct drm_device *drm, struct drm_file *file, u32 handle)
> if (!gem)
> return NULL;
>
> - mutex_lock(&drm->struct_mutex);
> - drm_gem_object_unreference(gem);
> - mutex_unlock(&drm->struct_mutex);
> + drm_gem_object_unreference_unlocked(gem);
>
> bo = to_tegra_bo(gem);
> return &bo->base;
> diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
> index fb712316c522..1146fbe523d5 100644
> --- a/drivers/gpu/drm/tegra/gem.c
> +++ b/drivers/gpu/drm/tegra/gem.c
> @@ -30,9 +30,7 @@ static void tegra_bo_put(struct host1x_bo *bo)
> struct tegra_bo *obj = host1x_to_tegra_bo(bo);
> struct drm_device *drm = obj->gem.dev;
>
> - mutex_lock(&drm->struct_mutex);
> - drm_gem_object_unreference(&obj->gem);
> - mutex_unlock(&drm->struct_mutex);
> + drm_gem_object_unreference_unlocked(&obj->gem);
> }
>
> static dma_addr_t tegra_bo_pin(struct host1x_bo *bo, struct sg_table **sgt)
> @@ -74,9 +72,7 @@ static struct host1x_bo *tegra_bo_get(struct host1x_bo *bo)
> struct tegra_bo *obj = host1x_to_tegra_bo(bo);
> struct drm_device *drm = obj->gem.dev;
>
> - mutex_lock(&drm->struct_mutex);
> - drm_gem_object_reference(&obj->gem);
> - mutex_unlock(&drm->struct_mutex);
> + drm_gem_object_reference_unlocked(&obj->gem);
>
> return bo;
> }
> --
> 2.5.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/tegra: Use drm_gem_object_reference_unlocked
2015-10-21 8:06 [PATCH] drm/tegra: Use drm_gem_object_reference_unlocked Daniel Vetter
2015-10-21 8:20 ` Daniel Vetter
@ 2015-10-21 13:03 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2015-10-21 13:03 UTC (permalink / raw)
Cc: Daniel Vetter, Intel Graphics Development, Thierry Reding,
kbuild-all, Daniel Vetter
[-- Attachment #1: Type: text/plain, Size: 3052 bytes --]
Hi Daniel,
[auto build test ERROR on drm-intel/for-linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Daniel-Vetter/drm-tegra-Use-drm_gem_object_reference_unlocked/20151021-160838
config: arm-tegra_defconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm
All errors (new ones prefixed by >>):
drivers/gpu/drm/tegra/gem.c: In function 'tegra_bo_put':
drivers/gpu/drm/tegra/gem.c:31:21: warning: unused variable 'drm' [-Wunused-variable]
struct drm_device *drm = obj->gem.dev;
^
drivers/gpu/drm/tegra/gem.c: In function 'tegra_bo_get':
>> drivers/gpu/drm/tegra/gem.c:75:2: error: implicit declaration of function 'drm_gem_object_reference_unlocked' [-Werror=implicit-function-declaration]
drm_gem_object_reference_unlocked(&obj->gem);
^
drivers/gpu/drm/tegra/gem.c:73:21: warning: unused variable 'drm' [-Wunused-variable]
struct drm_device *drm = obj->gem.dev;
^
cc1: some warnings being treated as errors
vim +/drm_gem_object_reference_unlocked +75 drivers/gpu/drm/tegra/gem.c
25 return container_of(bo, struct tegra_bo, base);
26 }
27
28 static void tegra_bo_put(struct host1x_bo *bo)
29 {
30 struct tegra_bo *obj = host1x_to_tegra_bo(bo);
> 31 struct drm_device *drm = obj->gem.dev;
32
33 drm_gem_object_unreference_unlocked(&obj->gem);
34 }
35
36 static dma_addr_t tegra_bo_pin(struct host1x_bo *bo, struct sg_table **sgt)
37 {
38 struct tegra_bo *obj = host1x_to_tegra_bo(bo);
39
40 return obj->paddr;
41 }
42
43 static void tegra_bo_unpin(struct host1x_bo *bo, struct sg_table *sgt)
44 {
45 }
46
47 static void *tegra_bo_mmap(struct host1x_bo *bo)
48 {
49 struct tegra_bo *obj = host1x_to_tegra_bo(bo);
50
51 return obj->vaddr;
52 }
53
54 static void tegra_bo_munmap(struct host1x_bo *bo, void *addr)
55 {
56 }
57
58 static void *tegra_bo_kmap(struct host1x_bo *bo, unsigned int page)
59 {
60 struct tegra_bo *obj = host1x_to_tegra_bo(bo);
61
62 return obj->vaddr + page * PAGE_SIZE;
63 }
64
65 static void tegra_bo_kunmap(struct host1x_bo *bo, unsigned int page,
66 void *addr)
67 {
68 }
69
70 static struct host1x_bo *tegra_bo_get(struct host1x_bo *bo)
71 {
72 struct tegra_bo *obj = host1x_to_tegra_bo(bo);
73 struct drm_device *drm = obj->gem.dev;
74
> 75 drm_gem_object_reference_unlocked(&obj->gem);
76
77 return bo;
78 }
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 26272 bytes --]
[-- Attachment #3: Type: text/plain, Size: 159 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-21 13:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-21 8:06 [PATCH] drm/tegra: Use drm_gem_object_reference_unlocked Daniel Vetter
2015-10-21 8:20 ` Daniel Vetter
2015-10-21 13:03 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.