Skip to contentSkip to conversation

drm/i915: Be defensive and don't assume PSR has any commit to sync against

PATCH In review Chris Wilson 5 participants 12 messages Sep 4, 2018 – Sep 5, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Be defensive and don't assume PSR has any commit to sync against

If the previous modeset commit has completed and is no longer part of the crtc state, skip waiting for it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107792

Fixes c44301fce614 ("drm/i915: Allow control of PSR at runtime through debugfs, v6")
Cc Maarten Lankhorst <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +10 -6
index 21984d4c08ed..bddc9c7c681e 100644
@@ -834,6 +834,7 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
 	struct drm_device *dev = &dev_priv->drm;
 	struct drm_connector_state *conn_state;
 	struct intel_crtc_state *crtc_state = NULL;
+	struct drm_crtc_commit *commit = NULL;
 	struct drm_crtc *crtc;
 	struct intel_dp *dp;
 	int ret;
@@ -860,12 +861,15 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
 			return ret;
 
 		crtc_state = to_intel_crtc_state(crtc->state);
-		ret = wait_for_completion_interruptible(&crtc_state->base.commit->hw_done);
-	} else
-		ret = wait_for_completion_interruptible(&conn_state->commit->hw_done);
-
-	if (ret)
-		return ret;
+		commit = crtc_state->base.commit;
+	} else {
+		commit = conn_state->commit;
+	}
+	if (commit) {
+		ret = wait_for_completion_interruptible(&commit->hw_done);
+		if (ret)
+			return ret;
+	}
 
 	ret = mutex_lock_interruptible(&dev_priv->psr.lock);
 	if (ret)
Signature · 6 lines
2.19.0.rc1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm/i915: Be defensive and don't assume PSR has any commit to sync against

== Series Details ==

== Series Details ==

Series: drm/i915: Be defensive and don't assume PSR has any commit to sync against
URL : https://patchwork.freedesktop.org/series/49141/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4767 -> Patchwork_10084 =

== Summary - SUCCESS ==

No regressions found.

External URL: https://patchwork.freedesktop.org/api/1.0/series/49141/revisions/1/mbox/

== Known issues ==

