diff mbox series

[2/3] drm: Move atomic_state_put after locks are dropped

Message ID 20181127224654.48331-2-sean@poorly.run (mailing list archive)
State New, archived
Headers show
Series [1/3] drm: Move drm_mode_setcrtc() local re-init to failure path | expand

Commit Message

Sean Paul Nov. 27, 2018, 10:46 p.m. UTC
From: Sean Paul <seanpaul@chromium.org>

drm_atomic_state_put doesn't require any locking, and this makes things
easier for switching to modeset_lock_all helpers in a future patch

Cc: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/drm_atomic_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Daniel Vetter Nov. 28, 2018, 8:35 a.m. UTC | #1
On Tue, Nov 27, 2018 at 05:46:39PM -0500, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> drm_atomic_state_put doesn't require any locking, and this makes things
> easier for switching to modeset_lock_all helpers in a future patch
> 
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index fe8dd8aa4ae40..15a75b9f185fa 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -3286,9 +3286,10 @@ int drm_atomic_helper_resume(struct drm_device *dev,
>  		drm_modeset_backoff(&ctx);
>  	}
>  
> -	drm_atomic_state_put(state);
> +	state->acquire_ctx = NULL;

If you want to clear this I think this should be done in
drm_atomic_helper_commit_duplicated_state(), for symmetry reasons. And in
a separate patch. Just moving the _put looks fine and has my r-b.
-Daniel

>  	drm_modeset_drop_locks(&ctx);
>  	drm_modeset_acquire_fini(&ctx);
> +	drm_atomic_state_put(state);
>  
>  	return err;
>  }
> -- 
> Sean Paul, Software Engineer, Google / Chromium OS
>
Sean Paul Nov. 28, 2018, 2:27 p.m. UTC | #2
On Wed, Nov 28, 2018 at 09:35:47AM +0100, Daniel Vetter wrote:
> On Tue, Nov 27, 2018 at 05:46:39PM -0500, Sean Paul wrote:
> > From: Sean Paul <seanpaul@chromium.org>
> > 
> > drm_atomic_state_put doesn't require any locking, and this makes things
> > easier for switching to modeset_lock_all helpers in a future patch
> > 
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Signed-off-by: Sean Paul <seanpaul@chromium.org>
> > ---
> >  drivers/gpu/drm/drm_atomic_helper.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> > index fe8dd8aa4ae40..15a75b9f185fa 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -3286,9 +3286,10 @@ int drm_atomic_helper_resume(struct drm_device *dev,
> >  		drm_modeset_backoff(&ctx);
> >  	}
> >  
> > -	drm_atomic_state_put(state);
> > +	state->acquire_ctx = NULL;
> 
> If you want to clear this I think this should be done in
> drm_atomic_helper_commit_duplicated_state(), for symmetry reasons. And in
> a separate patch. Just moving the _put looks fine and has my r-b.

Ohh, that's a much better idea!

> -Daniel
> 
> >  	drm_modeset_drop_locks(&ctx);
> >  	drm_modeset_acquire_fini(&ctx);
> > +	drm_atomic_state_put(state);
> >  
> >  	return err;
> >  }
> > -- 
> > Sean Paul, Software Engineer, Google / Chromium OS
> > 
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index fe8dd8aa4ae40..15a75b9f185fa 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -3286,9 +3286,10 @@  int drm_atomic_helper_resume(struct drm_device *dev,
 		drm_modeset_backoff(&ctx);
 	}
 
-	drm_atomic_state_put(state);
+	state->acquire_ctx = NULL;
 	drm_modeset_drop_locks(&ctx);
 	drm_modeset_acquire_fini(&ctx);
+	drm_atomic_state_put(state);
 
 	return err;
 }