dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] consistently use dma_resv locking wrappers
@ 2019-11-25  9:43 Daniel Vetter
  2019-11-25  9:43 ` Daniel Vetter
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Daniel Vetter @ 2019-11-25  9:43 UTC (permalink / raw)
  To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development

Hi all,

This is prep work for some dma_resv series I'm tinkering with, but I
figured good to split this out since good idea to land this no matter what
exactly I'll end up creating in dma_resv. With these everything in
drivers/gpu nicely goes through either the dma_resv or drm_modeset_lock
wrappers, and doesn't call ww_mutex directly.

Review, comments, acks all very much welcome, as usual.

Cheers, Daniel

Daniel Vetter (4):
  drm/etnaviv: Use dma_resv locking wrappers
  drm/i915: Use dma_resv locking wrappers
  drm/msm: Use dma_resv locking wrappers
  drm/vc4: Use dma_resv locking wrappers

 drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c   |  8 +++-----
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |  6 +++---
 drivers/gpu/drm/msm/msm_gem_submit.c           | 10 +++++-----
 drivers/gpu/drm/vc4/vc4_gem.c                  | 11 +++++------
 4 files changed, 16 insertions(+), 19 deletions(-)

-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 0/4] consistently use dma_resv locking wrappers
  2019-11-25  9:43 [PATCH 0/4] consistently use dma_resv locking wrappers Daniel Vetter
@ 2019-11-25  9:43 ` Daniel Vetter
  2019-11-25  9:43 ` [PATCH 1/4] drm/etnaviv: Use " Daniel Vetter
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2019-11-25  9:43 UTC (permalink / raw)
  To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development

Hi all,

This is prep work for some dma_resv series I'm tinkering with, but I
figured good to split this out since good idea to land this no matter what
exactly I'll end up creating in dma_resv. With these everything in
drivers/gpu nicely goes through either the dma_resv or drm_modeset_lock
wrappers, and doesn't call ww_mutex directly.

Review, comments, acks all very much welcome, as usual.

Cheers, Daniel

Daniel Vetter (4):
  drm/etnaviv: Use dma_resv locking wrappers
  drm/i915: Use dma_resv locking wrappers
  drm/msm: Use dma_resv locking wrappers
  drm/vc4: Use dma_resv locking wrappers

 drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c   |  8 +++-----
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |  6 +++---
 drivers/gpu/drm/msm/msm_gem_submit.c           | 10 +++++-----
 drivers/gpu/drm/vc4/vc4_gem.c                  | 11 +++++------
 4 files changed, 16 insertions(+), 19 deletions(-)

-- 
2.24.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/4] drm/etnaviv: Use dma_resv locking wrappers
  2019-11-25  9:43 [PATCH 0/4] consistently use dma_resv locking wrappers Daniel Vetter
  2019-11-25  9:43 ` Daniel Vetter
@ 2019-11-25  9:43 ` Daniel Vetter
  2019-12-13 20:08   ` Daniel Vetter
  2019-12-14  0:09   ` [PATCH] " Daniel Vetter
  2019-11-25  9:43 ` [PATCH 2/4] drm/i915: " Daniel Vetter
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 20+ messages in thread
From: Daniel Vetter @ 2019-11-25  9:43 UTC (permalink / raw)
  To: DRI Development
  Cc: Daniel Vetter, Intel Graphics Development, etnaviv, Russell King,
	Daniel Vetter

I'll add more fancy logic to them soon, so everyone really has to use
them. Plus they already provide some nice additional debug
infrastructure on top of direct ww_mutex usage for the fences tracked
by dma_resv.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: etnaviv@lists.freedesktop.org
---
 drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
index aa3e4c3b063a..947b21868e72 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
@@ -113,7 +113,7 @@ static void submit_unlock_object(struct etnaviv_gem_submit *submit, int i)
 	if (submit->bos[i].flags & BO_LOCKED) {
 		struct drm_gem_object *obj = &submit->bos[i].obj->base;
 
-		ww_mutex_unlock(&obj->resv->lock);
+		dma_resv_unlock(obj->resv);
 		submit->bos[i].flags &= ~BO_LOCKED;
 	}
 }
