All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/core: Fail atomic IOCTL with no CRTC state but with signaling.
@ 2017-06-09 21:30 ` Andrey Grodzovsky
  0 siblings, 0 replies; 28+ messages in thread
From: Andrey Grodzovsky @ 2017-06-09 21:30 UTC (permalink / raw)
  To: dri-devel, linux-kernel, intel-gfx, maarten.lankhorst
  Cc: amd-gfx, harry.wentland, Andrey Grodzovsky

Problem:
While running IGT kms_atomic_transition test suite i encountered
a hang in drmHandleEvent immidietly follwoing an atomic_commit.
After dumping the atomic state I relized that in this case there was
not even one CRTC attached to the state and only disabled
planes. This probably due to a commit which hadn't changed any property
which would require attaching crtc state. This means drmHandleEvent
will never wake up from read since without CRTC in atomic state
the event fd will not be singnaled.
This point to a bug in IGT but also DRM should gracefully
fail  such scenario so no hang on user side will happen.

Fix:
Explicitly fail by failing atomic_commit early in
drm_mode_atomic_commit where such problem can be identified.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
---
 drivers/gpu/drm/drm_atomic.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index a567310..32eae1c 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1933,7 +1933,7 @@ static int prepare_crtc_signaling(struct drm_device *dev,
 {
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *crtc_state;
-	int i, ret;
+	int i, c = 0, ret;
 
 	if (arg->flags & DRM_MODE_ATOMIC_TEST_ONLY)
 		return 0;
@@ -1994,8 +1994,17 @@ static int prepare_crtc_signaling(struct drm_device *dev,
 
 			crtc_state->event->base.fence = fence;
 		}
+
+		c++;
 	}
 
+	/*
+	 * Having this flag means user mode pends on event which will never
+	 * reach due to lack of at least one CRTC for signaling
+	 */
+	if (c == 0 && (arg->flags & DRM_MODE_PAGE_FLIP_EVENT))
+		return -EINVAL;
+
 	return 0;
 }
 
@@ -2179,6 +2188,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 		drm_mode_object_unreference(obj);
 	}
 
+
+
 	ret = prepare_crtc_signaling(dev, state, arg, file_priv, &fence_state,
 				     &num_fences);
 	if (ret)
-- 
2.7.4

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

end of thread, other threads:[~2017-06-28 10:23 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 21:30 [PATCH] drm/core: Fail atomic IOCTL with no CRTC state but with signaling Andrey Grodzovsky
2017-06-09 21:30 ` Andrey Grodzovsky
2017-06-09 22:47 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-06-12 11:08 ` [PATCH] " Maarten Lankhorst
2017-06-12 11:08   ` Maarten Lankhorst
2017-06-12 14:12   ` Andrey Grodzovsky
2017-06-12 14:12     ` Andrey Grodzovsky
2017-06-15 20:46 ` Andrey Grodzovsky
2017-06-19 15:35 ` Harry Wentland
2017-06-19 15:35   ` Harry Wentland
2017-06-19 19:24   ` Sean Paul
2017-06-19 19:24     ` Sean Paul
2017-06-19 20:11     ` Andrey Grodzovsky
2017-06-20  9:29       ` [Intel-gfx] " Daniel Vetter
2017-06-20  9:29         ` Daniel Vetter
2017-06-20 17:57   ` [PATCH v2] " Andrey Grodzovsky
2017-06-20 17:57     ` Andrey Grodzovsky
2017-06-26 19:44     ` Harry Wentland
2017-06-26 19:44       ` Harry Wentland
2017-06-27  7:37       ` Daniel Vetter
2017-06-27  7:37         ` Daniel Vetter
2017-06-27 14:29         ` Maarten Lankhorst
2017-06-27 14:29           ` Maarten Lankhorst
2017-06-27 15:01           ` Daniel Vetter
2017-06-27 15:01             ` Daniel Vetter
2017-06-28 10:23             ` Maarten Lankhorst
2017-06-28 10:23               ` Maarten Lankhorst
2017-06-20 18:30 ` ✓ Fi.CI.BAT: success for drm/core: Fail atomic IOCTL with no CRTC state but with signaling. (rev2) Patchwork

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.