All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/atomic-helper: Simplify commit tracking locking
@ 2017-06-21  9:16 Daniel Vetter
  2017-06-21 11:30 ` ✓ Fi.CI.BAT: success for " Patchwork
  2017-06-21 14:30 ` [PATCH] " Sean Paul
  0 siblings, 2 replies; 4+ messages in thread
From: Daniel Vetter @ 2017-06-21  9:16 UTC (permalink / raw)
  To: DRI Development; +Cc: Daniel Vetter, Daniel Vetter, Intel Graphics Development

The crtc->commit_lock only protects commit_list and commit_entry. If
we chase the pointer from the drm_atomic_state update structure, then
we don't need any locks (since we hold a reference already).

Simplify the locking accordingly.

Noticed while reviewing a patch from Boris.

Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_atomic_helper.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 86d3093c6c9b..9bf86eb87fe1 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1680,9 +1680,7 @@ void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
 
 		/* backend must have consumed any event by now */
 		WARN_ON(new_crtc_state->event);
-		spin_lock(&crtc->commit_lock);
 		complete_all(&commit->hw_done);
-		spin_unlock(&crtc->commit_lock);
 	}
 }
 EXPORT_SYMBOL(drm_atomic_helper_commit_hw_done);
@@ -1711,7 +1709,6 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)
 		if (WARN_ON(!commit))
 			continue;
 
-		spin_lock(&crtc->commit_lock);
 		complete_all(&commit->cleanup_done);
 		WARN_ON(!try_wait_for_completion(&commit->hw_done));
 
@@ -1721,8 +1718,6 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)
 		if (try_wait_for_completion(&commit->flip_done))
 			goto del_commit;
 
-		spin_unlock(&crtc->commit_lock);
-
 		/* We must wait for the vblank event to signal our completion
 		 * before releasing our reference, since the vblank work does
 		 * not hold a reference of its own. */
@@ -1732,8 +1727,8 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)
 			DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n",
 				  crtc->base.id, crtc->name);
 
-		spin_lock(&crtc->commit_lock);
 del_commit:
+		spin_lock(&crtc->commit_lock);
 		list_del(&commit->commit_entry);
 		spin_unlock(&crtc->commit_lock);
 	}
-- 
2.11.0

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

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

* ✓ Fi.CI.BAT: success for drm/atomic-helper: Simplify commit tracking locking
  2017-06-21  9:16 [PATCH] drm/atomic-helper: Simplify commit tracking locking Daniel Vetter
@ 2017-06-21 11:30 ` Patchwork
  2017-06-21 14:30 ` [PATCH] " Sean Paul
  1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2017-06-21 11:30 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx

== Series Details ==

Series: drm/atomic-helper: Simplify commit tracking locking
URL   : https://patchwork.freedesktop.org/series/26127/
State : success

== Summary ==

Series 26127v1 drm/atomic-helper: Simplify commit tracking locking
https://patchwork.freedesktop.org/api/1.0/series/26127/revisions/1/mbox/

Test gem_ringfill:
        Subgroup basic-default-hang:
                incomplete -> TIMEOUT    (fi-blb-e6850) fdo#99093 +1
Test prime_busy:
        Subgroup basic-wait-after-default:
                dmesg-warn -> PASS       (fi-skl-6700hq) fdo#101515 +3

fdo#99093 https://bugs.freedesktop.org/show_bug.cgi?id=99093
fdo#101515 https://bugs.freedesktop.org/show_bug.cgi?id=101515

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:444s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:426s
fi-blb-e6850     total:208  pass:169  dwarn:0   dfail:0   fail:0   skip:37 
fi-bsw-n3050     total:278  pass:241  dwarn:1   dfail:0   fail:0   skip:36  time:520s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:502s
fi-byt-j1900     total:278  pass:252  dwarn:2   dfail:0   fail:0   skip:24  time:482s
fi-byt-n2820     total:278  pass:248  dwarn:2   dfail:0   fail:0   skip:28  time:487s
fi-glk-2a        total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:587s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:431s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:414s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:421s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:496s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:471s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:468s
fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time:573s
fi-kbl-r         total:278  pass:259  dwarn:1   dfail:0   fail:0   skip:18  time:578s
fi-pnv-d510      total:146  pass:112  dwarn:0   dfail:0   fail:0   skip:33 
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:459s
fi-skl-6700hq    total:278  pass:220  dwarn:3   dfail:0   fail:30  skip:24  time:341s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:464s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:477s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:437s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:537s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:404s

186f6503dc0750d739db5d9301dc9a507eacc6ef drm-tip: 2017y-06m-21d-10h-08m-42s UTC integration manifest
795e2aa drm/atomic-helper: Simplify commit tracking locking

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_5008/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/atomic-helper: Simplify commit tracking locking
  2017-06-21  9:16 [PATCH] drm/atomic-helper: Simplify commit tracking locking Daniel Vetter
  2017-06-21 11:30 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-06-21 14:30 ` Sean Paul
  2017-06-27 12:03   ` Daniel Vetter
  1 sibling, 1 reply; 4+ messages in thread
From: Sean Paul @ 2017-06-21 14:30 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Daniel Vetter, Intel Graphics Development, DRI Development,
	Boris Brezillon