@@ -133,8 +133,7 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
 		contended = i;
 
 		if (!(submit->bos[i].flags & BO_LOCKED)) {
-			ret = ww_mutex_lock_interruptible(&obj->resv->lock,
-							  ticket);
+			ret = dma_resv_lock(obj->resv, ticket);
 			if (ret == -EALREADY)
 				DRM_ERROR("BO at index %u already on submit list\n",
 					  i);
@@ -161,8 +160,7 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
 		obj = &submit->bos[contended].obj->base;
 
 		/* we lost out in a seqno race, lock and retry.. */
-		ret = ww_mutex_lock_slow_interruptible(&obj->resv->lock,
-						       ticket);
+		ret = dma_resv_lock_slow_interruptible(obj->resv, ticket);
 		if (!ret) {
 			submit->bos[contended].flags |= BO_LOCKED;
 			slow_locked = contended;
-- 
2.24.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/4] drm/i915: Use dma_resv locking wrappers
  2019-11-25  9:43 [PATCH 0/4] consistently use dma_resv locking wrappers Daniel Vetter
  2019-11-25  9:43 ` Daniel Vetter
  2019-11-25  9:43 ` [PATCH 1/4] drm/etnaviv: Use " Daniel Vetter
@ 2019-11-25  9:43 ` Daniel Vetter
  2019-12-14  0:10   ` Daniel Vetter
       [not found] ` <20191125094356.161941-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Daniel Vetter @ 2019-11-25  9:43 UTC (permalink / raw)
  To: DRI Development
  Cc: Tvrtko Ursulin, Jani Nikula, Daniel Vetter,
	Intel Graphics Development, Matthew Auld, Daniel Vetter

I'll add more fancy logic to them soon, so everyone really has to use
them. Plus they already provide some nice additional debug
infrastructure on top of direct ww_mutex usage for the fences tracked
by dma_resv.

Aside: We might want to create wrappers for i915_vma locking of the
->resv like we have for the i915_gem_bo itself already.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index 7a87e8270460..7b8f4ebd9986 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -1848,7 +1848,7 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
 	for (i = 0; i < count; i++) {
 		struct i915_vma *vma = eb->vma[i];
 
-		err = ww_mutex_lock_interruptible(&vma->resv->lock, &acquire);
+		err = dma_resv_lock_interruptible(vma->resv, &acquire);
 		if (!err)
 			continue;
 
@@ -1859,7 +1859,7 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
 			do {
 				int j = i - 1;
 
-				ww_mutex_unlock(&eb->vma[j]->resv->lock);
+				dma_resv_unlock(eb->vma[j]->resv);
 
 				swap(eb->flags[i], eb->flags[j]);
 				swap(eb->vma[i],  eb->vma[j]);
@@ -1868,7 +1868,7 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
 			GEM_BUG_ON(vma != eb->vma[0]);
 			vma->exec_flags = &eb->flags[0];
 
-			err = ww_mutex_lock_slow_interruptible(&vma->resv->lock,
+			err = dma_resv_lock_slow_interruptible(vma->resv,
 							       &acquire);
 		}
 		if (err)
-- 
2.24.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/4] drm/msm: Use dma_resv locking wrappers
       [not found] ` <20191125094356.161941-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
@ 2019-11-25  9:43   ` Daniel Vetter
  2019-11-25  9:43     ` Daniel Vetter
  2019-12-13 20:08     ` Daniel Vetter
  0 siblings, 2 replies; 20+ messages in thread
From: Daniel Vetter @ 2019-11-25  9:43 UTC (permalink / raw)
  To: DRI Development
  Cc: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Daniel Vetter,
	Intel Graphics Development, Rob Clark,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Daniel Vetter, Sean Paul

I'll add more fancy logic to them soon, so everyone really has to use
them. Plus they already provide some nice additional debug
infrastructure on top of direct ww_mutex usage for the fences tracked
by dma_resv.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index 7d04c47d0023..385d4965a8d0 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -157,7 +157,7 @@ static void submit_unlock_unpin_bo(struct msm_gem_submit *submit,
 		msm_gem_unpin_iova(&msm_obj->base, submit->aspace);
 
 	if (submit->bos[i].flags & BO_LOCKED)
-		ww_mutex_unlock(&msm_obj->base.resv->lock);
+		dma_resv_unlock(msm_obj->base.resv);
 
 	if (backoff && !(submit->bos[i].flags & BO_VALID))
 		submit->bos[i].iova = 0;
@@ -180,8 +180,8 @@ static int submit_lock_objects(struct msm_gem_submit *submit)
 		contended = i;
 
 		if (!(submit->bos[i].flags & BO_LOCKED)) {
-			ret = ww_mutex_lock_interruptible(&msm_obj->base.resv->lock,
-					&submit->ticket);
+			ret = dma_resv_lock_interruptible(msm_obj->base.resv,
+							  &submit->ticket);
 			if (ret)
 				goto fail;
 			submit->bos[i].flags |= BO_LOCKED;
@@ -202,8 +202,8 @@ static int submit_lock_objects(struct msm_gem_submit *submit)
 	if (ret == -EDEADLK) {
 		struct msm_gem_object *msm_obj = submit->bos[contended].obj;
 		/* we lost out in a seqno race, lock and retry.. */
-		ret = ww_mutex_lock_slow_interruptible(&msm_obj->base.resv->lock,
-				&submit->ticket);
+		ret = dma_resv_lock_slow_interruptible(msm_obj->base.resv,
+						       &submit->ticket);
 		if (!ret) {
 			submit->bos[contended].flags |= BO_LOCKED;
 			slow_locked = contended;
-- 
2.24.0

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/4] drm/msm: Use dma_resv locking wrappers
  2019-11-25  9:43   ` [PATCH 3/4] drm/msm: " Daniel Vetter
@ 2019-11-25  9:43     ` Daniel Vetter
  2019-12-13 20:08     ` Daniel Vetter
  1 sibling, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2019-11-25  9:43 UTC (permalink / raw)
  To: DRI Development
  Cc: freedreno, Daniel Vetter, Intel Graphics Development,
	linux-arm-msm, Daniel Vetter, Sean Paul

I'll add more fancy logic to them soon, so everyone really has to use
them. Plus they already provide some nice additional debug
infrastructure on top of direct ww_mutex usage for the fences tracked
by dma_resv.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
index 7d04c47d0023..385d4965a8d0 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -157,7 +157,7 @@ static void submit_unlock_unpin_bo(struct msm_gem_submit *submit,
 		msm_gem_unpin_iova(&msm_obj->base, submit->aspace);
 
 	if (submit->bos[i].flags & BO_LOCKED)
-		ww_mutex_unlock(&msm_obj->base.resv->lock);
+		dma_resv_unlock(msm_obj->base.resv);
 
 	if (backoff && !(submit->bos[i].flags & BO_VALID))
 		submit->bos[i].iova = 0;
@@ -180,8 +180,8 @@ static int submit_lock_objects(struct msm_gem_submit *submit)
 		contended = i;
 
 		if (!(submit->bos[i].flags & BO_LOCKED)) {
-			ret = ww_mutex_lock_interruptible(&msm_obj->base.resv->lock,
-					&submit->ticket);
+			ret = dma_resv_lock_interruptible(msm_obj->base.resv,
+							  &submit->ticket);
 			if (ret)
 				goto fail;
 			submit->bos[i].flags |= BO_LOCKED;
@@ -202,8 +202,8 @@ static int submit_lock_objects(struct msm_gem_submit *submit)
 	if (ret == -EDEADLK) {
 		struct msm_gem_object *msm_obj = submit->bos[contended].obj;
 		/* we lost out in a seqno race, lock and retry.. */
-		ret = ww_mutex_lock_slow_interruptible(&msm_obj->base.resv->lock,
-				&submit->ticket);
+		ret = dma_resv_lock_slow_interruptible(msm_obj->base.resv,
+						       &submit->ticket);
 		if (!ret) {
 			submit->bos[contended].flags |= BO_LOCKED;
 			slow_locked = contended;
-- 
2.24.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/4] drm/vc4: Use dma_resv locking wrappers
  2019-11-25  9:43 [PATCH 0/4] consistently use dma_resv locking wrappers Daniel Vetter
                   ` (3 preceding siblings ...)
       [not found] ` <20191125094356.161941-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
@ 2019-11-25  9:43 ` Daniel Vetter
  2019-11-25  9:43   ` Daniel Vetter
  2019-12-13 20:10   ` Daniel Vetter
  2019-12-03 16:43 ` [PATCH 0/4] consistently use " Daniel Vetter
  5 siblings, 2 replies; 20+ messages in thread
From: Daniel Vetter @ 2019-11-25  9:43 UTC (permalink / raw)
  To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development, Daniel Vetter

I'll add more fancy logic to them soon, so everyone really has to use
them. Plus they already provide some nice additional debug
infrastructure on top of direct ww_mutex usage for the fences tracked
by dma_resv.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/vc4/vc4_gem.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index 7a06cb6e31c5..e1cfc3ccd05a 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -568,7 +568,7 @@ vc4_unlock_bo_reservations(struct drm_device *dev,
 	for (i = 0; i < exec->bo_count; i++) {
 		struct drm_gem_object *bo = &exec->bo[i]->base;
 
-		ww_mutex_unlock(&bo->resv->lock);
+		dma_resv_unlock(bo->resv);
 	}
 
 	ww_acquire_fini(acquire_ctx);
@@ -595,8 +595,7 @@ vc4_lock_bo_reservations(struct drm_device *dev,
 retry:
 	if (contended_lock != -1) {
 		bo = &exec->bo[contended_lock]->base;
-		ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
-						       acquire_ctx);
+		ret = dma_resv_lock_slow_interruptible(bo->resv, acquire_ctx);
 		if (ret) {
 			ww_acquire_done(acquire_ctx);
 			return ret;
@@ -609,19 +608,19 @@ vc4_lock_bo_reservations(struct drm_device *dev,
 
 		bo = &exec->bo[i]->base;
 
-		ret = ww_mutex_lock_interruptible(&bo->resv->lock, acquire_ctx);
+		ret = dma_resv_lock_interruptible(bo->resv, acquire_ctx);
 		if (ret) {
 			int j;
 
 			for (j = 0; j < i; j++) {
 				bo = &exec->bo[j]->base;
-				ww_mutex_unlock(&bo->resv->lock);
+				dma_resv_unlock(bo->resv);
 			}
 
 			if (contended_lock != -1 && contended_lock >= i) {
 				bo = &exec->bo[contended_lock]->base;
 
-				ww_mutex_unlock(&bo->resv->lock);
+				dma_resv_unlock(bo->resv);
 			}
 
 			if (ret == -EDEADLK) {
-- 
2.24.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/4] drm/vc4: Use dma_resv locking wrappers
  2019-11-25  9:43 ` [PATCH 4/4] drm/vc4: " Daniel Vetter
@ 2019-11-25  9:43   ` Daniel Vetter
  2019-12-13 20:10   ` Daniel Vetter
  1 sibling, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2019-11-25  9:43 UTC (permalink / raw)
  To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development, Daniel Vetter

I'll add more fancy logic to them soon, so everyone really has to use
them. Plus they already provide some nice additional debug
infrastructure on top of direct ww_mutex usage for the fences tracked
by dma_resv.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/vc4/vc4_gem.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index 7a06cb6e31c5..e1cfc3ccd05a 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -568,7 +568,7 @@ vc4_unlock_bo_reservations(struct drm_device *dev,
 	for (i = 0; i < exec->bo_count; i++) {
 		struct drm_gem_object *bo = &exec->bo[i]->base;
 
-		ww_mutex_unlock(&bo->resv->lock);
+		dma_resv_unlock(bo->resv);
 	}
 
 	ww_acquire_fini(acquire_ctx);
@@ -595,8 +595,7 @@ vc4_lock_bo_reservations(struct drm_device *dev,
 retry:
 	if (contended_lock != -1) {
 		bo = &exec->bo[contended_lock]->base;
-		ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
-						       acquire_ctx);
+		ret = dma_resv_lock_slow_interruptible(bo->resv, acquire_ctx);
 		if (ret) {
 			ww_acquire_done(acquire_ctx);
 			return ret;
@@ -609,19 +608,19 @@ vc4_lock_bo_reservations(struct drm_device *dev,
 
 		bo = &exec->bo[i]->base;
 
-		ret = ww_mutex_lock_interruptible(&bo->resv->lock, acquire_ctx);
+		ret = dma_resv_lock_interruptible(bo->resv, acquire_ctx);
 		if (ret) {
 			int j;
 
 			for (j = 0; j < i; j++) {
 				bo = &exec->bo[j]->base;
-				ww_mutex_unlock(&bo->resv->lock);
+				dma_resv_unlock(bo->resv);
 			}
 
 			if (contended_lock != -1 && contended_lock >= i) {
 				bo = &exec->bo[contended_lock]->base;
 
-				ww_mutex_unlock(&bo->resv->lock);
+				dma_resv_unlock(bo->resv);
 			}
 
 			if (ret == -EDEADLK) {
-- 
2.24.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 0/4] consistently use dma_resv locking wrappers
  2019-11-25  9:43 [PATCH 0/4] consistently use dma_resv locking wrappers Daniel Vetter
                   ` (4 preceding siblings ...)
  2019-11-25  9:43 ` [PATCH 4/4] drm/vc4: " Daniel Vetter
@ 2019-12-03 16:43 ` Daniel Vetter
  5 siblings, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2019-12-03 16:43 UTC (permalink / raw)
  To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development

On Mon, Nov 25, 2019 at 10:43:52AM +0100, Daniel Vetter wrote:
> Hi all,
> 
> This is prep work for some dma_resv series I'm tinkering with, but I
> figured good to split this out since good idea to land this no matter what
> exactly I'll end up creating in dma_resv. With these everything in
> drivers/gpu nicely goes through either the dma_resv or drm_modeset_lock
> wrappers, and doesn't call ww_mutex directly.
> 
> Review, comments, acks all very much welcome, as usual.
> 
> Cheers, Daniel
> 
> Daniel Vetter (4):
>   drm/etnaviv: Use dma_resv locking wrappers
>   drm/i915: Use dma_resv locking wrappers
>   drm/msm: Use dma_resv locking wrappers
>   drm/vc4: Use dma_resv locking wrappers

Ping for some review/acks on this series ...
-Daniel

> 
>  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c   |  8 +++-----
>  drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c |  6 +++---
>  drivers/gpu/drm/msm/msm_gem_submit.c           | 10 +++++-----
>  drivers/gpu/drm/vc4/vc4_gem.c                  | 11 +++++------
>  4 files changed, 16 insertions(+), 19 deletions(-)
> 
> -- 
> 2.24.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/4] drm/etnaviv: Use dma_resv locking wrappers
  2019-11-25  9:43 ` [PATCH 1/4] drm/etnaviv: Use " Daniel Vetter
@ 2019-12-13 20:08   ` Daniel Vetter
  2019-12-13 20:52     ` Ruhl, Michael J
  2019-12-14  0:09   ` [PATCH] " Daniel Vetter
  1 sibling, 1 reply; 20+ messages in thread
From: Daniel Vetter @ 2019-12-13 20:08 UTC (permalink / raw)
  To: DRI Development
  Cc: Daniel Vetter, Intel Graphics Development, etnaviv, Russell King,
	Daniel Vetter

On Mon, Nov 25, 2019 at 10:43:53AM +0100, Daniel Vetter wrote:
> I'll add more fancy logic to them soon, so everyone really has to use
> them. Plus they already provide some nice additional debug
> infrastructure on top of direct ww_mutex usage for the fences tracked
> by dma_resv.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
> Cc: etnaviv@lists.freedesktop.org

Ping for some review/acks.

Thanks, Daniel

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> index aa3e4c3b063a..947b21868e72 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> @@ -113,7 +113,7 @@ static void submit_unlock_object(struct etnaviv_gem_submit *submit, int i)
>  	if (submit->bos[i].flags & BO_LOCKED) {
>  		struct drm_gem_object *obj = &submit->bos[i].obj->base;
>  
> -		ww_mutex_unlock(&obj->resv->lock);
> +		dma_resv_unlock(obj->resv);
>  		submit->bos[i].flags &= ~BO_LOCKED;
>  	}
>  }
> @@ -133,8 +133,7 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
>  		contended = i;
>  
>  		if (!(submit->bos[i].flags & BO_LOCKED)) {
> -			ret = ww_mutex_lock_interruptible(&obj->resv->lock,
> -							  ticket);
> +			ret = dma_resv_lock(obj->resv, ticket);
>  			if (ret == -EALREADY)
>  				DRM_ERROR("BO at index %u already on submit list\n",
>  					  i);
> @@ -161,8 +160,7 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
>  		obj = &submit->bos[contended].obj->base;
>  
>  		/* we lost out in a seqno race, lock and retry.. */
> -		ret = ww_mutex_lock_slow_interruptible(&obj->resv->lock,
> -						       ticket);
> +		ret = dma_resv_lock_slow_interruptible(obj->resv, ticket);
>  		if (!ret) {
>  			submit->bos[contended].flags |= BO_LOCKED;
>  			slow_locked = contended;
> -- 
> 2.24.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/4] drm/msm: Use dma_resv locking wrappers
  2019-11-25  9:43   ` [PATCH 3/4] drm/msm: " Daniel Vetter
  2019-11-25  9:43     ` Daniel Vetter
@ 2019-12-13 20:08     ` Daniel Vetter
  2019-12-13 21:43       ` Eric Anholt
  1 sibling, 1 reply; 20+ messages in thread
From: Daniel Vetter @ 2019-12-13 20:08 UTC (permalink / raw)
  To: DRI Development
  Cc: freedreno, Daniel Vetter, Intel Graphics Development,
	linux-arm-msm, Daniel Vetter, Sean Paul

On Mon, Nov 25, 2019 at 10:43:55AM +0100, Daniel Vetter wrote:
> I'll add more fancy logic to them soon, so everyone really has to use
> them. Plus they already provide some nice additional debug
> infrastructure on top of direct ww_mutex usage for the fences tracked
> by dma_resv.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org

Ping for some review/acks.

Thanks, Daniel

> ---
>  drivers/gpu/drm/msm/msm_gem_submit.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> index 7d04c47d0023..385d4965a8d0 100644
> --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> @@ -157,7 +157,7 @@ static void submit_unlock_unpin_bo(struct msm_gem_submit *submit,
>  		msm_gem_unpin_iova(&msm_obj->base, submit->aspace);
>  
>  	if (submit->bos[i].flags & BO_LOCKED)
> -		ww_mutex_unlock(&msm_obj->base.resv->lock);
> +		dma_resv_unlock(msm_obj->base.resv);
>  
>  	if (backoff && !(submit->bos[i].flags & BO_VALID))
>  		submit->bos[i].iova = 0;
> @@ -180,8 +180,8 @@ static int submit_lock_objects(struct msm_gem_submit *submit)
>  		contended = i;
>  
>  		if (!(submit->bos[i].flags & BO_LOCKED)) {
> -			ret = ww_mutex_lock_interruptible(&msm_obj->base.resv->lock,
> -					&submit->ticket);
> +			ret = dma_resv_lock_interruptible(msm_obj->base.resv,
> +							  &submit->ticket);
>  			if (ret)
>  				goto fail;
>  			submit->bos[i].flags |= BO_LOCKED;
> @@ -202,8 +202,8 @@ static int submit_lock_objects(struct msm_gem_submit *submit)
>  	if (ret == -EDEADLK) {
>  		struct msm_gem_object *msm_obj = submit->bos[contended].obj;
>  		/* we lost out in a seqno race, lock and retry.. */
> -		ret = ww_mutex_lock_slow_interruptible(&msm_obj->base.resv->lock,
> -				&submit->ticket);
> +		ret = dma_resv_lock_slow_interruptible(msm_obj->base.resv,
> +						       &submit->ticket);
>  		if (!ret) {
>  			submit->bos[contended].flags |= BO_LOCKED;
>  			slow_locked = contended;
> -- 
> 2.24.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/4] drm/vc4: Use dma_resv locking wrappers
  2019-11-25  9:43 ` [PATCH 4/4] drm/vc4: " Daniel Vetter
  2019-11-25  9:43   ` Daniel Vetter
@ 2019-12-13 20:10   ` Daniel Vetter
  2019-12-13 21:40     ` Eric Anholt
  1 sibling, 1 reply; 20+ messages in thread
From: Daniel Vetter @ 2019-12-13 20:10 UTC (permalink / raw)
  To: DRI Development; +Cc: Daniel Vetter, Intel Graphics Development, Daniel Vetter

On Mon, Nov 25, 2019 at 10:43:56AM +0100, Daniel Vetter wrote:
> I'll add more fancy logic to them soon, so everyone really has to use
> them. Plus they already provide some nice additional debug
> infrastructure on top of direct ww_mutex usage for the fences tracked
> by dma_resv.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Ping for some review/acks.

Thanks, Daniel

> ---
>  drivers/gpu/drm/vc4/vc4_gem.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> index 7a06cb6e31c5..e1cfc3ccd05a 100644
> --- a/drivers/gpu/drm/vc4/vc4_gem.c
> +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> @@ -568,7 +568,7 @@ vc4_unlock_bo_reservations(struct drm_device *dev,
>  	for (i = 0; i < exec->bo_count; i++) {
>  		struct drm_gem_object *bo = &exec->bo[i]->base;
>  
> -		ww_mutex_unlock(&bo->resv->lock);
> +		dma_resv_unlock(bo->resv);
>  	}
>  
>  	ww_acquire_fini(acquire_ctx);
> @@ -595,8 +595,7 @@ vc4_lock_bo_reservations(struct drm_device *dev,
>  retry:
>  	if (contended_lock != -1) {
>  		bo = &exec->bo[contended_lock]->base;
> -		ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
> -						       acquire_ctx);
> +		ret = dma_resv_lock_slow_interruptible(bo->resv, acquire_ctx);
>  		if (ret) {
>  			ww_acquire_done(acquire_ctx);
>  			return ret;
> @@ -609,19 +608,19 @@ vc4_lock_bo_reservations(struct drm_device *dev,
>  
>  		bo = &exec->bo[i]->base;
>  
> -		ret = ww_mutex_lock_interruptible(&bo->resv->lock, acquire_ctx);
> +		ret = dma_resv_lock_interruptible(bo->resv, acquire_ctx);
>  		if (ret) {
>  			int j;
>  
>  			for (j = 0; j < i; j++) {
>  				bo = &exec->bo[j]->base;
> -				ww_mutex_unlock(&bo->resv->lock);
> +				dma_resv_unlock(bo->resv);
>  			}
>  
>  			if (contended_lock != -1 && contended_lock >= i) {
>  				bo = &exec->bo[contended_lock]->base;
>  
> -				ww_mutex_unlock(&bo->resv->lock);
> +				dma_resv_unlock(bo->resv);
>  			}
>  
>  			if (ret == -EDEADLK) {
> -- 
> 2.24.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATCH 1/4] drm/etnaviv: Use dma_resv locking wrappers
  2019-12-13 20:08   ` Daniel Vetter
@ 2019-12-13 20:52     ` Ruhl, Michael J
  0 siblings, 0 replies; 20+ messages in thread
From: Ruhl, Michael J @ 2019-12-13 20:52 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: Vetter, Daniel, Daniel Vetter, Intel Graphics Development,
	etnaviv, Russell King

>-----Original Message-----
>From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of
>Daniel Vetter
>Sent: Friday, December 13, 2019 3:08 PM
>To: DRI Development <dri-devel@lists.freedesktop.org>
>Cc: Daniel Vetter <daniel.vetter@ffwll.ch>; Intel Graphics Development
><intel-gfx@lists.freedesktop.org>; etnaviv@lists.freedesktop.org; Russell
>King <linux+etnaviv@armlinux.org.uk>; Vetter, Daniel
><daniel.vetter@intel.com>
>Subject: Re: [PATCH 1/4] drm/etnaviv: Use dma_resv locking wrappers
>
>On Mon, Nov 25, 2019 at 10:43:53AM +0100, Daniel Vetter wrote:
>> I'll add more fancy logic to them soon, so everyone really has to use
>> them. Plus they already provide some nice additional debug
>> infrastructure on top of direct ww_mutex usage for the fences tracked
>> by dma_resv.
>>
>> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>> Cc: Lucas Stach <l.stach@pengutronix.de>
>> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
>> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
>> Cc: etnaviv@lists.freedesktop.org
>
>Ping for some review/acks.
>
>Thanks, Daniel
>
>> ---
>>  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 8 +++-----
>>  1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
>b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
>> index aa3e4c3b063a..947b21868e72 100644
>> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
>> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
>> @@ -113,7 +113,7 @@ static void submit_unlock_object(struct
>etnaviv_gem_submit *submit, int i)
>>  	if (submit->bos[i].flags & BO_LOCKED) {
>>  		struct drm_gem_object *obj = &submit->bos[i].obj->base;
>>
>> -		ww_mutex_unlock(&obj->resv->lock);
>> +		dma_resv_unlock(obj->resv);
>>  		submit->bos[i].flags &= ~BO_LOCKED;
>>  	}
>>  }
>> @@ -133,8 +133,7 @@ static int submit_lock_objects(struct
>etnaviv_gem_submit *submit,
>>  		contended = i;
>>
>>  		if (!(submit->bos[i].flags & BO_LOCKED)) {
>> -			ret = ww_mutex_lock_interruptible(&obj->resv-
>>lock,
>> -							  ticket);
>> +			ret = dma_resv_lock(obj->resv, ticket);

Should this be dma_resv_lock_interruptible()?

Mike

>>  			if (ret == -EALREADY)
>>  				DRM_ERROR("BO at index %u already on
>submit list\n",
>>  					  i);
>> @@ -161,8 +160,7 @@ static int submit_lock_objects(struct
>etnaviv_gem_submit *submit,
>>  		obj = &submit->bos[contended].obj->base;
>>
>>  		/* we lost out in a seqno race, lock and retry.. */
>> -		ret = ww_mutex_lock_slow_interruptible(&obj->resv->lock,
>> -						       ticket);
>> +		ret = dma_resv_lock_slow_interruptible(obj->resv, ticket);
>>  		if (!ret) {
>>  			submit->bos[contended].flags |= BO_LOCKED;
>>  			slow_locked = contended;
>> --
>> 2.24.0
>>
>
>--
>Daniel Vetter
>Software Engineer, Intel Corporation
>http://blog.ffwll.ch
>_______________________________________________
>dri-devel mailing list
>dri-devel@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/4] drm/vc4: Use dma_resv locking wrappers
  2019-12-13 20:10   ` Daniel Vetter
@ 2019-12-13 21:40     ` Eric Anholt
  0 siblings, 0 replies; 20+ messages in thread
From: Eric Anholt @ 2019-12-13 21:40 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
	Daniel Vetter

On Fri, Dec 13, 2019 at 12:10 PM Daniel Vetter <daniel@ffwll.ch> wrote:
>
> On Mon, Nov 25, 2019 at 10:43:56AM +0100, Daniel Vetter wrote:
> > I'll add more fancy logic to them soon, so everyone really has to use
> > them. Plus they already provide some nice additional debug
> > infrastructure on top of direct ww_mutex usage for the fences tracked
> > by dma_resv.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>
> Ping for some review/acks.
>
> Thanks, Daniel
>
> > ---
> >  drivers/gpu/drm/vc4/vc4_gem.c | 11 +++++------
> >  1 file changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> > index 7a06cb6e31c5..e1cfc3ccd05a 100644
> > --- a/drivers/gpu/drm/vc4/vc4_gem.c
> > +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> > @@ -568,7 +568,7 @@ vc4_unlock_bo_reservations(struct drm_device *dev,
> >       for (i = 0; i < exec->bo_count; i++) {
> >               struct drm_gem_object *bo = &exec->bo[i]->base;
> >
> > -             ww_mutex_unlock(&bo->resv->lock);
> > +             dma_resv_unlock(bo->resv);
> >       }
> >
> >       ww_acquire_fini(acquire_ctx);
> > @@ -595,8 +595,7 @@ vc4_lock_bo_reservations(struct drm_device *dev,
> >  retry:
> >       if (contended_lock != -1) {
> >               bo = &exec->bo[contended_lock]->base;
> > -             ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
> > -                                                    acquire_ctx);
> > +             ret = dma_resv_lock_slow_interruptible(bo->resv, acquire_ctx);
> >               if (ret) {
> >                       ww_acquire_done(acquire_ctx);
> >                       return ret;
> > @@ -609,19 +608,19 @@ vc4_lock_bo_reservations(struct drm_device *dev,
> >
> >               bo = &exec->bo[i]->base;
> >
> > -             ret = ww_mutex_lock_interruptible(&bo->resv->lock, acquire_ctx);
> > +             ret = dma_resv_lock_interruptible(bo->resv, acquire_ctx);
> >               if (ret) {
> >                       int j;
> >
> >                       for (j = 0; j < i; j++) {
> >                               bo = &exec->bo[j]->base;
> > -                             ww_mutex_unlock(&bo->resv->lock);
> > +                             dma_resv_unlock(bo->resv);
> >                       }
> >
> >                       if (contended_lock != -1 && contended_lock >= i) {
> >                               bo = &exec->bo[contended_lock]->base;
> >
> > -                             ww_mutex_unlock(&bo->resv->lock);
> > +                             dma_resv_unlock(bo->resv);
> >                       }
> >
> >                       if (ret == -EDEADLK) {
> > --
> > 2.24.0
> >

Assuming they're supposed to be exactly equivalent currently,

Acked-by: Eric Anholt <eric@anholt.net>

but we should really just be using drm_gem_lock_reservations()
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/4] drm/msm: Use dma_resv locking wrappers
  2019-12-13 20:08     ` Daniel Vetter
@ 2019-12-13 21:43       ` Eric Anholt
  0 siblings, 0 replies; 20+ messages in thread
From: Eric Anholt @ 2019-12-13 21:43 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Sean Paul, Daniel Vetter, Intel Graphics Development,
	DRI Development, linux-arm-msm, Daniel Vetter, freedreno

On Fri, Dec 13, 2019 at 12:08 PM Daniel Vetter <daniel@ffwll.ch> wrote:
>
> On Mon, Nov 25, 2019 at 10:43:55AM +0100, Daniel Vetter wrote:
> > I'll add more fancy logic to them soon, so everyone really has to use
> > them. Plus they already provide some nice additional debug
> > infrastructure on top of direct ww_mutex usage for the fences tracked
> > by dma_resv.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Rob Clark <robdclark@gmail.com>
> > Cc: Sean Paul <sean@poorly.run>
> > Cc: linux-arm-msm@vger.kernel.org
> > Cc: freedreno@lists.freedesktop.org
>
> Ping for some review/acks.
>
> Thanks, Daniel
>
> > ---
> >  drivers/gpu/drm/msm/msm_gem_submit.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> > index 7d04c47d0023..385d4965a8d0 100644
> > --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> > +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> > @@ -157,7 +157,7 @@ static void submit_unlock_unpin_bo(struct msm_gem_submit *submit,
> >               msm_gem_unpin_iova(&msm_obj->base, submit->aspace);
> >
> >       if (submit->bos[i].flags & BO_LOCKED)
> > -             ww_mutex_unlock(&msm_obj->base.resv->lock);
> > +             dma_resv_unlock(msm_obj->base.resv);
> >
> >       if (backoff && !(submit->bos[i].flags & BO_VALID))
> >               submit->bos[i].iova = 0;
> > @@ -180,8 +180,8 @@ static int submit_lock_objects(struct msm_gem_submit *submit)
> >               contended = i;
> >
> >               if (!(submit->bos[i].flags & BO_LOCKED)) {
> > -                     ret = ww_mutex_lock_interruptible(&msm_obj->base.resv->lock,
> > -                                     &submit->ticket);
> > +                     ret = dma_resv_lock_interruptible(msm_obj->base.resv,
> > +                                                       &submit->ticket);
> >                       if (ret)
> >                               goto fail;
> >                       submit->bos[i].flags |= BO_LOCKED;
> > @@ -202,8 +202,8 @@ static int submit_lock_objects(struct msm_gem_submit *submit)
> >       if (ret == -EDEADLK) {
> >               struct msm_gem_object *msm_obj = submit->bos[contended].obj;
> >               /* we lost out in a seqno race, lock and retry.. */
> > -             ret = ww_mutex_lock_slow_interruptible(&msm_obj->base.resv->lock,
> > -                             &submit->ticket);
> > +             ret = dma_resv_lock_slow_interruptible(msm_obj->base.resv,
> > +                                                    &submit->ticket);
> >               if (!ret) {
> >                       submit->bos[contended].flags |= BO_LOCKED;
> >                       slow_locked = contended;
> > --
> > 2.24.0
> >

Reviewed-by: Eric Anholt <eric@anholt.net>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH] drm/etnaviv: Use dma_resv locking wrappers
  2019-11-25  9:43 ` [PATCH 1/4] drm/etnaviv: Use " Daniel Vetter
  2019-12-13 20:08   ` Daniel Vetter
@ 2019-12-14  0:09   ` Daniel Vetter
  2019-12-16 14:29     ` Ruhl, Michael J
  2019-12-16 15:14     ` Lucas Stach
  1 sibling, 2 replies; 20+ messages in thread
From: Daniel Vetter @ 2019-12-14  0:09 UTC (permalink / raw)
  To: DRI Development
  Cc: Daniel Vetter, etnaviv, Ruhl, Michael J, Russell King, Daniel Vetter

I'll add more fancy logic to them soon, so everyone really has to use
them. Plus they already provide some nice additional debug
infrastructure on top of direct ww_mutex usage for the fences tracked
by dma_resv.

v2: Fix the lost _interruptible (Michael)

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: etnaviv@lists.freedesktop.org
Cc: "Ruhl, Michael J" <michael.j.ruhl@intel.com>
---
 drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
index aa3e4c3b063a..3b0afa156d92 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
@@ -113,7 +113,7 @@ static void submit_unlock_object(struct etnaviv_gem_submit *submit, int i)
 	if (submit->bos[i].flags & BO_LOCKED) {
 		struct drm_gem_object *obj = &submit->bos[i].obj->base;
 
-		ww_mutex_unlock(&obj->resv->lock);
+		dma_resv_unlock(obj->resv);
 		submit->bos[i].flags &= ~BO_LOCKED;
 	}
 }
@@ -133,8 +133,7 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
 		contended = i;
 
 		if (!(submit->bos[i].flags & BO_LOCKED)) {
-			ret = ww_mutex_lock_interruptible(&obj->resv->lock,
-							  ticket);
+			ret = dma_resv_lock_interruptible(obj->resv, ticket);
 			if (ret == -EALREADY)
 				DRM_ERROR("BO at index %u already on submit list\n",
 					  i);
@@ -161,8 +160,7 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
 		obj = &submit->bos[contended].obj->base;
 
 		/* we lost out in a seqno race, lock and retry.. */
-		ret = ww_mutex_lock_slow_interruptible(&obj->resv->lock,
-						       ticket);
+		ret = dma_resv_lock_slow_interruptible(obj->resv, ticket);
 		if (!ret) {
 			submit->bos[contended].flags |= BO_LOCKED;
 			slow_locked = contended;
-- 
2.24.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/4] drm/i915: Use dma_resv locking wrappers
  2019-11-25  9:43 ` [PATCH 2/4] drm/i915: " Daniel Vetter
@ 2019-12-14  0:10   ` Daniel Vetter
  0 siblings, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2019-12-14  0:10 UTC (permalink / raw)
  To: DRI Development
  Cc: Tvrtko Ursulin, Jani Nikula, Daniel Vetter,
	Intel Graphics Development, Matthew Auld, Daniel Vetter

On Mon, Nov 25, 2019 at 10:43:54AM +0100, Daniel Vetter wrote:
> I'll add more fancy logic to them soon, so everyone really has to use
> them. Plus they already provide some nice additional debug
> infrastructure on top of direct ww_mutex usage for the fences tracked
> by dma_resv.
> 
> Aside: We might want to create wrappers for i915_vma locking of the
> ->resv like we have for the i915_gem_bo itself already.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>
> ---

Maarten/Chris, should I drop this one or keep? I guess this will all
change anyway rsn ...
-Daniel

>  drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index 7a87e8270460..7b8f4ebd9986 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -1848,7 +1848,7 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
>  	for (i = 0; i < count; i++) {
>  		struct i915_vma *vma = eb->vma[i];
>  
> -		err = ww_mutex_lock_interruptible(&vma->resv->lock, &acquire);
> +		err = dma_resv_lock_interruptible(vma->resv, &acquire);
>  		if (!err)
>  			continue;
>  
> @@ -1859,7 +1859,7 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
>  			do {
>  				int j = i - 1;
>  
> -				ww_mutex_unlock(&eb->vma[j]->resv->lock);
> +				dma_resv_unlock(eb->vma[j]->resv);
>  
>  				swap(eb->flags[i], eb->flags[j]);
>  				swap(eb->vma[i],  eb->vma[j]);
> @@ -1868,7 +1868,7 @@ static int eb_move_to_gpu(struct i915_execbuffer *eb)
>  			GEM_BUG_ON(vma != eb->vma[0]);
>  			vma->exec_flags = &eb->flags[0];
>  
> -			err = ww_mutex_lock_slow_interruptible(&vma->resv->lock,
> +			err = dma_resv_lock_slow_interruptible(vma->resv,
>  							       &acquire);
>  		}
>  		if (err)
> -- 
> 2.24.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* RE: [PATCH] drm/etnaviv: Use dma_resv locking wrappers
  2019-12-14  0:09   ` [PATCH] " Daniel Vetter
@ 2019-12-16 14:29     ` Ruhl, Michael J
  2019-12-16 15:14     ` Lucas Stach
  1 sibling, 0 replies; 20+ messages in thread
From: Ruhl, Michael J @ 2019-12-16 14:29 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development; +Cc: Vetter, Daniel, etnaviv, Russell King

>-----Original Message-----
>From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of
>Daniel Vetter
>Sent: Friday, December 13, 2019 7:09 PM
>To: DRI Development <dri-devel@lists.freedesktop.org>
>Cc: Daniel Vetter <daniel.vetter@ffwll.ch>; etnaviv@lists.freedesktop.org;
>Ruhl, Michael J <michael.j.ruhl@intel.com>; Russell King
><linux+etnaviv@armlinux.org.uk>; Vetter, Daniel <daniel.vetter@intel.com>
>Subject: [PATCH] drm/etnaviv: Use dma_resv locking wrappers
>
>I'll add more fancy logic to them soon, so everyone really has to use
>them. Plus they already provide some nice additional debug
>infrastructure on top of direct ww_mutex usage for the fences tracked
>by dma_resv.
>
>v2: Fix the lost _interruptible (Michael)
>
>Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
>Cc: Lucas Stach <l.stach@pengutronix.de>
>Cc: Russell King <linux+etnaviv@armlinux.org.uk>
>Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
>Cc: etnaviv@lists.freedesktop.org
>Cc: "Ruhl, Michael J" <michael.j.ruhl@intel.com>
>---
> drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
>b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
>index aa3e4c3b063a..3b0afa156d92 100644
>--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
>+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
>@@ -113,7 +113,7 @@ static void submit_unlock_object(struct
>etnaviv_gem_submit *submit, int i)
> 	if (submit->bos[i].flags & BO_LOCKED) {
> 		struct drm_gem_object *obj = &submit->bos[i].obj->base;
>
>-		ww_mutex_unlock(&obj->resv->lock);
>+		dma_resv_unlock(obj->resv);
> 		submit->bos[i].flags &= ~BO_LOCKED;
> 	}
> }
>@@ -133,8 +133,7 @@ static int submit_lock_objects(struct
>etnaviv_gem_submit *submit,
> 		contended = i;
>
> 		if (!(submit->bos[i].flags & BO_LOCKED)) {
>-			ret = ww_mutex_lock_interruptible(&obj->resv-
>>lock,
>-							  ticket);
>+			ret = dma_resv_lock_interruptible(obj->resv, ticket);

Thanks,

If you need it:

Acked-by: Michael J. Ruhl <michael.j.ruhl@intel.com>

m

> 			if (ret == -EALREADY)
> 				DRM_ERROR("BO at index %u already on
>submit list\n",
> 					  i);
>@@ -161,8 +160,7 @@ static int submit_lock_objects(struct
>etnaviv_gem_submit *submit,
> 		obj = &submit->bos[contended].obj->base;
>
> 		/* we lost out in a seqno race, lock and retry.. */
>-		ret = ww_mutex_lock_slow_interruptible(&obj->resv->lock,
>-						       ticket);
>+		ret = dma_resv_lock_slow_interruptible(obj->resv, ticket);
> 		if (!ret) {
> 			submit->bos[contended].flags |= BO_LOCKED;
> 			slow_locked = contended;
>--
>2.24.0
>
>_______________________________________________
>dri-devel mailing list
>dri-devel@lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] drm/etnaviv: Use dma_resv locking wrappers
  2019-12-14  0:09   ` [PATCH] " Daniel Vetter
  2019-12-16 14:29     ` Ruhl, Michael J
@ 2019-12-16 15:14     ` Lucas Stach
  2019-12-17 13:03       ` Daniel Vetter
  1 sibling, 1 reply; 20+ messages in thread
From: Lucas Stach @ 2019-12-16 15:14 UTC (permalink / raw)
  To: Daniel Vetter, DRI Development
  Cc: Daniel Vetter, Ruhl, Michael J, etnaviv, Russell King

On Sa, 2019-12-14 at 01:09 +0100, Daniel Vetter wrote:
> I'll add more fancy logic to them soon, so everyone really has to use
> them. Plus they already provide some nice additional debug
> infrastructure on top of direct ww_mutex usage for the fences tracked
> by dma_resv.
> 
> v2: Fix the lost _interruptible (Michael)
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
> Cc: etnaviv@lists.freedesktop.org
> Cc: "Ruhl, Michael J" <michael.j.ruhl@intel.com>

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

If you want to stack other stuff on top of this before the next merge
window feel free to take it through drm-misc. Otherwise I'm going to
pick it up with the next sweep.

Regards,
Lucas

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> index aa3e4c3b063a..3b0afa156d92 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> @@ -113,7 +113,7 @@ static void submit_unlock_object(struct etnaviv_gem_submit *submit, int i)
>  	if (submit->bos[i].flags & BO_LOCKED) {
>  		struct drm_gem_object *obj = &submit->bos[i].obj->base;
>  
> -		ww_mutex_unlock(&obj->resv->lock);
> +		dma_resv_unlock(obj->resv);
>  		submit->bos[i].flags &= ~BO_LOCKED;
>  	}
>  }
> @@ -133,8 +133,7 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
>  		contended = i;
>  
>  		if (!(submit->bos[i].flags & BO_LOCKED)) {
> -			ret = ww_mutex_lock_interruptible(&obj->resv->lock,
> -							  ticket);
> +			ret = dma_resv_lock_interruptible(obj->resv, ticket);
>  			if (ret == -EALREADY)
>  				DRM_ERROR("BO at index %u already on submit list\n",
>  					  i);
> @@ -161,8 +160,7 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
>  		obj = &submit->bos[contended].obj->base;
>  
>  		/* we lost out in a seqno race, lock and retry.. */
> -		ret = ww_mutex_lock_slow_interruptible(&obj->resv->lock,
> -						       ticket);
> +		ret = dma_resv_lock_slow_interruptible(obj->resv, ticket);
>  		if (!ret) {
>  			submit->bos[contended].flags |= BO_LOCKED;
>  			slow_locked = contended;

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH] drm/etnaviv: Use dma_resv locking wrappers
  2019-12-16 15:14     ` Lucas Stach
@ 2019-12-17 13:03       ` Daniel Vetter
  0 siblings, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2019-12-17 13:03 UTC (permalink / raw)
  To: Lucas Stach
  Cc: Daniel Vetter, etnaviv, DRI Development, Ruhl, Michael J,
	Russell King, Daniel Vetter

On Mon, Dec 16, 2019 at 04:14:34PM +0100, Lucas Stach wrote:
> On Sa, 2019-12-14 at 01:09 +0100, Daniel Vetter wrote:
> > I'll add more fancy logic to them soon, so everyone really has to use
> > them. Plus they already provide some nice additional debug
> > infrastructure on top of direct ww_mutex usage for the fences tracked
> > by dma_resv.
> > 
> > v2: Fix the lost _interruptible (Michael)
> > 
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Lucas Stach <l.stach@pengutronix.de>
> > Cc: Russell King <linux+etnaviv@armlinux.org.uk>
> > Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
> > Cc: etnaviv@lists.freedesktop.org
> > Cc: "Ruhl, Michael J" <michael.j.ruhl@intel.com>
> 
> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> 
> If you want to stack other stuff on top of this before the next merge
> window feel free to take it through drm-misc. Otherwise I'm going to
> pick it up with the next sweep.

I expect a fair amount of stacking in the dma-buf area in the near future
, so applied all (except the i915 one, that's already superseeded with
i915 specific work) to drm-misc-next.

Thanks for review.
-Daniel

> 
> Regards,
> Lucas
> 
> > ---
> >  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> > index aa3e4c3b063a..3b0afa156d92 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> > @@ -113,7 +113,7 @@ static void submit_unlock_object(struct etnaviv_gem_submit *submit, int i)
> >  	if (submit->bos[i].flags & BO_LOCKED) {
> >  		struct drm_gem_object *obj = &submit->bos[i].obj->base;
> >  
> > -		ww_mutex_unlock(&obj->resv->lock);
> > +		dma_resv_unlock(obj->resv);
> >  		submit->bos[i].flags &= ~BO_LOCKED;
> >  	}
> >  }
> > @@ -133,8 +133,7 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
> >  		contended = i;
> >  
> >  		if (!(submit->bos[i].flags & BO_LOCKED)) {
> > -			ret = ww_mutex_lock_interruptible(&obj->resv->lock,
> > -							  ticket);
> > +			ret = dma_resv_lock_interruptible(obj->resv, ticket);
> >  			if (ret == -EALREADY)
> >  				DRM_ERROR("BO at index %u already on submit list\n",
> >  					  i);
> > @@ -161,8 +160,7 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
> >  		obj = &submit->bos[contended].obj->base;
> >  
> >  		/* we lost out in a seqno race, lock and retry.. */
> > -		ret = ww_mutex_lock_slow_interruptible(&obj->resv->lock,
> > -						       ticket);
> > +		ret = dma_resv_lock_slow_interruptible(obj->resv, ticket);
> >  		if (!ret) {
> >  			submit->bos[contended].flags |= BO_LOCKED;
> >  			slow_locked = contended;
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-12-17 13:03 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25  9:43 [PATCH 0/4] consistently use dma_resv locking wrappers Daniel Vetter
2019-11-25  9:43 ` Daniel Vetter
2019-11-25  9:43 ` [PATCH 1/4] drm/etnaviv: Use " Daniel Vetter
2019-12-13 20:08   ` Daniel Vetter
2019-12-13 20:52     ` Ruhl, Michael J
2019-12-14  0:09   ` [PATCH] " Daniel Vetter
2019-12-16 14:29     ` Ruhl, Michael J
2019-12-16 15:14     ` Lucas Stach
2019-12-17 13:03       ` Daniel Vetter
2019-11-25  9:43 ` [PATCH 2/4] drm/i915: " Daniel Vetter
2019-12-14  0:10   ` Daniel Vetter
     [not found] ` <20191125094356.161941-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2019-11-25  9:43   ` [PATCH 3/4] drm/msm: " Daniel Vetter
2019-11-25  9:43     ` Daniel Vetter
2019-12-13 20:08     ` Daniel Vetter
2019-12-13 21:43       ` Eric Anholt
2019-11-25  9:43 ` [PATCH 4/4] drm/vc4: " Daniel Vetter
2019-11-25  9:43   ` Daniel Vetter
2019-12-13 20:10   ` Daniel Vetter
2019-12-13 21:40     ` Eric Anholt
2019-12-03 16:43 ` [PATCH 0/4] consistently use " Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).