Here are the changes found in Patchwork_10084 that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_exec_suspend@basic-s3:
      fi-kbl-soraka:      NOTRUN -> INCOMPLETE (fdo#107774, fdo#107556)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s3:
      fi-cfl-8109u:       DMESG-WARN (fdo#107345) -> PASS +1

    igt@gem_exec_suspend@basic-s4-devices:
      fi-kbl-7500u:       DMESG-WARN (fdo#105128, fdo#107139) -> PASS

    igt@kms_flip@basic-flip-vs-modeset:
      fi-cfl-8109u:       INCOMPLETE (fdo#107468) -> PASS

fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139
fdo#107345 https://bugs.freedesktop.org/show_bug.cgi?id=107345
fdo#107468 https://bugs.freedesktop.org/show_bug.cgi?id=107468
fdo#107556 https://bugs.freedesktop.org/show_bug.cgi?id=107556
fdo#107774 https://bugs.freedesktop.org/show_bug.cgi?id=107774

== Participating hosts (50 -> 46) ==

Additional (1): fi-kbl-soraka
Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u

== Build changes ==

* Linux: CI_DRM_4767 -> Patchwork_10084

CI_DRM_4767: e9b69bafd3c2c13a8b9fa8e7a410f5d5ef32e328 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4626: bfce01d8c93dbd86e6ab04ca1afb844e0cbc8078 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10084: 23e6b7e3848fb3bbf675255440b077f6187a81a5 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

23e6b7e3848f drm/i915: Be defensive and don't assume PSR has any commit to sync against

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10084/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Chris Wilson
Quoted 28 lines · Chris Wilson

If the previous modeset commit has completed and is no longer part of the crtc state, skip waiting for it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107792

Fixes c44301fce614 ("drm/i915: Allow control of PSR at runtime through debugfs, v6")
Cc Maarten Lankhorst <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +1 -0
index 21984d4c08ed..bddc9c7c681e 100644
@@ -834,6 +834,7 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
 	struct drm_device *dev = &dev_priv->drm;
 	struct drm_connector_state *conn_state;
 	struct intel_crtc_state *crtc_state = NULL;
+	struct drm_crtc_commit *commit = NULL;
 	struct drm_crtc *crtc;
 	struct intel_dp *dp;
 	int ret;
@@ -860,12 +861,15 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
 			return ret;
 

drivers/gpu/drm/i915/intel_psr.c int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv, · line 866

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +3 -6
 		crtc_state = to_intel_crtc_state(crtc->state);
-		ret = wait_for_completion_interruptible(&crtc_state->base.commit->hw_done);
-	} else
-		ret = wait_for_completion_interruptible(&conn_state->commit->hw_done);
-
-	if (ret)
-		return ret;
+		commit = crtc_state->base.commit;
+	} else {
+		commit = conn_state->commit;

I can't even find where we clear state->commit after its done. Do we just leave it pointing at freed memory or something? Also I can't figure out why drm_atomic_helper_commit_hw_done() copies the commit also to the old state.

Quoted 16 lines
drivers/gpu/drm/i915/intel_psr.c +6 -0
+	}
+	if (commit) {
+		ret = wait_for_completion_interruptible(&commit->hw_done);
+		if (ret)
+			return ret;
+	}
 
 	ret = mutex_lock_interruptible(&dev_priv->psr.lock);
 	if (ret)
Signature · 6 lines
2.19.0.rc1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Quoting Ville Syrjälä (2018-09-04 18:39:53)

Quoted 29 lines · Chris Wilson
Quoted 28 lines

If the previous modeset commit has completed and is no longer part of the crtc state, skip waiting for it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107792

Fixes c44301fce614 ("drm/i915: Allow control of PSR at runtime through debugfs, v6")
Cc Maarten Lankhorst <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +1 -0
index 21984d4c08ed..bddc9c7c681e 100644
@@ -834,6 +834,7 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
      struct drm_device *dev = &dev_priv->drm;
      struct drm_connector_state *conn_state;
      struct intel_crtc_state *crtc_state = NULL;
+     struct drm_crtc_commit *commit = NULL;
      struct drm_crtc *crtc;
      struct intel_dp *dp;
      int ret;
@@ -860,12 +861,15 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
                      return ret;
 
Quoted 15 lines

drivers/gpu/drm/i915/intel_psr.c int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv, · line 866

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +3 -6
              crtc_state = to_intel_crtc_state(crtc->state);
-             ret = wait_for_completion_interruptible(&crtc_state->base.commit->hw_done);
-     } else
-             ret = wait_for_completion_interruptible(&conn_state->commit->hw_done);
-
-     if (ret)
-             return ret;
+             commit = crtc_state->base.commit;
+     } else {
+             commit = conn_state->commit;

I can't even find where we clear state->commit after its done. Do we just leave it pointing at freed memory or something? Also I can't figure out why drm_atomic_helper_commit_hw_done() copies the commit also to the old state.

Let me be the messenger then ;) commit is NULL at this point, I just presumed it was intentional.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by
#4 lore raw
Quoted 46 lines · Chris Wilson

Quoting Ville Syrjälä (2018-09-04 18:39:53)

Quoted 29 lines · Chris Wilson
Quoted 28 lines

If the previous modeset commit has completed and is no longer part of the crtc state, skip waiting for it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107792

Fixes c44301fce614 ("drm/i915: Allow control of PSR at runtime through debugfs, v6")
Cc Maarten Lankhorst <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +1 -0
index 21984d4c08ed..bddc9c7c681e 100644
@@ -834,6 +834,7 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
      struct drm_device *dev = &dev_priv->drm;
      struct drm_connector_state *conn_state;
      struct intel_crtc_state *crtc_state = NULL;
+     struct drm_crtc_commit *commit = NULL;
      struct drm_crtc *crtc;
      struct intel_dp *dp;
      int ret;
@@ -860,12 +861,15 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
                      return ret;
 
