drm/core: Fail atomic IOCTL with no CRTC state but with signaling.
Subsystems (2)
PATCH 1/1 drm/core: Fail atomic IOCTL with no CRTC state but with signaling.
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.
--- drivers/gpu/drm/drm_atomic.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic.c +12 -1
@@ -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)
Signature · 1 line
2.7.4
Patchwork
CI✓ Fi.CI.BAT: success for drm/core: Fail atomic IOCTL with no CRTC state but with signaling.
== Series Details ==
== Series Details ==
Series: drm/core: Fail atomic IOCTL with no CRTC state but with signaling.
URL : https://patchwork.freedesktop.org/series/25591/
State : success
== Summary ==
Series 25591v1 drm/core: Fail atomic IOCTL with no CRTC state but with signaling.
https://patchwork.freedesktop.org/api/1.0/series/25591/revisions/1/mbox/
Test gem_exec_suspend:
Subgroup basic-s4-devices:
dmesg-warn -> PASS (fi-kbl-7560u) fdo#100125fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
fi-bdw-5557u total:278 pass:267 dwarn:0 dfail:0 fail:0 skip:11 time:441s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:431s fi-bsw-n3050 total:278 pass:242 dwarn:0 dfail:0 fail:0 skip:36 time:578s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:516s fi-byt-j1900 total:278 pass:254 dwarn:0 dfail:0 fail:0 skip:24 time:490s fi-byt-n2820 total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:484s fi-glk-2a total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:597s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:429s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:412s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:414s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:506s fi-ivb-3770 total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:468s fi-kbl-7500u total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:468s fi-kbl-7560u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:575s fi-kbl-r total:278 pass:259 dwarn:1 dfail:0 fail:0 skip:18 time:574s fi-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:462s fi-skl-6700hq total:278 pass:228 dwarn:2 dfail:0 fail:26 skip:22 time:400s fi-skl-6700k total:278 pass:256 dwarn:4 dfail:0 fail:0 skip:18 time:468s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:478s fi-skl-gvtdvm total:278 pass:265 dwarn:0 dfail:0 fail:0 skip:13 time:432s fi-snb-2520m total:278 pass:250 dwarn:0 dfail:0 fail:0 skip:28 time:533s fi-snb-2600 total:278 pass:248 dwarn:0 dfail:0 fail:1 skip:29 time:401s
1a2964dddfe7becfbe0ed3b7cadffdbc526a1ab9 drm-tip: 2017y-06m-09d-21h-50m-40s UTC integration manifest 82f6b26 drm/core: Fail atomic IOCTL with no CRTC state but with signaling.
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4930/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst
maintainerOp 09-06-17 om 23:30 schreef Andrey Grodzovsky:
Quoted 12 lines
Problem:
While running IGTkms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immidietly follwoing anatomic_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.
Quoted 8 lines
Fix:
Explicitly fail by failingatomic_commitearly indrm_mode_atomic_commitwhere such problem can be identified.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
Patch itself looks sane, but I'm worried about failing with -EINVAL when the same configuration with TEST_ONLY would otherwise succeed on it. Not sure whether we should fail or not, since sending 0 events could still be considered success.
I don't mind either way, but definitely something that should be discussed before applying.
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 17 lines · Maarten Lankhorst
Op 09-06-17 om 23:30 schreef Andrey Grodzovsky:
Quoted 16 lines
Problem:
While running IGTkms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immidietly follwoing anatomic_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 failingatomic_commitearly indrm_mode_atomic_commitwhere such problem can be identified.
Quoted 5 lines
Quoted 4 lines
Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)Patch itself looks sane, but I'm worried about failing with
-EINVALwhen the same configuration withTEST_ONLYwould otherwise succeed on it.
DRM_MODE_ATOMIC_TEST_ONLY flag is checked later, after this, so if this fails , test only will return EINVAL also.
Quoted 3 lines
Not sure whether we should fail or not, since sending 0 events could still be considered success.
I don't mind either way, but definitely something that should be discussed before applying.
Sending 0 events is no problem at all on it's own but if user provides DRM_MODE_PAGE_FLIP_EVENT in args then when it becomes a problem , doesn't it mean he expects to receive at least one event ?
Thanks.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Just a reminder.
Thanks.
Quoted 61 lines · Andrey Grodzovsky
Problem:
While running IGTkms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immidietly follwoing anatomic_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 failingatomic_commitearly indrm_mode_atomic_commitwhere such problem can be identified.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +12
-1@@ -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)
Quoted 3 lines · Andrey Grodzovsky
Problem:
While running IGTkms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immidietly follwoing anatomic_commit.
s/immidietly/immediately/g
s/follwoing/following/g
Quoted 6 lines
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.
s/singnaled/signaled/g
Quoted 3 lines
This point to a bug in IGT but also DRM should gracefully fail such scenario so no hang on user side will happen.
Can we create an IGT fix for this to make sure this won't happen?
Quoted 4 lines
Fix:
Explicitly fail by failingatomic_commitearly indrm_mode_atomic_commitwhere such problem can be identified.
The change seems reasonable to me but I would like to see some input from someone who's more familiar with the usermode side of things.
Quoted 19 lines
Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +1
-1@@ -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 ;
drivers/gpu/drm/drm_atomic.c static int prepare_crtc_signaling(struct drm_device *dev, · line 1998
Quoted 5 lines
drivers/gpu/drm/drm_atomic.c +2
-0@@ -1994,8 +1994,17 @@ static int prepare_crtc_signaling(struct drm_device *dev, crtc_state->event->base.fence = fence; } + + c++;
Not sure if intentional, but I like it.
Quoted 13 lines
drivers/gpu/drm/drm_atomic.c +7
-0} +/* +* 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 ; }
drivers/gpu/drm/drm_atomic.c int drm_mode_atomic_ioctl(struct drm_device *dev, · line 2192
Quoted 5 lines
drivers/gpu/drm/drm_atomic.c +2
-0@@ -2179,6 +2188,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,drm_mode_object_unreference (obj); } + +
Remove these extraneous newlines.
Harry
drivers/gpu/drm/drm_atomic.c int drm_mode_atomic_ioctl(struct drm_device *dev, · line 2195
Quoted 4 lines
drivers/gpu/drm/drm_atomic.c +0
-0ret =prepare_crtc_signaling (dev, state, arg, file_priv, &fence_state, &num_fences);if (ret)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 23 lines · Harry Wentland
Quoted 3 lines · Andrey Grodzovsky
Problem:
While running IGTkms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immidietly follwoing anatomic_commit.s/immidietly/immediately/g
s/follwoing/following/gQuoted 6 lines
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.
s/singnaled/signaled/g
Quoted 3 lines
This point to a bug in IGT but also DRM should gracefully fail such scenario so no hang on user side will happen.
Can we create an IGT fix for this to make sure this won't happen?
Quoted 7 lines
Quoted 4 lines
Fix:
Explicitly fail by failingatomic_commitearly indrm_mode_atomic_commitwhere such problem can be identified.The change seems reasonable to me but I would like to see some input from someone who's more familiar with the usermode side of things.
I wonder if there's ever a case where it might be desirable to generate an event from a commit without a crtc. I don't know if anyone has explicitly said that an event can only be generated from state with crtc.
I usually don't mind letting userspace shoot itself in the foot, so keep that in mind :)
Sean
Quoted 55 lines
Quoted 20 lines
Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +1
-1@@ -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 ;drivers/gpu/drm/drm_atomic.c static int prepare_crtc_signaling(struct drm_device *dev, · line 1998
Quoted 5 lines
drivers/gpu/drm/drm_atomic.c +2
-0@@ -1994,8 +1994,17 @@ static int prepare_crtc_signaling(struct drm_device *dev, crtc_state->event->base.fence = fence; } + + c++;Not sure if intentional, but I like it.
Quoted 13 lines
drivers/gpu/drm/drm_atomic.c +7
-0} +/* +* 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 ; }drivers/gpu/drm/drm_atomic.c int drm_mode_atomic_ioctl(struct drm_device *dev, · line 2192
Quoted 5 lines
drivers/gpu/drm/drm_atomic.c +2
-0@@ -2179,6 +2188,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,drm_mode_object_unreference (obj); } + +Remove these extraneous newlines.
Harry
Quoted 4 lines
drivers/gpu/drm/drm_atomic.c +0
-0ret =prepare_crtc_signaling (dev, state, arg, file_priv, &fence_state, &num_fences);if (ret)
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 25 lines · Sean Paul
Quoted 24 lines · Harry Wentland
Quoted 3 lines · Andrey Grodzovsky
Problem:
While running IGTkms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immidietly follwoing anatomic_commit.s/immidietly/immediately/g
s/follwoing/following/gQuoted 6 lines
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.
s/singnaled/signaled/g
Quoted 3 lines
This point to a bug in IGT but also DRM should gracefully fail such scenario so no hang on user side will happen.
Can we create an IGT fix for this to make sure this won't happen?
Quoted 4 lines
Fix:
Explicitly fail by failingatomic_commitearly indrm_mode_atomic_commitwhere such problem can be identified.
Quoted 5 lines
Quoted 2 lines
The change seems reasonable to me but I would like to see some input from someone who's more familiar with the usermode side of things.
I wonder if there's ever a case where it might be desirable to generate an event from a commit without a crtc. I don't know if anyone has explicitly said that an event can only be generated from state with crtc.
For a generic event i agree, bit seems to me without active CRTC no way you can expect PAGE_FLIP_EVENT to fire.
Quoted 5 lines
I usually don't mind letting userspace shoot itself in the foot, so keep that in mind :)
Sean
Seems to me you still would try to avoid a bad configuration, returning error will help debugging for user who made a mistake. I also see something similar in drm_mode_atomic_ioctl around line 2122 -
/* can't test and expect an event at the same time. */ if ((arg->flags & DRM_MODE_ATOMIC_TEST_ONLY) && (arg->flags & DRM_MODE_PAGE_FLIP_EVENT)) return -EINVAL;
Thanks,
Andrey
Quoted 46 lines
Quoted 46 lines
Quoted 19 lines
Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +1
-1@@ -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 ;drivers/gpu/drm/drm_atomic.c static int prepare_crtc_signaling(struct drm_device *dev, · line 1998
Quoted 5 lines
drivers/gpu/drm/drm_atomic.c +2
-0@@ -1994,8 +1994,17 @@ static int prepare_crtc_signaling(struct drm_device *dev, crtc_state->event->base.fence = fence; } + + c++;Not sure if intentional, but I like it.
Quoted 13 lines
drivers/gpu/drm/drm_atomic.c +7
-0} +/* +* 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 ; }drivers/gpu/drm/drm_atomic.c int drm_mode_atomic_ioctl(struct drm_device *dev, · line 2192
Quoted 5 lines
drivers/gpu/drm/drm_atomic.c +2
-0@@ -2179,6 +2188,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,drm_mode_object_unreference (obj); } + +Remove these extraneous newlines.
Quoted 6 lines
Quoted 6 lines
Harry
Quoted 4 lines
drivers/gpu/drm/drm_atomic.c +0
-0ret =prepare_crtc_signaling (dev, state, arg, file_priv, &fence_state, &num_fences);if (ret)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 47 lines · Andrey Grodzovsky
Quoted 25 lines · Sean Paul
Quoted 24 lines · Harry Wentland
Quoted 3 lines · Andrey Grodzovsky
Problem:
While running IGTkms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immidietly follwoing anatomic_commit.s/immidietly/immediately/g
s/follwoing/following/gQuoted 6 lines
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.
s/singnaled/signaled/g
Quoted 3 lines
This point to a bug in IGT but also DRM should gracefully fail such scenario so no hang on user side will happen.
Can we create an IGT fix for this to make sure this won't happen?
Quoted 4 lines
Fix:
Explicitly fail by failingatomic_commitearly indrm_mode_atomic_commitwhere such problem can be identified.Quoted 5 lines
Quoted 2 lines
The change seems reasonable to me but I would like to see some input from someone who's more familiar with the usermode side of things.
I wonder if there's ever a case where it might be desirable to generate an event from a commit without a crtc. I don't know if anyone has explicitly said that an event can only be generated from state with crtc.
For a generic event i agree, bit seems to me without active CRTC no way you can expect
PAGE_FLIP_EVENTto fire.Quoted 5 lines
I usually don't mind letting userspace shoot itself in the foot, so keep that in mind :)
Sean
Seems to me you still would try to avoid a bad configuration, returning error
will help debugging for user who made a mistake. I also see something similar
indrm_mode_atomic_ioctlaround line 2122 -
Quoted 4 lines
/* can't test and expect an event at the same time. */ if ((
arg->flags&DRM_MODE_ATOMIC_TEST_ONLY) && (arg->flags&DRM_MODE_PAGE_FLIP_EVENT)) return-EINVAL;
Asking for an event without anything changed is a bug imo. We need to fix the testcases, and even better would be to have an explicit testcase which does such a no-op atomic ioctl + event and checks that we get the -EINVAL.
Same applies for asking for events when the crtc is off and stays off btw, but I think we catch that already somewhere. But again would be good to make sure we have an igt for it.
Thanks, Daniel
Quoted 56 lines
Thanks,
AndreyQuoted 41 lines
Quoted 41 lines
Quoted 18 lines
Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +1
-1@@ -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 ;drivers/gpu/drm/drm_atomic.c static int prepare_crtc_signaling(struct drm_device *dev, · line 1997
Quoted 4 lines
drivers/gpu/drm/drm_atomic.c +2
-0@@ -1994,8 +1994,17 @@ static int prepare_crtc_signaling(struct drm_device *dev, crtc_state->event->base.fence = fence; } + + c++;Not sure if intentional, but I like it.
Quoted 11 lines
drivers/gpu/drm/drm_atomic.c +7
-0} +/* +* 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 ; }drivers/gpu/drm/drm_atomic.c int drm_mode_atomic_ioctl(struct drm_device *dev, · line 2191
Quoted 4 lines
drivers/gpu/drm/drm_atomic.c +2
-0@@ -2179,6 +2188,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,drm_mode_object_unreference (obj); } + +Remove these extraneous newlines.
Quoted 6 lines
Quoted 6 lines
Harry
Quoted 4 lines
drivers/gpu/drm/drm_atomic.c +0
-0ret =prepare_crtc_signaling (dev, state, arg, file_priv, &fence_state, &num_fences);if (ret)_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 drm/core: Fail atomic IOCTL with no CRTC state but with signaling.
In reply to Harry WentlandProblem : While running IGT kms_atomic_transition test suite i encountered a hang in drmHandleEvent immediately following 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 signaled.
Fix: Protect against this issue by failing atomic_commit early in drm_mode_atomic_commit where such probelm can be identified.
v2:
Fix typos and extra newlines.
--- drivers/gpu/drm/drm_atomic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic.c +10 -1
@@ -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 ; }
Signature · 1 line
2.7.4
Patchwork
CI✓ Fi.CI.BAT: success for drm/core: Fail atomic IOCTL with no CRTC state but with signaling. (rev2)
In reply to Andrey Grodzovsky== Series Details ==
== Series Details ==
Series: drm/core: Fail atomic IOCTL with no CRTC state but with signaling. (rev2)
URL : https://patchwork.freedesktop.org/series/25591/
State : success
== Summary ==
Series 25591v2 drm/core: Fail atomic IOCTL with no CRTC state but with signaling.
https://patchwork.freedesktop.org/api/1.0/series/25591/revisions/2/mbox/
Test gem_exec_suspend:
Subgroup basic-s4-devices:
dmesg-warn -> PASS (fi-kbl-7560u) fdo#100125
Test prime_busy:
Subgroup basic-wait-after-default:
pass -> DMESG-WARN (fi-skl-6700hq) fdo#101515 +1
Test prime_self_import:
Subgroup basic-llseek-bad:
dmesg-warn -> PASS (fi-skl-6700hq)
Test drv_module_reload:
Subgroup basic-reload:
dmesg-warn -> PASS (fi-skl-6700hq)fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125
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:441s fi-bdw-gvtdvm total:278 pass:256 dwarn:8 dfail:0 fail:0 skip:14 time:427s fi-bsw-n3050 total:278 pass:241 dwarn:1 dfail:0 fail:0 skip:36 time:534s fi-bxt-j4205 total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:507s fi-byt-j1900 total:278 pass:252 dwarn:2 dfail:0 fail:0 skip:24 time:488s fi-byt-n2820 total:278 pass:248 dwarn:2 dfail:0 fail:0 skip:28 time:482s fi-glk-2a total:278 pass:259 dwarn:0 dfail:0 fail:0 skip:19 time:586s fi-hsw-4770 total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:437s fi-hsw-4770r total:278 pass:262 dwarn:0 dfail:0 fail:0 skip:16 time:417s fi-ilk-650 total:278 pass:228 dwarn:0 dfail:0 fail:0 skip:50 time:419s fi-ivb-3520m total:278 pass:260 dwarn:0 dfail:0 fail:0 skip:18 time:494s 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:465s fi-kbl-7560u total:278 pass:268 dwarn:0 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-skl-6260u total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:460s 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:472s fi-skl-6770hq total:278 pass:268 dwarn:0 dfail:0 fail:0 skip:10 time:478s 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:540s fi-snb-2600 total:278 pass:248 dwarn:0 dfail:0 fail:1 skip:29 time:411s
0c75e3f237ff950c7ba824cbb5f93f40b4bb9c02 drm-tip: 2017y-06m-20d-16h-15m-17s UTC integration manifest 154688f drm/core: Fail atomic IOCTL with no CRTC state but with signaling.
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_5002/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Andrey Grodzovsky
Problem : While running IGT
kms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immediately following anatomic_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 signaled.
Quoted 8 lines
Fix: Protect against this issue by failing
atomic_commitearly indrm_mode_atomic_commitwhere such probelm can be identified.v2:
Fix typos and extra newlines.Change-Id I3ee28ffae35fd1e8bfe553146c44da53da02e6f8Signed-off-by Andrey Grodzovsky <[email protected]>
Harry
Quoted 26 lines
--- drivers/gpu/drm/drm_atomic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +3
-1@@ -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++; }
drivers/gpu/drm/drm_atomic.c static int prepare_crtc_signaling(struct drm_device *dev, · line 2010
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +7
-0+/* +* 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 ; }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 13 lines · Harry Wentland
Quoted 12 lines · Andrey Grodzovsky
Problem : While running IGT
kms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immediately following anatomic_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 signaled.Fix: Protect against this issue by failing
atomic_commitearly indrm_mode_atomic_commitwhere such probelm can be identified.
Quoted 7 lines
Quoted 5 lines
v2:
Fix typos and extra newlines.Change-Id I3ee28ffae35fd1e8bfe553146c44da53da02e6f8Signed-off-by Andrey Grodzovsky <[email protected]>Reviewed-by Harry Wentland <[email protected]>
Stalling on this hoping for the igt patch. Does it exist already? -Daniel
Quoted 39 lines
Harry
Quoted 36 lines
--- drivers/gpu/drm/drm_atomic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +10
-1@@ -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 ; }
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Maarten Lankhorst
maintainerOp 27-06-17 om 09:37 schreef Daniel Vetter:
Quoted 50 lines · Harry Wentland
Quoted 13 lines · Andrey Grodzovsky
Quoted 12 lines
Problem : While running IGT
kms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immediately following anatomic_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 signaled.Fix: Protect against this issue by failing
atomic_commitearly indrm_mode_atomic_commitwhere such probelm can be identified.Quoted 6 lines
Quoted 5 lines
v2:
Fix typos and extra newlines.Change-Id I3ee28ffae35fd1e8bfe553146c44da53da02e6f8Signed-off-by Andrey Grodzovsky <[email protected]>Reviewed-by Harry Wentland <[email protected]>Stalling on this hoping for the igt patch. Does it exist already? -Daniel
Quoted 27 lines
Harry
Quoted 25 lines
--- drivers/gpu/drm/drm_atomic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +3
-1@@ -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++; }
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/drm_atomic.c static int prepare_crtc_signaling(struct drm_device *dev, · line 2010
Quoted 11 lines
drivers/gpu/drm/drm_atomic.c +7
-0+/* +* 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 ; }
Just do it, and I'll commit this to igt?
tests/kms_atomic.c +13 -4
@@ -1205,6 +1205,15 @@ static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,crtc_commit_atomic (&crtc, plane, req,ATOMIC_RELAX_NONE ,DRM_MODE_ATOMIC_TEST_ONLY ); +/* +* TEST_ONLY cannot be combined with DRM_MODE_PAGE_FLIP_EVENT, +* but DRM_MODE_PAGE_FLIP_EVENT will always generate EINVAL +* without valid crtc, so test it here. +*/ +crtc_commit_atomic_err (&crtc, plane, req,ATOMIC_RELAX_NONE , +DRM_MODE_ATOMIC_TEST_ONLY |DRM_MODE_PAGE_FLIP_EVENT , +EINVAL ); +/* Create a blob which is the wrong size to be a valid mode. */ do_or_die(drmModeCreatePropertyBlob(crtc.state->desc->fd, crtc.mode.data,
@@ -1356,12 +1365,12 @@ static void atomic_invalid_params(struct kms_atomic_crtc_state *crtc,/* Valid pointers, but still should copy nothing. */ do_ioctl (desc->fd,DRM_IOCTL_MODE_ATOMIC , &ioc); -/* Nonsense flags. */ - ioc.flags =0xdeadbeef ; +/* Valid noop, but with event set should fail. */ + ioc.flags =DRM_MODE_PAGE_FLIP_EVENT ;do_ioctl_err (desc->fd,DRM_IOCTL_MODE_ATOMIC , &ioc,EINVAL ); -/* Specifically forbidden combination. */ - ioc.flags =DRM_MODE_ATOMIC_TEST_ONLY |DRM_MODE_PAGE_FLIP_EVENT ; +/* Nonsense flags. */ + ioc.flags =0xdeadbeef ;do_ioctl_err (desc->fd,DRM_IOCTL_MODE_ATOMIC , &ioc,EINVAL ); ioc.flags =0 ;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Daniel Vetter
Acked-byQuoted 51 lines · Maarten Lankhorst
Op 27-06-17 om 09:37 schreef Daniel Vetter:
Quoted 50 lines · Harry Wentland
Quoted 13 lines · Andrey Grodzovsky
Quoted 12 lines
Problem : While running IGT
kms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immediately following anatomic_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 signaled.Fix: Protect against this issue by failing
atomic_commitearly indrm_mode_atomic_commitwhere such probelm can be identified.Quoted 6 lines
Quoted 5 lines
v2:
Fix typos and extra newlines.Change-Id I3ee28ffae35fd1e8bfe553146c44da53da02e6f8Signed-off-by Andrey Grodzovsky <[email protected]>Reviewed-by Harry Wentland <[email protected]>Stalling on this hoping for the igt patch. Does it exist already? -Daniel
Quoted 27 lines
Harry
Quoted 25 lines
--- drivers/gpu/drm/drm_atomic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +3
-1@@ -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++; }
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/drm_atomic.c static int prepare_crtc_signaling(struct drm_device *dev, · line 2010
Quoted 11 lines
drivers/gpu/drm/drm_atomic.c +7
-0+/* +* 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 ; }Just do it, and I'll commit this to igt?
Ack on both the kernel patch and the igt patch, feel free to push them both with:
If you do, please add the Testcase: line to the kernel patch.
Thanks, Daniel
Quoted 43 lines
tests/kms_atomic.c +13
-4@@ -1205,6 +1205,15 @@ static void crtc_invalid_params(struct kms_atomic_crtc_state *crtc_old,crtc_commit_atomic (&crtc, plane, req,ATOMIC_RELAX_NONE ,DRM_MODE_ATOMIC_TEST_ONLY ); +/* +* TEST_ONLY cannot be combined with DRM_MODE_PAGE_FLIP_EVENT, +* but DRM_MODE_PAGE_FLIP_EVENT will always generate EINVAL +* without valid crtc, so test it here. +*/ +crtc_commit_atomic_err (&crtc, plane, req,ATOMIC_RELAX_NONE , +DRM_MODE_ATOMIC_TEST_ONLY |DRM_MODE_PAGE_FLIP_EVENT , +EINVAL ); +/* Create a blob which is the wrong size to be a valid mode. */ do_or_die(drmModeCreatePropertyBlob(crtc.state->desc->fd, crtc.mode.data,@@ -1356,12 +1365,12 @@ static void atomic_invalid_params(struct kms_atomic_crtc_state *crtc,/* Valid pointers, but still should copy nothing. */ do_ioctl (desc->fd,DRM_IOCTL_MODE_ATOMIC , &ioc); -/* Nonsense flags. */ - ioc.flags =0xdeadbeef ; +/* Valid noop, but with event set should fail. */ + ioc.flags =DRM_MODE_PAGE_FLIP_EVENT ;do_ioctl_err (desc->fd,DRM_IOCTL_MODE_ATOMIC , &ioc,EINVAL ); -/* Specifically forbidden combination. */ - ioc.flags =DRM_MODE_ATOMIC_TEST_ONLY |DRM_MODE_PAGE_FLIP_EVENT ; +/* Nonsense flags. */ + ioc.flags =0xdeadbeef ;do_ioctl_err (desc->fd,DRM_IOCTL_MODE_ATOMIC , &ioc,EINVAL ); ioc.flags =0 ;_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Maarten Lankhorst
maintainerOp 27-06-17 om 17:01 schreef Daniel Vetter:
Quoted 64 lines · Maarten Lankhorst
Quoted 51 lines
Op 27-06-17 om 09:37 schreef Daniel Vetter:
Quoted 50 lines · Harry Wentland
Quoted 13 lines · Andrey Grodzovsky
Quoted 12 lines
Problem : While running IGT
kms_atomic_transitiontest suite i encountered a hang in drmHandleEvent immediately following anatomic_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 signaled.Fix: Protect against this issue by failing
atomic_commitearly indrm_mode_atomic_commitwhere such probelm can be identified.Quoted 6 lines
Quoted 5 lines
v2:
Fix typos and extra newlines.Change-Id I3ee28ffae35fd1e8bfe553146c44da53da02e6f8Signed-off-by Andrey Grodzovsky <[email protected]>Reviewed-by Harry Wentland <[email protected]>Stalling on this hoping for the igt patch. Does it exist already? -Daniel
Quoted 27 lines
Harry
Quoted 25 lines
--- drivers/gpu/drm/drm_atomic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic.c +3
-1@@ -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++; }Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/drm_atomic.c static int prepare_crtc_signaling(struct drm_device *dev, · line 2010
Quoted 11 lines
drivers/gpu/drm/drm_atomic.c +7
-0+/* +* 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 ; }Just do it, and I'll commit this to igt?
Quoted 6 lines
Ack on both the kernel patch and the igt patch, feel free to push them both with:
Acked-by Daniel Vetter <[email protected]>If you do, please add the Testcase: line to the kernel patch.
Oops, missed adding the testcase to commit message, but pushed.
I've pushed the IGT testcase as well, after fixing it up to make sure it works as intended.
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx