All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Do not use lock all in hsw_trans_edp_pipe_A_crc_wa
@ 2017-04-04 13:24 Maarten Lankhorst
  2017-04-04 14:37 ` ✓ Fi.CI.BAT: success for " Patchwork
  2017-04-12  8:55 ` [PATCH] " Daniel Vetter
  0 siblings, 2 replies; 3+ messages in thread
From: Maarten Lankhorst @ 2017-04-04 13:24 UTC (permalink / raw)
  To: intel-gfx

There is no need to acquire all locks here,
doing a commit after forcing a modeset on the affected crtc
is enough. Any other locks needed will be acquired as needed.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pipe_crc.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pipe_crc.c b/drivers/gpu/drm/i915/intel_pipe_crc.c
index 9fd9c70baeed..647426c75b0a 100644
--- a/drivers/gpu/drm/i915/intel_pipe_crc.c
+++ b/drivers/gpu/drm/i915/intel_pipe_crc.c
@@ -513,16 +513,20 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_i915_private *dev_priv,
 	struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_A);
 	struct intel_crtc_state *pipe_config;
 	struct drm_atomic_state *state;
+	struct drm_modeset_acquire_ctx ctx;
 	int ret = 0;
 
-	drm_modeset_lock_all(dev);
+	drm_modeset_acquire_init(&ctx, 0);
+
 	state = drm_atomic_state_alloc(dev);
 	if (!state) {
 		ret = -ENOMEM;
 		goto unlock;
 	}
 