Quoted 15 lines

drivers/gpu/drm/i915/intel_psr.c int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv, · line 866

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +3 -6
              crtc_state = to_intel_crtc_state(crtc->state);
-             ret = wait_for_completion_interruptible(&crtc_state->base.commit->hw_done);
-     } else
-             ret = wait_for_completion_interruptible(&conn_state->commit->hw_done);
-
-     if (ret)
-             return ret;
+             commit = crtc_state->base.commit;
+     } else {
+             commit = conn_state->commit;

I can't even find where we clear state->commit after its done. Do we just leave it pointing at freed memory or something? Also I can't figure out why drm_atomic_helper_commit_hw_done() copies the commit also to the old state.

Quoted 2 lines

Let me be the messenger then ;) commit is NULL at this point, I just presumed it was intentional.

My expectation would be that it gets cleared somewhere, but I simply can't find any such code. So the only explanation I have now is that there has never been any commits on that crtc/connector before and that's why it's NULL.

Based on that theory this does seem sane, so

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 47 lines · Ville Syrjälä
Quoted 46 lines · Chris Wilson

Quoting Ville Syrjälä (2018-09-04 18:39:53)

Quoted 44 lines · Chris Wilson
Quoted 28 lines

If the previous modeset commit has completed and is no longer part of the crtc state, skip waiting for it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107792

Fixes c44301fce614 ("drm/i915: Allow control of PSR at runtime through debugfs, v6")
Cc Maarten Lankhorst <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +1 -0
index 21984d4c08ed..bddc9c7c681e 100644
@@ -834,6 +834,7 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
      struct drm_device *dev = &dev_priv->drm;
      struct drm_connector_state *conn_state;
      struct intel_crtc_state *crtc_state = NULL;
+     struct drm_crtc_commit *commit = NULL;
      struct drm_crtc *crtc;
      struct intel_dp *dp;
      int ret;
@@ -860,12 +861,15 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
                      return ret;
 

drivers/gpu/drm/i915/intel_psr.c int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv, · line 866

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +3 -6
              crtc_state = to_intel_crtc_state(crtc->state);
-             ret = wait_for_completion_interruptible(&crtc_state->base.commit->hw_done);
-     } else
-             ret = wait_for_completion_interruptible(&conn_state->commit->hw_done);
-
-     if (ret)
-             return ret;
+             commit = crtc_state->base.commit;
+     } else {
+             commit = conn_state->commit;

I can't even find where we clear state->commit after its done. Do we just leave it pointing at freed memory or something? Also I can't figure out why drm_atomic_helper_commit_hw_done() copies the commit also to the old state.

Quoted 5 lines
Quoted 2 lines

Let me be the messenger then ;) commit is NULL at this point, I just presumed it was intentional.

My expectation would be that it gets cleared somewhere, but I simply can't find any such code.

Actually it looks like there is no such code. The event based release_crtc_commit() thing gets its own reference so presumably the original reference stays with the state until the state itself gets destroyed.

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Quoting Ville Syrjälä (2018-09-04 19:06:29)

Quoted 51 lines · Ville Syrjälä
Quoted 50 lines · Chris Wilson
Quoted 48 lines

Quoting Ville Syrjälä (2018-09-04 18:39:53)

Quoted 29 lines · Chris Wilson
Quoted 28 lines

If the previous modeset commit has completed and is no longer part of the crtc state, skip waiting for it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107792

Fixes c44301fce614 ("drm/i915: Allow control of PSR at runtime through debugfs, v6")
Cc Maarten Lankhorst <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +1 -0
index 21984d4c08ed..bddc9c7c681e 100644
@@ -834,6 +834,7 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
      struct drm_device *dev = &dev_priv->drm;
      struct drm_connector_state *conn_state;
      struct intel_crtc_state *crtc_state = NULL;
+     struct drm_crtc_commit *commit = NULL;
      struct drm_crtc *crtc;
      struct intel_dp *dp;
      int ret;
@@ -860,12 +861,15 @@ int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv,
                      return ret;
 