On Wed, Jun 21, 2017 at 11:16:27AM +0200, Daniel Vetter wrote:
> The crtc->commit_lock only protects commit_list and commit_entry. If
> we chase the pointer from the drm_atomic_state update structure, then
> we don't need any locks (since we hold a reference already).
> 
> Simplify the locking accordingly.
> 
> Noticed while reviewing a patch from Boris.
> 
> Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

After reading this over a few times, I've convinced myself that it does
the right thing.

Reviewed-by: Sean Paul <seanpaul@chromium.org>


> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 86d3093c6c9b..9bf86eb87fe1 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1680,9 +1680,7 @@ void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
>  
>  		/* backend must have consumed any event by now */
>  		WARN_ON(new_crtc_state->event);
> -		spin_lock(&crtc->commit_lock);
>  		complete_all(&commit->hw_done);
> -		spin_unlock(&crtc->commit_lock);
>  	}
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_commit_hw_done);
> @@ -1711,7 +1709,6 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)
>  		if (WARN_ON(!commit))
>  			continue;
>  
> -		spin_lock(&crtc->commit_lock);
>  		complete_all(&commit->cleanup_done);
>  		WARN_ON(!try_wait_for_completion(&commit->hw_done));
>  
> @@ -1721,8 +1718,6 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)
>  		if (try_wait_for_completion(&commit->flip_done))
>  			goto del_commit;
>  
> -		spin_unlock(&crtc->commit_lock);
> -
>  		/* We must wait for the vblank event to signal our completion
>  		 * before releasing our reference, since the vblank work does
>  		 * not hold a reference of its own. */
> @@ -1732,8 +1727,8 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)
>  			DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n",
>  				  crtc->base.id, crtc->name);
>  
> -		spin_lock(&crtc->commit_lock);
>  del_commit:
> +		spin_lock(&crtc->commit_lock);
>  		list_del(&commit->commit_entry);
>  		spin_unlock(&crtc->commit_lock);
>  	}
> -- 
> 2.11.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/atomic-helper: Simplify commit tracking locking
  2017-06-21 14:30 ` [PATCH] " Sean Paul
@ 2017-06-27 12:03   ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2017-06-27 12:03 UTC (permalink / raw)
  To: Sean Paul
  Cc: Daniel Vetter, Intel Graphics Development, Boris Brezillon,
	DRI Development, Daniel Vetter

On Wed, Jun 21, 2017 at 10:30:51AM -0400, Sean Paul wrote:
> On Wed, Jun 21, 2017 at 11:16:27AM +0200, Daniel Vetter wrote:
> > The crtc->commit_lock only protects commit_list and commit_entry. If
> > we chase the pointer from the drm_atomic_state update structure, then
> > we don't need any locks (since we hold a reference already).
> > 
> > Simplify the locking accordingly.
> > 
> > Noticed while reviewing a patch from Boris.
> > 
> > Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> 
> After reading this over a few times, I've convinced myself that it does
> the right thing.
> 
> Reviewed-by: Sean Paul <seanpaul@chromium.org>

Pushed to -misc, thanks for your review.
-Daniel

> 
> 
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 7 +------
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index 86d3093c6c9b..9bf86eb87fe1 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -1680,9 +1680,7 @@ void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)
> >  
> >  		/* backend must have consumed any event by now */
> >  		WARN_ON(new_crtc_state->event);
> > -		spin_lock(&crtc->commit_lock);
> >  		complete_all(&commit->hw_done);
> > -		spin_unlock(&crtc->commit_lock);
> >  	}
> >  }
> >  EXPORT_SYMBOL(drm_atomic_helper_commit_hw_done);
> > @@ -1711,7 +1709,6 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)
> >  		if (WARN_ON(!commit))
> >  			continue;
> >  
> > -		spin_lock(&crtc->commit_lock);
> >  		complete_all(&commit->cleanup_done);
> >  		WARN_ON(!try_wait_for_completion(&commit->hw_done));
> >  
> > @@ -1721,8 +1718,6 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)
> >  		if (try_wait_for_completion(&commit->flip_done))
> >  			goto del_commit;
> >  
> > -		spin_unlock(&crtc->commit_lock);
> > -
> >  		/* We must wait for the vblank event to signal our completion
> >  		 * before releasing our reference, since the vblank work does
> >  		 * not hold a reference of its own. */
> > @@ -1732,8 +1727,8 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)
> >  			DRM_ERROR("[CRTC:%d:%s] flip_done timed out\n",
> >  				  crtc->base.id, crtc->name);
> >  
> > -		spin_lock(&crtc->commit_lock);
> >  del_commit:
> > +		spin_lock(&crtc->commit_lock);
> >  		list_del(&commit->commit_entry);
> >  		spin_unlock(&crtc->commit_lock);
> >  	}
> > -- 
> > 2.11.0
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS

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

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

end of thread, other threads:[~2017-06-27 12:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21  9:16 [PATCH] drm/atomic-helper: Simplify commit tracking locking Daniel Vetter
2017-06-21 11:30 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-06-21 14:30 ` [PATCH] " Sean Paul
2017-06-27 12:03   ` Daniel Vetter

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.