-	state->acquire_ctx = drm_modeset_legacy_acquire_ctx(&crtc->base);
+	state->acquire_ctx = &ctx;
+
+retry:
 	pipe_config = intel_atomic_get_crtc_state(state, crtc);
 	if (IS_ERR(pipe_config)) {
 		ret = PTR_ERR(pipe_config);
@@ -537,10 +541,17 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_i915_private *dev_priv,
 	ret = drm_atomic_commit(state);
 
 put_state:
+	if (ret == -EDEADLK) {
+		drm_atomic_state_clear(state);
+		drm_modeset_backoff(&ctx);
+		goto retry;
+	}
+
 	drm_atomic_state_put(state);
 unlock:
 	WARN(ret, "Toggling workaround to %i returns %i\n", enable, ret);
-	drm_modeset_unlock_all(dev);
+	drm_modeset_drop_locks(&ctx);
+	drm_modeset_acquire_fini(&ctx);
 }
 
 static int ivb_pipe_crc_ctl_reg(struct drm_i915_private *dev_priv,
-- 
2.7.4

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

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

* ✓ Fi.CI.BAT: success for drm/i915: Do not use lock all in hsw_trans_edp_pipe_A_crc_wa
  2017-04-04 13:24 [PATCH] drm/i915: Do not use lock all in hsw_trans_edp_pipe_A_crc_wa Maarten Lankhorst
@ 2017-04-04 14:37 ` Patchwork
  2017-04-12  8:55 ` [PATCH] " Daniel Vetter
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2017-04-04 14:37 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Do not use lock all in hsw_trans_edp_pipe_A_crc_wa
URL   : https://patchwork.freedesktop.org/series/22435/
State : success

== Summary ==

Series 22435v1 drm/i915: Do not use lock all in hsw_trans_edp_pipe_A_crc_wa
https://patchwork.freedesktop.org/api/1.0/series/22435/revisions/1/mbox/

Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-uc:
                fail       -> PASS       (fi-snb-2600) fdo#100007
Test gem_exec_suspend:
        Subgroup basic-s4-devices:
                pass       -> DMESG-WARN (fi-kbl-7560u) fdo#100125
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                fail       -> PASS       (fi-skl-6700k) fdo#100367
Test prime_vgem:
        Subgroup basic-fence-flip:
                dmesg-warn -> PASS       (fi-byt-n2820) fdo#100094

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fdo#100367 https://bugs.freedesktop.org/show_bug.cgi?id=100367
fdo#100094 https://bugs.freedesktop.org/show_bug.cgi?id=100094

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time: 435s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time: 425s
fi-bsw-n3050     total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  time: 576s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time: 509s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time: 552s
fi-byt-j1900     total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  time: 480s
fi-byt-n2820     total:278  pass:247  dwarn:0   dfail:0   fail:0   skip:31  time: 482s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 409s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 405s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time: 427s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 485s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 466s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 455s
fi-kbl-7560u     total:278  pass:267  dwarn:1   dfail:0   fail:0   skip:10  time: 566s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 454s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time: 569s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time: 463s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 488s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time: 435s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 523s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time: 408s

38a5db0d3643f519d86f42029b7a93e624807a71 drm-tip: 2017y-04m-04d-13h-24m-06s UTC integration manifest
0127348 drm/i915: Do not use lock all in hsw_trans_edp_pipe_A_crc_wa

== Logs ==

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

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

* Re: [PATCH] drm/i915: Do not use lock all in hsw_trans_edp_pipe_A_crc_wa
  2017-04-04 13:24 [PATCH] drm/i915: Do not use lock all in hsw_trans_edp_pipe_A_crc_wa Maarten Lankhorst
  2017-04-04 14:37 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-04-12  8:55 ` Daniel Vetter
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2017-04-12  8:55 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: intel-gfx

On Tue, Apr 04, 2017 at 03:24:57PM +0200, Maarten Lankhorst wrote:
> There is no need to acquire all locks here,
> doing a commit after forcing a modeset on the affected crtc
> is enough. Any other locks needed will be acquired as needed.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_pipe_crc.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pipe_crc.c b/drivers/gpu/drm/i915/intel_pipe_crc.c
> index 9fd9c70baeed..647426c75b0a 100644
> --- a/drivers/gpu/drm/i915/intel_pipe_crc.c
> +++ b/drivers/gpu/drm/i915/intel_pipe_crc.c
> @@ -513,16 +513,20 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_i915_private *dev_priv,
>  	struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_A);
>  	struct intel_crtc_state *pipe_config;
>  	struct drm_atomic_state *state;
> +	struct drm_modeset_acquire_ctx ctx;
>  	int ret = 0;
>  
> -	drm_modeset_lock_all(dev);
> +	drm_modeset_acquire_init(&ctx, 0);
> +
>  	state = drm_atomic_state_alloc(dev);
>  	if (!state) {
>  		ret = -ENOMEM;
>  		goto unlock;
>  	}
>  
> -	state->acquire_ctx = drm_modeset_legacy_acquire_ctx(&crtc->base);
> +	state->acquire_ctx = &ctx;
> +
> +retry:
>  	pipe_config = intel_atomic_get_crtc_state(state, crtc);
>  	if (IS_ERR(pipe_config)) {
>  		ret = PTR_ERR(pipe_config);
> @@ -537,10 +541,17 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_i915_private *dev_priv,
>  	ret = drm_atomic_commit(state);
>  
>  put_state:
> +	if (ret == -EDEADLK) {
> +		drm_atomic_state_clear(state);

Random idea of the day: Should we treat the atomic state like a special ww
mutex to make sure it's properly cleared when we drop the locks? Not sure
that's feasible, reasonable and how badly it'd break the suspend/resume
helpers, but would be good to make sure we always clear the state before
dropping locks.

Anyway, that idea aside, patch lgtm.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> +		drm_modeset_backoff(&ctx);
> +		goto retry;
> +	}
> +
>  	drm_atomic_state_put(state);
>  unlock:
>  	WARN(ret, "Toggling workaround to %i returns %i\n", enable, ret);
> -	drm_modeset_unlock_all(dev);
> +	drm_modeset_drop_locks(&ctx);
> +	drm_modeset_acquire_fini(&ctx);
>  }
>  
>  static int ivb_pipe_crc_ctl_reg(struct drm_i915_private *dev_priv,
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
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] 3+ messages in thread

end of thread, other threads:[~2017-04-12  8:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-04 13:24 [PATCH] drm/i915: Do not use lock all in hsw_trans_edp_pipe_A_crc_wa Maarten Lankhorst
2017-04-04 14:37 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-04-12  8:55 ` [PATCH] " 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.