Quoted 15 lines

drivers/gpu/drm/i915/intel_psr.c int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv, · line 866

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +3 -6
              crtc_state = to_intel_crtc_state(crtc->state);
-             ret = wait_for_completion_interruptible(&crtc_state->base.commit->hw_done);
-     } else
-             ret = wait_for_completion_interruptible(&conn_state->commit->hw_done);
-
-     if (ret)
-             return ret;
+             commit = crtc_state->base.commit;
+     } else {
+             commit = conn_state->commit;

I can't even find where we clear state->commit after its done. Do we just leave it pointing at freed memory or something? Also I can't figure out why drm_atomic_helper_commit_hw_done() copies the commit also to the old state.

Let me be the messenger then ;) commit is NULL at this point, I just presumed it was intentional.

Quoted 7 lines
Quoted 2 lines

My expectation would be that it gets cleared somewhere, but I simply can't find any such code.

Actually it looks like there is no such code. The event based release_crtc_commit() thing gets its own reference so presumably the original reference stays with the state until the state itself gets destroyed.

Happy with the it never had a commit theory, or is this a deeper problem that needs root causing?
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw
Quoted 77 lines · Chris Wilson

Quoting Ville Syrjälä (2018-09-04 19:06:29)

Quoted 70 lines · Ville Syrjälä
Quoted 61 lines · Chris Wilson
Quoted 60 lines

Quoting Ville Syrjälä (2018-09-04 18:39:53)

Quoted 58 lines · Chris Wilson
Quoted 43 lines

If the previous modeset commit has completed and is no longer part of
the crtc state, skip waiting for it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=1077
92

Fixes c44301fce614 ("drm/i915: Allow control of PSR at

runtime through debugfs, v6")

Cc Maarten Lankhorst <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +1 -0
index 21984d4c08ed..bddc9c7c681e 100644
@@ -834,6 +834,7 @@ int intel_psr_set_debugfs_mode(struct
 drm_i915_private *dev_priv,
      struct drm_device *dev = &dev_priv->drm;
      struct drm_connector_state *conn_state;
      struct intel_crtc_state *crtc_state = NULL;
+     struct drm_crtc_commit *commit = NULL;
      struct drm_crtc *crtc;
      struct intel_dp *dp;
      int ret;
drivers/gpu/drm/i915/intel_psr.c +0 -1
@@ -860,12 +861,15 @@ int intel_psr_set_debugfs_mode(struct
 drm_i915_private *dev_priv,
                      return ret;
 
              crtc_state = to_intel_crtc_state(crtc-
 >state);
-             ret =

wait_for_completion_interruptible(&crtc_state->base.commit-

Quoted 1 line

hw_done);

drivers/gpu/drm/i915/intel_psr.c +0 -2
-     } else
-             ret =

wait_for_completion_interruptible(&conn_state->commit-

Quoted 1 line

hw_done);

drivers/gpu/drm/i915/intel_psr.c int intel_psr_set_debugfs_mode(struct drm_i915_private *dev_priv, · line 866

Quoted 6 lines
drivers/gpu/drm/i915/intel_psr.c +3 -3
-
-     if (ret)
-             return ret;
+             commit = crtc_state->base.commit;
+     } else {
+             commit = conn_state->commit;

I can't even find where we clear state->commit after its done.
Do we just leave it pointing at freed memory or something? Also I
can't figure out why drm_atomic_helper_commit_hw_done() copies
the commit also to the old state.

Quoted 7 lines
Quoted 3 lines

Let me be the messenger then ;) commit is NULL at this point, I just
presumed it was intentional.

My expectation would be that it gets cleared somewhere, but I simply
can't find any such code.

Quoted 5 lines

Actually it looks like there is no such code. The event based release_crtc_commit() thing gets its own reference so presumably the
original reference stays with the state until the state itself gets destroyed.

Quoted 3 lines

Happy with the it never had a commit theory, or is this a deeper problem
that needs root causing?

Just so that I understand this correctly, even if there was a prior commit, state->commit would have been freed when completion was signaled. Is that right?

Quoted 1 line

-Chris

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw
Quoted 78 lines · Dhinakaran
Quoted 77 lines · Chris Wilson

Quoting Ville Syrjälä (2018-09-04 19:06:29)

Quoted 75 lines · Ville Syrjälä
Quoted 61 lines · Chris Wilson
Quoted 60 lines

Quoting Ville Syrjälä (2018-09-04 18:39:53)

Quoted 58 lines · Chris Wilson
Quoted 43 lines

If the previous modeset commit has completed and is no longer part of
the crtc state, skip waiting for it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=1077
92

Fixes c44301fce614 ("drm/i915: Allow control of PSR at

runtime through debugfs, v6")

Cc Maarten Lankhorst <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +1 -0
index 21984d4c08ed..bddc9c7c681e 100644
@@ -834,6 +834,7 @@ int intel_psr_set_debugfs_mode(struct
 drm_i915_private *dev_priv,
      struct drm_device *dev = &dev_priv->drm;
      struct drm_connector_state *conn_state;
      struct intel_crtc_state *crtc_state = NULL;
+     struct drm_crtc_commit *commit = NULL;
      struct drm_crtc *crtc;
      struct intel_dp *dp;
      int ret;
drivers/gpu/drm/i915/intel_psr.c +0 -1
@@ -860,12 +861,15 @@ int intel_psr_set_debugfs_mode(struct
 drm_i915_private *dev_priv,
                      return ret;
 
              crtc_state = to_intel_crtc_state(crtc-
 >state);
-             ret =

wait_for_completion_interruptible(&crtc_state->base.commit-

Quoted 1 line

hw_done);

drivers/gpu/drm/i915/intel_psr.c +0 -2
-     } else
-             ret =

wait_for_completion_interruptible(&conn_state->commit-

Quoted 1 line

hw_done);

drivers/gpu/drm/i915/intel_psr.c

Quoted 6 lines
drivers/gpu/drm/i915/intel_psr.c +3 -3
-
-     if (ret)
-             return ret;
+             commit = crtc_state->base.commit;
+     } else {
+             commit = conn_state->commit;

I can't even find where we clear state->commit after its done.
Do we just leave it pointing at freed memory or something? Also I
can't figure out why drm_atomic_helper_commit_hw_done() copies
the commit also to the old state.

Quoted 7 lines
Quoted 3 lines

Let me be the messenger then ;) commit is NULL at this point, I just
presumed it was intentional.

My expectation would be that it gets cleared somewhere, but I simply
can't find any such code.

Actually it looks like there is no such code. The event based release_crtc_commit() thing gets its own reference so presumably the
original reference stays with the state until the state itself gets destroyed.

Quoted 7 lines
Quoted 3 lines

Happy with the it never had a commit theory, or is this a deeper problem
that needs root causing?

Just so that I understand this correctly, even if there was a prior commit, state->commit would have been freed when completion was signaled. Is that right?

Nah, looks like it's going to hang on to the commit as long as the state exists. At least that's my reading of the atomic helper. Or maybe I'm missing something clever? Daniel/Maarten?

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

Op 05-09-18 om 12:22 schreef Ville Syrjälä:

Quoted 77 lines · Dhinakaran
Quoted 76 lines · Chris Wilson
Quoted 75 lines

Quoting Ville Syrjälä (2018-09-04 19:06:29)

Quoted 63 lines · Ville Syrjälä
Quoted 62 lines · Chris Wilson
Quoted 61 lines

Quoting Ville Syrjälä (2018-09-04 18:39:53)

Quoted 50 lines · Chris Wilson
Quoted 43 lines

If the previous modeset commit has completed and is no longer part of
the crtc state, skip waiting for it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=1077
92

Fixes c44301fce614 ("drm/i915: Allow control of PSR at

runtime through debugfs, v6")

Cc Maarten Lankhorst <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +1 -0
index 21984d4c08ed..bddc9c7c681e 100644
@@ -834,6 +834,7 @@ int intel_psr_set_debugfs_mode(struct
 drm_i915_private *dev_priv,
      struct drm_device *dev = &dev_priv->drm;
      struct drm_connector_state *conn_state;
      struct intel_crtc_state *crtc_state = NULL;
+     struct drm_crtc_commit *commit = NULL;
      struct drm_crtc *crtc;
      struct intel_dp *dp;
      int ret;
drivers/gpu/drm/i915/intel_psr.c +0 -1
@@ -860,12 +861,15 @@ int intel_psr_set_debugfs_mode(struct
 drm_i915_private *dev_priv,
                      return ret;
 
              crtc_state = to_intel_crtc_state(crtc-
 > state);
-             ret =

wait_for_completion_interruptible(&crtc_state->base.commit-

Quoted 1 line

hw_done);

drivers/gpu/drm/i915/intel_psr.c +0 -2
-     } else
-             ret =

wait_for_completion_interruptible(&conn_state->commit-

Quoted 1 line

hw_done);

drivers/gpu/drm/i915/intel_psr.c

Quoted 6 lines
drivers/gpu/drm/i915/intel_psr.c +3 -3
-
-     if (ret)
-             return ret;
+             commit = crtc_state->base.commit;
+     } else {
+             commit = conn_state->commit;
Quoted 7 lines

I can't even find where we clear state->commit after its done.
Do we just leave it pointing at freed memory or something? Also I
can't figure out why drm_atomic_helper_commit_hw_done() copies
the commit also to the old state.

Let me be the messenger then ;) commit is NULL at this point, I just
presumed it was intentional.

Quoted 8 lines
Quoted 3 lines

My expectation would be that it gets cleared somewhere, but I simply
can't find any such code.

Actually it looks like there is no such code. The event based release_crtc_commit() thing gets its own reference so presumably the
original reference stays with the state until the state itself gets destroyed.

Happy with the it never had a commit theory, or is this a deeper problem
that needs root causing?

Quoted 7 lines
Quoted 3 lines

Just so that I understand this correctly, even if there was a prior commit, state->commit would have been freed when completion was signaled. Is that right?

Nah, looks like it's going to hang on to the commit as long as the state exists. At least that's my reading of the atomic helper. Or maybe I'm missing something clever? Daniel/Maarten?

The commit is refcounted, and the original state has a reference. As long as that's not freed, the commit will hang around. So that can't cause a hang..

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw
Quoted 114 lines · Maarten Lankhorst

Op 05-09-18 om 12:22 schreef Ville Syrjälä:

Quoted 113 lines
Quoted 110 lines · Dhinakaran
Quoted 100 lines · Chris Wilson

Quoting Ville Syrjälä (2018-09-04 19:06:29)

Quoted 91 lines
Quoted 84 lines · Ville Syrjälä
Quoted 77 lines · Chris Wilson

Quoting Ville Syrjälä (2018-09-04 18:39:53)

Quoted 66 lines
Quoted 57 lines · Chris Wilson

If the previous modeset commit has completed and is no
longer part of
the crtc state, skip waiting for it.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?i
d=1077
92

Fixes c44301fce614 ("drm/i915: Allow control of PSR

at
runtime through debugfs, v6")

Quoted 1 line

Cc: Maarten Lankhorst <[email protected]. com>
Cc: Rodrigo Vivi <[email protected]>
Cc: Dhinakaran Pandiyan <[email protected] m>

---
 drivers/gpu/drm/i915/intel_psr.c | 16 ++++++++++--
----
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +0 -0
index 21984d4c08ed..bddc9c7c681e 100644
@@ -834,6 +834,7 @@ int

intel_psr_set_debugfs_mode(struct
drm_i915_private *dev_priv,

      struct drm_device *dev = &dev_priv->drm;
      struct drm_connector_state *conn_state;
      struct intel_crtc_state *crtc_state = NULL;
drivers/gpu/drm/i915/intel_psr.c +1 -0
+     struct drm_crtc_commit *commit = NULL;
      struct drm_crtc *crtc;
      struct intel_dp *dp;
      int ret;
@@ -860,12 +861,15 @@ int

intel_psr_set_debugfs_mode(struct
drm_i915_private *dev_priv,
return ret;

crtc_state = to_intel_crtc_state(crtc-

Quoted 1 line

state);

- ret =
wait_for_completion_interruptible(&crtc_state-

Quoted 2 lines

base.commit-
hw_done);

drivers/gpu/drm/i915/intel_psr.c +0 -2
-     } else
-             ret =

wait_for_completion_interruptible(&conn_state-

Quoted 2 lines

commit-
hw_done);

drivers/gpu/drm/i915/intel_psr.c

Quoted 6 lines
drivers/gpu/drm/i915/intel_psr.c +3 -3
-
-     if (ret)
-             return ret;
+             commit = crtc_state->base.commit;
+     } else {
+             commit = conn_state->commit;
Quoted 9 lines

I can't even find where we clear state->commit after its
done.
Do we just leave it pointing at freed memory or something?
Also I
can't figure out why drm_atomic_helper_commit_hw_done() copies
the commit also to the old state.

Quoted 4 lines

Let me be the messenger then ;) commit is NULL at this point, I
just
presumed it was intentional.

Quoted 4 lines

My expectation would be that it gets cleared somewhere, but I
simply
can't find any such code.

Quoted 7 lines

Actually it looks like there is no such code. The event based release_crtc_commit() thing gets its own reference so presumably
the
original reference stays with the state until the state itself gets
destroyed.

Quoted 4 lines

Happy with the it never had a commit theory, or is this a deeper
problem
that needs root causing?

Just so that I understand this correctly, even if there was a prior
commit, state->commit would have been freed when completion was signaled. Is that right?

Quoted 9 lines
Quoted 4 lines

Nah, looks like it's going to hang on to the commit as long as the state exists. At least that's my reading of the atomic helper. Or maybe I'm missing something clever? Daniel/Maarten?

The commit is refcounted, and the original state has a reference. As long as that's not freed, the commit will hang around. So that can't cause a hang..

Okay, the state corresponding to reading CRCs in the test, got freed before PSR was enabled.

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw

✓ Fi.CI.IGT: success for drm/i915: Be defensive and don't assume PSR has any commit to sync against

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: drm/i915: Be defensive and don't assume PSR has any commit to sync against
URL : https://patchwork.freedesktop.org/series/49141/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4767_full -> Patchwork_10084_full =

== Summary - SUCCESS ==

No regressions found.

== Known issues ==

Here are the changes found in Patchwork_10084_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_suspend@shrink:
      shard-hsw:          PASS -> INCOMPLETE (fdo#106886, fdo#103540)
      shard-kbl:          PASS -> FAIL (fdo#106886)

    igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
      shard-hsw:          PASS -> FAIL (fdo#105767) +1

    igt@kms_cursor_legacy@cursor-vs-flip-toggle:
      shard-hsw:          PASS -> FAIL (fdo#103355) +1

    
    ==== Possible fixes ====

    igt@kms_flip@flip-vs-expired-vblank-interruptible:
      shard-glk:          FAIL (fdo#105363, fdo#102887) -> PASS

    igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-cur-indfb-draw-pwrite:
      shard-glk:          FAIL (fdo#103167) -> PASS

    igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
      shard-glk:          INCOMPLETE (fdo#103359, k.org#198133) -> PASS

    igt@kms_setmode@basic:
      shard-apl:          FAIL (fdo#99912) -> PASS

fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103355 https://bugs.freedesktop.org/show_bug.cgi?id=103355
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105767 https://bugs.freedesktop.org/show_bug.cgi?id=105767
fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133

== Participating hosts (5 -> 5) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_4767 -> Patchwork_10084

CI_DRM_4767: e9b69bafd3c2c13a8b9fa8e7a410f5d5ef32e328 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4626: bfce01d8c93dbd86e6ab04ca1afb844e0cbc8078 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10084: 23e6b7e3848fb3bbf675255440b077f6187a81a5 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10084/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx