diff mbox

[i-g-t,v2,10/12] tests/kms_atomic_transition: add out_fences tests

Message ID 20161214090509.15716-11-robert.foss@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Foss Dec. 14, 2016, 9:05 a.m. UTC
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
 lib/igt_kms.c                 | 22 ++++++++++++++++++++++
 tests/kms_atomic_transition.c | 32 ++++++++++++++++++++++++++++++--
 2 files changed, 52 insertions(+), 2 deletions(-)

Comments

Brian Starkey Dec. 14, 2016, 4:57 p.m. UTC | #1
On Wed, Dec 14, 2016 at 04:05:07AM -0500, Robert Foss wrote:
>From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
>Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>Signed-off-by: Robert Foss <robert.foss@collabora.com>
>---
> lib/igt_kms.c                 | 22 ++++++++++++++++++++++
> tests/kms_atomic_transition.c | 32 ++++++++++++++++++++++++++++++--
> 2 files changed, 52 insertions(+), 2 deletions(-)
>
>diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>index fe1b356d..eb59ab36 100644
>--- a/lib/igt_kms.c
>+++ b/lib/igt_kms.c
>@@ -49,6 +49,7 @@
> #include "intel_chipset.h"
> #include "igt_debugfs.h"
> #include "igt_sysfs.h"
>+#include "sw_sync.h"
>
> /**
>  * SECTION:igt_kms
>@@ -2184,6 +2185,27 @@ static int igt_atomic_commit(igt_display_t *display, uint32_t flags, void *user_
> 	}
>
> 	ret = drmModeAtomicCommit(display->drm_fd, req, flags, user_data);
>+	if (!ret) {
>+		int64_t *fence_ptr;
>+
>+		for_each_pipe(display, pipe) {
>+			igt_pipe_t *pipe_obj = &display->pipes[pipe];
>+
>+			fence_ptr = pipe_obj->out_fence_ptr;
>+			if (!fence_ptr)
>+				continue;
>+
>+			if (flags & DRM_MODE_ATOMIC_TEST_ONLY) {
>+				igt_assert(*fence_ptr == -1);
>+			} else {
>+				igt_assert(*fence_ptr >= 0);
>+				ret = sw_sync_wait(*fence_ptr, 1000);
>+				igt_assert(ret == 0);
>+				close(*fence_ptr);
>+			}
>+		}
>+	}
>+
> 	drmModeAtomicFree(req);
> 	return ret;
>
>diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
>index b7d99975..08f9499f 100644
>--- a/tests/kms_atomic_transition.c
>+++ b/tests/kms_atomic_transition.c
>@@ -132,6 +132,7 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
> 	struct plane_parms parms[IGT_MAX_PLANES];
> 	bool skip_test = false;
> 	unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
>+	int out_fence, ret;

out_fence needs to be 64-bit.

>
> 	if (nonblocking)
> 		flags |= DRM_MODE_ATOMIC_NONBLOCK;
>@@ -198,9 +199,11 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
> 	 * planes to fix this
> 	 */
> 	while (1) {
>-		int ret;
>-
> 		wm_setup_plane(display, pipe, iter_max - 1, parms);
>+
>+		if (fencing)
>+			igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>+			    (int64_t *) &out_fence);
> 		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
>
> 		if (ret != -EINVAL || n_planes < 3)
>@@ -231,6 +234,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
>
> 		wm_setup_plane(display, pipe, i, parms);
>
>+		if (fencing)
>+			igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
>+
> 		igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
> 		drmHandleEvent(display->drm_fd, &drm_events);
>
>@@ -239,6 +245,10 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
>
> 			wm_setup_plane(display, pipe, 0, parms);
>
>+			if (fencing)
>+				igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>+				    (int64_t *) &out_fence);
>+
> 			igt_display_commit_atomic(display, flags, (void *)0UL);
>
> 			drmHandleEvent(display->drm_fd, &drm_events);
>@@ -252,6 +262,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
> 				if (type == TRANSITION_MODESET)
> 					igt_output_override_mode(output, &override_mode);
>
>+				if (fencing)
>+					igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
>+
> 				igt_display_commit_atomic(display, flags, (void *)(unsigned long)j);
> 				drmHandleEvent(display->drm_fd, &drm_events);
>
>@@ -259,6 +272,9 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
> 				if (type == TRANSITION_MODESET)
> 					igt_output_override_mode(output, NULL);
>
>+				if (fencing)
>+					igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
>+
> 				igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
> 				drmHandleEvent(display->drm_fd, &drm_events);
> 			}
>@@ -588,14 +604,26 @@ igt_main
> 		for_each_pipe_with_valid_output(&display, pipe, output)
> 			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, false);
>
>+	igt_subtest("plane-all-transition-fencing")
>+		for_each_pipe_with_valid_output(&display, pipe, output)
>+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, true);
>+
> 	igt_subtest("plane-all-transition-nonblocking")
> 		for_each_pipe_with_valid_output(&display, pipe, output)
> 			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, false);
>
>+	igt_subtest("plane-all-transition-nonblocking-fencing")
>+		for_each_pipe_with_valid_output(&display, pipe, output)
>+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, true);
>+

This test makes my kernel very unhappy running on drm-next on mali-dp.
Any ideas?

WARN -> Stall -> BUG:

[  131.657643] WARNING: CPU: 0 PID: 2124 at drivers/gpu/drm/drm_atomic_helper.c:1041 drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
[  131.670293] Modules linked in: mali_dp tda998x drm_kms_helper drm ip_tables x_tables ipv6
[  131.678416]
[  131.679890] CPU: 0 PID: 2124 Comm: kms_atomic_tran Not tainted 4.9.0-rc8 #267
[  131.686950] Hardware name: ARM Juno development board (r0) (DT)
[  131.692806] task: ffff800970ae0000 task.stack: ffff8009746c0000
[  131.698732] PC is at drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
[  131.706206] LR is at drm_atomic_helper_commit+0x7c/0x11c [drm_kms_helper]
[  131.712923] pc : [<ffff000000bdba1c>] lr : [<ffff000000bde958>] pstate: 20000145
[  131.720241] sp : ffff8009746c3b40
[  131.723516] x29: ffff8009746c3b40 x28: ffff80096fd40c00
[  131.728778] x27: 0000000022d216e0 x26: ffff80096fd40a80
[  131.734039] x25: 0000000000000018 x24: 0000000000000001
[  131.739300] x23: ffff80096fd40a80 x22: 0000000000000001
[  131.744561] x21: ffff80096fd40c00 x20: 0000000000000000
[  131.749823] x19: ffff80096fd40b00 x18: 0000000000000000
[  131.755084] x17: 0000ffffa5f64b00 x16: ffff0000081e7c88
[  131.760344] x15: 0000000000000000 x14: 0000000000000000
[  131.765605] x13: 0000000000000007 x12: 000000000000ca35
[  131.770865] x11: 0000000000000006 x10: 000000000000ca35
[  131.776126] x9 : 0000000000000000 x8 : ffff80097479f500
[  131.781387] x7 : 0000000000000000 x6 : 000000000000003f
[  131.786647] x5 : ffff80096fd40648 x4 : 0000000000000000
[  131.791908] x3 : ffff80096fd40600 x2 : 0000000000000001
[  131.797168] x1 : 0000000000000000 x0 : ffff80096f61f280
[  131.802429]
[  131.803898] ---[ end trace f3a899d81ca41342 ]---
[  131.808464] Call trace:
[  131.810882] Exception stack(0xffff8009746c3970 to 0xffff8009746c3aa0)
[  131.817256] 3960:                                   ffff80096fd40b00 0001000000000000
[  131.825008] 3980: ffff8009746c3b40 ffff000000bdba1c ffff8009746c3a30 ffff0000080fe1e4
[  131.832759] 39a0: ffff0000009c3038 ffff80097085b800 0000000000000001 ffff8009746c3d70
[  131.840509] 39c0: ffff80096fd40a80 0000000000000001 0000000000000018 ffff80096fd40a80
[  131.848260] 39e0: 0000000022d216e0 ffff80096fd40c00 ffff80097085c038 0000000000000000
[  131.856010] 3a00: ffff000008e15130 0000000000000140 ffff80096f61f280 0000000000000000
[  131.863761] 3a20: 0000000000000001 ffff80096fd40600 0000000000000000 ffff80096fd40648
[  131.871511] 3a40: 000000000000003f 0000000000000000 ffff80097479f500 0000000000000000
[  131.879262] 3a60: 000000000000ca35 0000000000000006 000000000000ca35 0000000000000007
[  131.887012] 3a80: 0000000000000000 0000000000000000 ffff0000081e7c88 0000ffffa5f64b00
[  131.894830] [<ffff000000bdba1c>] drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
[  131.903338] [<ffff000000bde958>] drm_atomic_helper_commit+0x7c/0x11c [drm_kms_helper]
[  131.911252] [<ffff0000009a10a8>] drm_atomic_commit+0x48/0x68 [drm]
[  131.917532] [<ffff0000009a26f4>] drm_mode_atomic_ioctl+0x42c/0xa40 [drm]
[  131.924324] [<ffff00000098d8e8>] drm_ioctl+0x188/0x458 [drm]
[  131.929929] [<ffff0000081e75a0>] do_vfs_ioctl+0xb4/0x79c
[  131.935186] [<ffff0000081e7d0c>] SyS_ioctl+0x84/0x98
[  131.940101] [<ffff000008082f4c>] __sys_trace_return+0x0/0x4
n:2124) igt-kms-CRITICAL: Last errno: 62, Timer expired
****  END  ****
Subtest plane-all-transition-nonblocking-fencing: FAIL (2.151s)
[  363.609017] INFO: task kworker/u12:4:1087 blocked for more than 120 seconds.
[  363.616021]       Tainted: G        W       4.9.0-rc8 #267
[  363.621473] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  363.629237] kworker/u12:4   D    0  1087      2 0x00000000
[  363.634770] Workqueue: events_unbound commit_work [drm_kms_helper]
[  363.640903] Call trace:
[  363.643328] [<ffff000008085550>] __switch_to+0x90/0xa4
[  363.648431] [<ffff000008881ac8>] __schedule+0x178/0x564
[  363.653618] [<ffff000008881ef0>] schedule+0x3c/0xa0
[  363.658461] [<ffff000008884c34>] schedule_timeout+0x148/0x218
[  363.664165] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
[  363.670383] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
[  363.676495] [<ffff000000bdb9b8>] drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
[  363.685017] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
[  363.691646] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
[  363.698211] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
[  363.703912] [<ffff0000080d346c>] worker_thread+0x58/0x434
[  363.709269] [<ffff0000080d8f24>] kthread+0xd4/0xe8
[  363.714024] [<ffff000008082e80>] ret_from_fork+0x10/0x50
[  484.440951] INFO: task kworker/u12:4:1087 blocked for more than 120 seconds.
[  484.440957]       Tainted: G        W       4.9.0-rc8 #267
[  484.440959] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  484.440966] kworker/u12:4   D    0  1087      2 0x00000000
[  484.441059] Workqueue: events_unbound commit_work [drm_kms_helper]
[  484.441060] Call trace:
[  484.441072] [<ffff000008085550>] __switch_to+0x90/0xa4
[  484.441080] [<ffff000008881ac8>] __schedule+0x178/0x564
[  484.441085] [<ffff000008881ef0>] schedule+0x3c/0xa0
[  484.441092] [<ffff000008884c34>] schedule_timeout+0x148/0x218
[  484.441099] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
[  484.441105] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
[  484.441177] [<ffff000000bdb9b8>] drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
[  484.441250] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
[  484.441321] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
[  484.441329] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
[  484.441334] [<ffff0000080d346c>] worker_thread+0x58/0x434
[  484.441339] [<ffff0000080d8f24>] kthread+0xd4/0xe8
[  484.441344] [<ffff000008082e80>] ret_from_fork+0x10/0x50
[  485.464997] [drm:drm_atomic_helper_swap_state [drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] hw_done timed out
[  495.704997] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] hw_done timed out
[  505.944998] [drm:drm_atomic_helper_wait_for_dependencies [drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] flip_done timed out
[  506.391339] ------------[ cut here ]------------
[  506.395909] kernel BUG at drivers/dma-buf/dma-fence.c:178!
[  506.401337] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
[  506.406763] Modules linked in: mali_dp tda998x drm_kms_helper drm ip_tables x_tables ipv6
[  506.414894] CPU: 3 PID: 2124 Comm: kms_atomic_tran Tainted: G        W       4.9.0-rc8 #267
[  506.423158] Hardware name: ARM Juno development board (r0) (DT)
[  506.429015] task: ffff800970ae0000 task.stack: ffff8009746c0000
[  506.434879] PC is at dma_fence_release+0x44/0x48
[  506.439448] LR is at sync_file_free+0x48/0x70
[  506.443757] pc : [<ffff00000852e504>] lr : [<ffff00000852f7cc>] pstate: 80000145
[  506.451074] sp : ffff8009746c3b70
[  506.454349] x29: ffff8009746c3b70 x28: ffff8009746c0000
[  506.459610] x27: 0000000000000001 x26: ffff000008d3728c
[  506.464870] x25: ffff800975d10510 x24: ffff8009768d3b50
[  506.470130] x23: ffff800976c3ec20 x22: ffff8009720c7e40
[  506.475390] x21: ffff8009768d3b50 x20: 0000000000000010
[  506.480650] x19: ffff80096f61f100 x18: 0000000000000000
[  506.485909] x17: 4000000000000000 x16: ffffffffffffffff
[  506.491170] x15: 0000000000000040 x14: dead000000000100
[  506.496430] x13: dead000000000200 x12: 00000000ffffffff
[  506.501690] x11: 0000000000000068 x10: ffff800975f18700
[  506.506950] x9 : 0000000040000000 x8 : 0000000000210d00
[  506.512210] x7 : ffff800970ae0678 x6 : 0000000000000000
[  506.517470] x5 : 0000000000000000 x4 : 0000000000000000
[  506.522730] x3 : ffff800976753ce0 x2 : ffff80096f61f2a0
[  506.527989] x1 : 0000000000000000 x0 : ffff80096f61f280
[  506.533248]
[  506.534719] Process kms_atomic_tran (pid: 2124, stack limit = 0xffff8009746c0020)
[  506.542124] Stack: (0xffff8009746c3b70 to 0xffff8009746c4000)
[  506.547810] 3b60:                                   ffff8009746c3b80 ffff00000852f7cc
[  506.555561] 3b80: ffff8009746c3ba0 ffff00000852f824 ffff800975d10500 ffff8009768d3b50
[  506.563311] 3ba0: ffff8009746c3bb0 ffff0000081d6b24 ffff8009746c3c00 ffff0000081d6cc0
[  506.571062] 3bc0: ffff80097479bf00 ffff800970ae0678 ffff800970ae0000 ffff800970ae06ac
[  506.578813] 3be0: ffff000008e0f000 ffff800975f18768 0000000008430000 ffff0000080da458
[  506.586564] 3c00: ffff8009746c3c10 ffff0000080d72d4 ffff8009746c3c50 ffff0000080c016c
[  506.594314] 3c20: ffff800970ae0000 ffff8009746c3cb0 0000000000000001 ffff800970ac0000
[  506.602065] 3c40: ffff000008d35000 ffff0000080c0168 ffff8009746c3cc0 ffff0000080c088c
[  506.609815] 3c60: ffff800970ac0000 0000000000000002 ffff8009746c0000 ffff800970ac0000
[  506.617566] 3c80: ffff800974608000 ffff8009746c3de8 0000000008430000 ffff000008d3728c
[  506.625316] 3ca0: 0000000000000001 ffff8009746c0000 ffff8009746c3cf0 ffff0000080ca3dc
[  506.633067] 3cc0: ffff8009746c3cf0 ffff0000080ca514 ffff8009746c0000 ffff8009746c3e08
[  506.640818] 3ce0: ffff800974608808 ffff800970ac0000 ffff8009746c3d70 ffff000008087850
[  506.648568] 3d00: 0000000000000201 ffff8009746c3de8 ffff8009746c0000 ffff8009746c3ec0
[  506.656319] 3d20: 0000000000000000 ffff8009746c3ec0 0000000000000123 000000000000008b
[  506.664069] 3d40: ffff000008892000 ffff8009746c0000 0000000000000000 0000000000000000
[  506.671820] 3d60: 5555000000004100 ffff000008b04a20 ffff8009746c3e90 ffff000008087e2c
[  506.679570] 3d80: 0000000000000201 ffff8009746c0000 ffff8009746c0000 ffff8009746c3ec0
[  506.687320] 3da0: 0000000000000000 0000000000000015 0000000000000123 000000000000008b
[  506.695071] 3dc0: ffff000008892000 ffff8009746c0000 0000000000000000 0000000000000000
[  506.702821] 3de0: ffff8009746c3e20 ffff0000081decc4 ffff8009746c3e40 ffff0000081472d0
[  506.710572] 3e00: ffff8009748fa800 0000000000000002 00000000fffffffa 000000000000084c
[  506.718322] 3e20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  506.726072] 3e40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  506.733822] 3e60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  506.741572] 3e80: 0000000000000000 ffff000008082f58 0000000000000000 ffff000008082ddc
[  506.749323] 3ea0: 0000000000000200 0000ffffeac382b8 ffffffffffffffff 0000ffffa625d6c8
[  506.757073] 3ec0: 0000000000000003 00000000c03864bc 0000ffffeac382b8 0000000000000011
[  506.764823] 3ee0: 0000000022d216a0 0000000000000005 0000000000000022 0000000022d213b0
[  506.772573] 3f00: 000000000000001d 0000000000000000 0000001000000020 0000ffffeac38400
[  506.780323] 3f20: 0000001300000020 0000000000000000 0000000000000000 0000000000000000
[  506.788074] 3f40: 0000ffffa6230278 0000ffffa5f64b00 0000000000000000 0000000022d216c0
[  506.795824] 3f60: 0000ffffeac382b8 00000000c03864bc 0000000000000003 0000000022d1d410
[  506.803575] 3f80: 0000000000000022 0000000022d216e0 0000000022d217b0 0000000022d1c7e0
[  506.811325] 3fa0: 0000000000000010 0000ffffeac38220 0000ffffa621797c 0000ffffeac38220
[  506.819075] 3fc0: 0000ffffa5f64b08 0000000060000000 0000000000000000 ffffffffffffffff
[  506.826825] 3fe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
[  506.834572] Call trace:
[  506.836990] Exception stack(0xffff8009746c39a0 to 0xffff8009746c3ad0)
[  506.843365] 39a0: ffff80096f61f100 0001000000000000 ffff8009746c3b70 ffff00000852e504
[  506.851115] 39c0: ffff8009746c0000 0000000180170016 0000000100170017 ffff7e0025dbbf80
[  506.858866] 39e0: ffff8009746c3b00 ffff0000081bb910 ffff80096ec34800 ffff8009746c0000
[  506.866617] 3a00: ffff00000819826c ffff7e0025d39500 ffff8009746c3b30 ffff0000081bbe50
[  506.874367] 3a20: ffff7e0025bd87c0 ffff8009746c0000 0000000000158143 ffff80096f61f580
[  506.882118] 3a40: ffff80096f61f280 0000000000000000 ffff80096f61f2a0 ffff800976753ce0
[  506.889867] 3a60: 0000000000000000 0000000000000000 0000000000000000 ffff800970ae0678
[  506.897618] 3a80: 0000000000210d00 0000000040000000 ffff800975f18700 0000000000000068
[  506.905368] 3aa0: 00000000ffffffff dead000000000200 dead000000000100 0000000000000040
[  506.913117] 3ac0: ffffffffffffffff 4000000000000000
[  506.917945] [<ffff00000852e504>] dma_fence_release+0x44/0x48
[  506.923546] [<ffff00000852f7cc>] sync_file_free+0x48/0x70
[  506.928888] [<ffff00000852f824>] sync_file_release+0x30/0x3c
[  506.934490] [<ffff0000081d6b24>] __fput+0x94/0x1d8
[  506.939229] [<ffff0000081d6cc0>] ____fput+0xc/0x14
[  506.943972] [<ffff0000080d72d4>] task_work_run+0xc4/0xe4
[  506.949230] [<ffff0000080c016c>] do_exit+0x2d0/0x980
[  506.954143] [<ffff0000080c088c>] do_group_exit+0x40/0x9c
[  506.959401] [<ffff0000080ca514>] get_signal+0x1e8/0x4f0
[  506.964573] [<ffff000008087850>] do_signal+0x198/0x554
[  506.969657] [<ffff000008087e2c>] do_notify_resume+0x88/0xa4
[  506.975171] [<ffff000008082ddc>] work_pending+0x8/0x10
[  506.980257] Code: 8b010000 97ef7a27 a8c17bfd d65f03c0 (d4210000)
[  506.988726] ---[ end trace f3a899d81ca41343 ]---
[  506.993312] Fixing recursive fault but reboot is needed!

Thanks,
Brian
> 	igt_subtest("plane-all-modeset-transition")
> 		for_each_pipe_with_valid_output(&display, pipe, output)
> 			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, false);
>
>+	igt_subtest("plane-all-modeset-transition-fencing")
>+		for_each_pipe_with_valid_output(&display, pipe, output)
>+			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, true);
>+
> 	igt_subtest("plane-toggle-modeset-transition")
> 		for_each_pipe_with_valid_output(&display, pipe, output)
> 			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false, false);
>-- 
>2.11.0
>
Robert Foss Dec. 16, 2016, 8:59 a.m. UTC | #2
On 2016-12-14 11:57 AM, Brian Starkey wrote:
> On Wed, Dec 14, 2016 at 04:05:07AM -0500, Robert Foss wrote:
>> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>
>> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>> Signed-off-by: Robert Foss <robert.foss@collabora.com>
>> ---
>> lib/igt_kms.c                 | 22 ++++++++++++++++++++++
>> tests/kms_atomic_transition.c | 32 ++++++++++++++++++++++++++++++--
>> 2 files changed, 52 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index fe1b356d..eb59ab36 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -49,6 +49,7 @@
>> #include "intel_chipset.h"
>> #include "igt_debugfs.h"
>> #include "igt_sysfs.h"
>> +#include "sw_sync.h"
>>
>> /**
>>  * SECTION:igt_kms
>> @@ -2184,6 +2185,27 @@ static int igt_atomic_commit(igt_display_t
>> *display, uint32_t flags, void *user_
>>     }
>>
>>     ret = drmModeAtomicCommit(display->drm_fd, req, flags, user_data);
>> +    if (!ret) {
>> +        int64_t *fence_ptr;
>> +
>> +        for_each_pipe(display, pipe) {
>> +            igt_pipe_t *pipe_obj = &display->pipes[pipe];
>> +
>> +            fence_ptr = pipe_obj->out_fence_ptr;
>> +            if (!fence_ptr)
>> +                continue;
>> +
>> +            if (flags & DRM_MODE_ATOMIC_TEST_ONLY) {
>> +                igt_assert(*fence_ptr == -1);
>> +            } else {
>> +                igt_assert(*fence_ptr >= 0);
>> +                ret = sw_sync_wait(*fence_ptr, 1000);
>> +                igt_assert(ret == 0);
>> +                close(*fence_ptr);
>> +            }
>> +        }
>> +    }
>> +
>>     drmModeAtomicFree(req);
>>     return ret;
>>
>> diff --git a/tests/kms_atomic_transition.c
>> b/tests/kms_atomic_transition.c
>> index b7d99975..08f9499f 100644
>> --- a/tests/kms_atomic_transition.c
>> +++ b/tests/kms_atomic_transition.c
>> @@ -132,6 +132,7 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>     struct plane_parms parms[IGT_MAX_PLANES];
>>     bool skip_test = false;
>>     unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
>> +    int out_fence, ret;
>
> out_fence needs to be 64-bit.

Ack, fixed in v3.

>
>>
>>     if (nonblocking)
>>         flags |= DRM_MODE_ATOMIC_NONBLOCK;
>> @@ -198,9 +199,11 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>      * planes to fix this
>>      */
>>     while (1) {
>> -        int ret;
>> -
>>         wm_setup_plane(display, pipe, iter_max - 1, parms);
>> +
>> +        if (fencing)
>> +            igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>> +                (int64_t *) &out_fence);
>>         ret = igt_display_try_commit_atomic(display,
>> DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
>>
>>         if (ret != -EINVAL || n_planes < 3)
>> @@ -231,6 +234,9 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>
>>         wm_setup_plane(display, pipe, i, parms);
>>
>> +        if (fencing)
>> +            igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>> &out_fence);
>> +
>>         igt_display_commit_atomic(display, flags, (void *)(unsigned
>> long)i);
>>         drmHandleEvent(display->drm_fd, &drm_events);
>>
>> @@ -239,6 +245,10 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>
>>             wm_setup_plane(display, pipe, 0, parms);
>>
>> +            if (fencing)
>> +                igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>> +                    (int64_t *) &out_fence);
>> +
>>             igt_display_commit_atomic(display, flags, (void *)0UL);
>>
>>             drmHandleEvent(display->drm_fd, &drm_events);
>> @@ -252,6 +262,9 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>                 if (type == TRANSITION_MODESET)
>>                     igt_output_override_mode(output, &override_mode);
>>
>> +                if (fencing)
>> +                    igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>> &out_fence);
>> +
>>                 igt_display_commit_atomic(display, flags, (void
>> *)(unsigned long)j);
>>                 drmHandleEvent(display->drm_fd, &drm_events);
>>
>> @@ -259,6 +272,9 @@ run_transition_test(igt_display_t *display, enum
>> pipe pipe, igt_output_t *output
>>                 if (type == TRANSITION_MODESET)
>>                     igt_output_override_mode(output, NULL);
>>
>> +                if (fencing)
>> +                    igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>> &out_fence);
>> +
>>                 igt_display_commit_atomic(display, flags, (void
>> *)(unsigned long)i);
>>                 drmHandleEvent(display->drm_fd, &drm_events);
>>             }
>> @@ -588,14 +604,26 @@ igt_main
>>         for_each_pipe_with_valid_output(&display, pipe, output)
>>             run_transition_test(&display, pipe, output,
>> TRANSITION_PLANES, false, false);
>>
>> +    igt_subtest("plane-all-transition-fencing")
>> +        for_each_pipe_with_valid_output(&display, pipe, output)
>> +            run_transition_test(&display, pipe, output,
>> TRANSITION_PLANES, false, true);
>> +
>>     igt_subtest("plane-all-transition-nonblocking")
>>         for_each_pipe_with_valid_output(&display, pipe, output)
>>             run_transition_test(&display, pipe, output,
>> TRANSITION_PLANES, true, false);
>>
>> +    igt_subtest("plane-all-transition-nonblocking-fencing")
>> +        for_each_pipe_with_valid_output(&display, pipe, output)
>> +            run_transition_test(&display, pipe, output,
>> TRANSITION_PLANES, true, true);
>> +
>
> This test makes my kernel very unhappy running on drm-next on mali-dp.
> Any ideas?

Hmm. I haven't seen anything like this.
I did my testing on drm-misc/drm-misc-next, unfortunately I don't have 
any access to mali hardware of any kind :/

Rob.

>
> WARN -> Stall -> BUG:
>
> [  131.657643] WARNING: CPU: 0 PID: 2124 at
> drivers/gpu/drm/drm_atomic_helper.c:1041
> drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
> [  131.670293] Modules linked in: mali_dp tda998x drm_kms_helper drm
> ip_tables x_tables ipv6
> [  131.678416]
> [  131.679890] CPU: 0 PID: 2124 Comm: kms_atomic_tran Not tainted
> 4.9.0-rc8 #267
> [  131.686950] Hardware name: ARM Juno development board (r0) (DT)
> [  131.692806] task: ffff800970ae0000 task.stack: ffff8009746c0000
> [  131.698732] PC is at drm_atomic_helper_wait_for_fences+0xcc/0xd4
> [drm_kms_helper]
> [  131.706206] LR is at drm_atomic_helper_commit+0x7c/0x11c
> [drm_kms_helper]
> [  131.712923] pc : [<ffff000000bdba1c>] lr : [<ffff000000bde958>]
> pstate: 20000145
> [  131.720241] sp : ffff8009746c3b40
> [  131.723516] x29: ffff8009746c3b40 x28: ffff80096fd40c00
> [  131.728778] x27: 0000000022d216e0 x26: ffff80096fd40a80
> [  131.734039] x25: 0000000000000018 x24: 0000000000000001
> [  131.739300] x23: ffff80096fd40a80 x22: 0000000000000001
> [  131.744561] x21: ffff80096fd40c00 x20: 0000000000000000
> [  131.749823] x19: ffff80096fd40b00 x18: 0000000000000000
> [  131.755084] x17: 0000ffffa5f64b00 x16: ffff0000081e7c88
> [  131.760344] x15: 0000000000000000 x14: 0000000000000000
> [  131.765605] x13: 0000000000000007 x12: 000000000000ca35
> [  131.770865] x11: 0000000000000006 x10: 000000000000ca35
> [  131.776126] x9 : 0000000000000000 x8 : ffff80097479f500
> [  131.781387] x7 : 0000000000000000 x6 : 000000000000003f
> [  131.786647] x5 : ffff80096fd40648 x4 : 0000000000000000
> [  131.791908] x3 : ffff80096fd40600 x2 : 0000000000000001
> [  131.797168] x1 : 0000000000000000 x0 : ffff80096f61f280
> [  131.802429]
> [  131.803898] ---[ end trace f3a899d81ca41342 ]---
> [  131.808464] Call trace:
> [  131.810882] Exception stack(0xffff8009746c3970 to 0xffff8009746c3aa0)
> [  131.817256] 3960:                                   ffff80096fd40b00
> 0001000000000000
> [  131.825008] 3980: ffff8009746c3b40 ffff000000bdba1c ffff8009746c3a30
> ffff0000080fe1e4
> [  131.832759] 39a0: ffff0000009c3038 ffff80097085b800 0000000000000001
> ffff8009746c3d70
> [  131.840509] 39c0: ffff80096fd40a80 0000000000000001 0000000000000018
> ffff80096fd40a80
> [  131.848260] 39e0: 0000000022d216e0 ffff80096fd40c00 ffff80097085c038
> 0000000000000000
> [  131.856010] 3a00: ffff000008e15130 0000000000000140 ffff80096f61f280
> 0000000000000000
> [  131.863761] 3a20: 0000000000000001 ffff80096fd40600 0000000000000000
> ffff80096fd40648
> [  131.871511] 3a40: 000000000000003f 0000000000000000 ffff80097479f500
> 0000000000000000
> [  131.879262] 3a60: 000000000000ca35 0000000000000006 000000000000ca35
> 0000000000000007
> [  131.887012] 3a80: 0000000000000000 0000000000000000 ffff0000081e7c88
> 0000ffffa5f64b00
> [  131.894830] [<ffff000000bdba1c>]
> drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
> [  131.903338] [<ffff000000bde958>] drm_atomic_helper_commit+0x7c/0x11c
> [drm_kms_helper]
> [  131.911252] [<ffff0000009a10a8>] drm_atomic_commit+0x48/0x68 [drm]
> [  131.917532] [<ffff0000009a26f4>] drm_mode_atomic_ioctl+0x42c/0xa40 [drm]
> [  131.924324] [<ffff00000098d8e8>] drm_ioctl+0x188/0x458 [drm]
> [  131.929929] [<ffff0000081e75a0>] do_vfs_ioctl+0xb4/0x79c
> [  131.935186] [<ffff0000081e7d0c>] SyS_ioctl+0x84/0x98
> [  131.940101] [<ffff000008082f4c>] __sys_trace_return+0x0/0x4
> n:2124) igt-kms-CRITICAL: Last errno: 62, Timer expired
> ****  END  ****
> Subtest plane-all-transition-nonblocking-fencing: FAIL (2.151s)
> [  363.609017] INFO: task kworker/u12:4:1087 blocked for more than 120
> seconds.
> [  363.616021]       Tainted: G        W       4.9.0-rc8 #267
> [  363.621473] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
> disables this message.
> [  363.629237] kworker/u12:4   D    0  1087      2 0x00000000
> [  363.634770] Workqueue: events_unbound commit_work [drm_kms_helper]
> [  363.640903] Call trace:
> [  363.643328] [<ffff000008085550>] __switch_to+0x90/0xa4
> [  363.648431] [<ffff000008881ac8>] __schedule+0x178/0x564
> [  363.653618] [<ffff000008881ef0>] schedule+0x3c/0xa0
> [  363.658461] [<ffff000008884c34>] schedule_timeout+0x148/0x218
> [  363.664165] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
> [  363.670383] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
> [  363.676495] [<ffff000000bdb9b8>]
> drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
> [  363.685017] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
> [  363.691646] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
> [  363.698211] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
> [  363.703912] [<ffff0000080d346c>] worker_thread+0x58/0x434
> [  363.709269] [<ffff0000080d8f24>] kthread+0xd4/0xe8
> [  363.714024] [<ffff000008082e80>] ret_from_fork+0x10/0x50
> [  484.440951] INFO: task kworker/u12:4:1087 blocked for more than 120
> seconds.
> [  484.440957]       Tainted: G        W       4.9.0-rc8 #267
> [  484.440959] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
> disables this message.
> [  484.440966] kworker/u12:4   D    0  1087      2 0x00000000
> [  484.441059] Workqueue: events_unbound commit_work [drm_kms_helper]
> [  484.441060] Call trace:
> [  484.441072] [<ffff000008085550>] __switch_to+0x90/0xa4
> [  484.441080] [<ffff000008881ac8>] __schedule+0x178/0x564
> [  484.441085] [<ffff000008881ef0>] schedule+0x3c/0xa0
> [  484.441092] [<ffff000008884c34>] schedule_timeout+0x148/0x218
> [  484.441099] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
> [  484.441105] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
> [  484.441177] [<ffff000000bdb9b8>]
> drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
> [  484.441250] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
> [  484.441321] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
> [  484.441329] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
> [  484.441334] [<ffff0000080d346c>] worker_thread+0x58/0x434
> [  484.441339] [<ffff0000080d8f24>] kthread+0xd4/0xe8
> [  484.441344] [<ffff000008082e80>] ret_from_fork+0x10/0x50
> [  485.464997] [drm:drm_atomic_helper_swap_state [drm_kms_helper]]
> *ERROR* [CRTC:32:crtc-0] hw_done timed out
> [  495.704997] [drm:drm_atomic_helper_wait_for_dependencies
> [drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] hw_done timed out
> [  505.944998] [drm:drm_atomic_helper_wait_for_dependencies
> [drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] flip_done timed out
> [  506.391339] ------------[ cut here ]------------
> [  506.395909] kernel BUG at drivers/dma-buf/dma-fence.c:178!
> [  506.401337] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
> [  506.406763] Modules linked in: mali_dp tda998x drm_kms_helper drm
> ip_tables x_tables ipv6
> [  506.414894] CPU: 3 PID: 2124 Comm: kms_atomic_tran Tainted: G
> W       4.9.0-rc8 #267
> [  506.423158] Hardware name: ARM Juno development board (r0) (DT)
> [  506.429015] task: ffff800970ae0000 task.stack: ffff8009746c0000
> [  506.434879] PC is at dma_fence_release+0x44/0x48
> [  506.439448] LR is at sync_file_free+0x48/0x70
> [  506.443757] pc : [<ffff00000852e504>] lr : [<ffff00000852f7cc>]
> pstate: 80000145
> [  506.451074] sp : ffff8009746c3b70
> [  506.454349] x29: ffff8009746c3b70 x28: ffff8009746c0000
> [  506.459610] x27: 0000000000000001 x26: ffff000008d3728c
> [  506.464870] x25: ffff800975d10510 x24: ffff8009768d3b50
> [  506.470130] x23: ffff800976c3ec20 x22: ffff8009720c7e40
> [  506.475390] x21: ffff8009768d3b50 x20: 0000000000000010
> [  506.480650] x19: ffff80096f61f100 x18: 0000000000000000
> [  506.485909] x17: 4000000000000000 x16: ffffffffffffffff
> [  506.491170] x15: 0000000000000040 x14: dead000000000100
> [  506.496430] x13: dead000000000200 x12: 00000000ffffffff
> [  506.501690] x11: 0000000000000068 x10: ffff800975f18700
> [  506.506950] x9 : 0000000040000000 x8 : 0000000000210d00
> [  506.512210] x7 : ffff800970ae0678 x6 : 0000000000000000
> [  506.517470] x5 : 0000000000000000 x4 : 0000000000000000
> [  506.522730] x3 : ffff800976753ce0 x2 : ffff80096f61f2a0
> [  506.527989] x1 : 0000000000000000 x0 : ffff80096f61f280
> [  506.533248]
> [  506.534719] Process kms_atomic_tran (pid: 2124, stack limit =
> 0xffff8009746c0020)
> [  506.542124] Stack: (0xffff8009746c3b70 to 0xffff8009746c4000)
> [  506.547810] 3b60:                                   ffff8009746c3b80
> ffff00000852f7cc
> [  506.555561] 3b80: ffff8009746c3ba0 ffff00000852f824 ffff800975d10500
> ffff8009768d3b50
> [  506.563311] 3ba0: ffff8009746c3bb0 ffff0000081d6b24 ffff8009746c3c00
> ffff0000081d6cc0
> [  506.571062] 3bc0: ffff80097479bf00 ffff800970ae0678 ffff800970ae0000
> ffff800970ae06ac
> [  506.578813] 3be0: ffff000008e0f000 ffff800975f18768 0000000008430000
> ffff0000080da458
> [  506.586564] 3c00: ffff8009746c3c10 ffff0000080d72d4 ffff8009746c3c50
> ffff0000080c016c
> [  506.594314] 3c20: ffff800970ae0000 ffff8009746c3cb0 0000000000000001
> ffff800970ac0000
> [  506.602065] 3c40: ffff000008d35000 ffff0000080c0168 ffff8009746c3cc0
> ffff0000080c088c
> [  506.609815] 3c60: ffff800970ac0000 0000000000000002 ffff8009746c0000
> ffff800970ac0000
> [  506.617566] 3c80: ffff800974608000 ffff8009746c3de8 0000000008430000
> ffff000008d3728c
> [  506.625316] 3ca0: 0000000000000001 ffff8009746c0000 ffff8009746c3cf0
> ffff0000080ca3dc
> [  506.633067] 3cc0: ffff8009746c3cf0 ffff0000080ca514 ffff8009746c0000
> ffff8009746c3e08
> [  506.640818] 3ce0: ffff800974608808 ffff800970ac0000 ffff8009746c3d70
> ffff000008087850
> [  506.648568] 3d00: 0000000000000201 ffff8009746c3de8 ffff8009746c0000
> ffff8009746c3ec0
> [  506.656319] 3d20: 0000000000000000 ffff8009746c3ec0 0000000000000123
> 000000000000008b
> [  506.664069] 3d40: ffff000008892000 ffff8009746c0000 0000000000000000
> 0000000000000000
> [  506.671820] 3d60: 5555000000004100 ffff000008b04a20 ffff8009746c3e90
> ffff000008087e2c
> [  506.679570] 3d80: 0000000000000201 ffff8009746c0000 ffff8009746c0000
> ffff8009746c3ec0
> [  506.687320] 3da0: 0000000000000000 0000000000000015 0000000000000123
> 000000000000008b
> [  506.695071] 3dc0: ffff000008892000 ffff8009746c0000 0000000000000000
> 0000000000000000
> [  506.702821] 3de0: ffff8009746c3e20 ffff0000081decc4 ffff8009746c3e40
> ffff0000081472d0
> [  506.710572] 3e00: ffff8009748fa800 0000000000000002 00000000fffffffa
> 000000000000084c
> [  506.718322] 3e20: 0000000000000000 0000000000000000 0000000000000000
> 0000000000000000
> [  506.726072] 3e40: 0000000000000000 0000000000000000 0000000000000000
> 0000000000000000
> [  506.733822] 3e60: 0000000000000000 0000000000000000 0000000000000000
> 0000000000000000
> [  506.741572] 3e80: 0000000000000000 ffff000008082f58 0000000000000000
> ffff000008082ddc
> [  506.749323] 3ea0: 0000000000000200 0000ffffeac382b8 ffffffffffffffff
> 0000ffffa625d6c8
> [  506.757073] 3ec0: 0000000000000003 00000000c03864bc 0000ffffeac382b8
> 0000000000000011
> [  506.764823] 3ee0: 0000000022d216a0 0000000000000005 0000000000000022
> 0000000022d213b0
> [  506.772573] 3f00: 000000000000001d 0000000000000000 0000001000000020
> 0000ffffeac38400
> [  506.780323] 3f20: 0000001300000020 0000000000000000 0000000000000000
> 0000000000000000
> [  506.788074] 3f40: 0000ffffa6230278 0000ffffa5f64b00 0000000000000000
> 0000000022d216c0
> [  506.795824] 3f60: 0000ffffeac382b8 00000000c03864bc 0000000000000003
> 0000000022d1d410
> [  506.803575] 3f80: 0000000000000022 0000000022d216e0 0000000022d217b0
> 0000000022d1c7e0
> [  506.811325] 3fa0: 0000000000000010 0000ffffeac38220 0000ffffa621797c
> 0000ffffeac38220
> [  506.819075] 3fc0: 0000ffffa5f64b08 0000000060000000 0000000000000000
> ffffffffffffffff
> [  506.826825] 3fe0: 0000000000000000 0000000000000000 0000000000000000
> 0000000000000000
> [  506.834572] Call trace:
> [  506.836990] Exception stack(0xffff8009746c39a0 to 0xffff8009746c3ad0)
> [  506.843365] 39a0: ffff80096f61f100 0001000000000000 ffff8009746c3b70
> ffff00000852e504
> [  506.851115] 39c0: ffff8009746c0000 0000000180170016 0000000100170017
> ffff7e0025dbbf80
> [  506.858866] 39e0: ffff8009746c3b00 ffff0000081bb910 ffff80096ec34800
> ffff8009746c0000
> [  506.866617] 3a00: ffff00000819826c ffff7e0025d39500 ffff8009746c3b30
> ffff0000081bbe50
> [  506.874367] 3a20: ffff7e0025bd87c0 ffff8009746c0000 0000000000158143
> ffff80096f61f580
> [  506.882118] 3a40: ffff80096f61f280 0000000000000000 ffff80096f61f2a0
> ffff800976753ce0
> [  506.889867] 3a60: 0000000000000000 0000000000000000 0000000000000000
> ffff800970ae0678
> [  506.897618] 3a80: 0000000000210d00 0000000040000000 ffff800975f18700
> 0000000000000068
> [  506.905368] 3aa0: 00000000ffffffff dead000000000200 dead000000000100
> 0000000000000040
> [  506.913117] 3ac0: ffffffffffffffff 4000000000000000
> [  506.917945] [<ffff00000852e504>] dma_fence_release+0x44/0x48
> [  506.923546] [<ffff00000852f7cc>] sync_file_free+0x48/0x70
> [  506.928888] [<ffff00000852f824>] sync_file_release+0x30/0x3c
> [  506.934490] [<ffff0000081d6b24>] __fput+0x94/0x1d8
> [  506.939229] [<ffff0000081d6cc0>] ____fput+0xc/0x14
> [  506.943972] [<ffff0000080d72d4>] task_work_run+0xc4/0xe4
> [  506.949230] [<ffff0000080c016c>] do_exit+0x2d0/0x980
> [  506.954143] [<ffff0000080c088c>] do_group_exit+0x40/0x9c
> [  506.959401] [<ffff0000080ca514>] get_signal+0x1e8/0x4f0
> [  506.964573] [<ffff000008087850>] do_signal+0x198/0x554
> [  506.969657] [<ffff000008087e2c>] do_notify_resume+0x88/0xa4
> [  506.975171] [<ffff000008082ddc>] work_pending+0x8/0x10
> [  506.980257] Code: 8b010000 97ef7a27 a8c17bfd d65f03c0 (d4210000)
> [  506.988726] ---[ end trace f3a899d81ca41343 ]---
> [  506.993312] Fixing recursive fault but reboot is needed!
>
> Thanks,
> Brian
>>     igt_subtest("plane-all-modeset-transition")
>>         for_each_pipe_with_valid_output(&display, pipe, output)
>>             run_transition_test(&display, pipe, output,
>> TRANSITION_MODESET, false, false);
>>
>> +    igt_subtest("plane-all-modeset-transition-fencing")
>> +        for_each_pipe_with_valid_output(&display, pipe, output)
>> +            run_transition_test(&display, pipe, output,
>> TRANSITION_MODESET, false, true);
>> +
>>     igt_subtest("plane-toggle-modeset-transition")
>>         for_each_pipe_with_valid_output(&display, pipe, output)
>>             run_transition_test(&display, pipe, output,
>> TRANSITION_MODESET_DISABLE, false, false);
>> --
>> 2.11.0
>>
Brian Starkey Dec. 16, 2016, 7:06 p.m. UTC | #3
On Fri, Dec 16, 2016 at 03:59:00AM -0500, Robert Foss wrote:
>
>
>On 2016-12-14 11:57 AM, Brian Starkey wrote:
>>On Wed, Dec 14, 2016 at 04:05:07AM -0500, Robert Foss wrote:
>>>From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>
>>>Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>>Signed-off-by: Robert Foss <robert.foss@collabora.com>
>>>---
>>>lib/igt_kms.c                 | 22 ++++++++++++++++++++++
>>>tests/kms_atomic_transition.c | 32 ++++++++++++++++++++++++++++++--
>>>2 files changed, 52 insertions(+), 2 deletions(-)
>>>
>>>diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>>>index fe1b356d..eb59ab36 100644
>>>--- a/lib/igt_kms.c
>>>+++ b/lib/igt_kms.c
>>>@@ -49,6 +49,7 @@
>>>#include "intel_chipset.h"
>>>#include "igt_debugfs.h"
>>>#include "igt_sysfs.h"
>>>+#include "sw_sync.h"
>>>
>>>/**
>>> * SECTION:igt_kms
>>>@@ -2184,6 +2185,27 @@ static int igt_atomic_commit(igt_display_t
>>>*display, uint32_t flags, void *user_
>>>    }
>>>
>>>    ret = drmModeAtomicCommit(display->drm_fd, req, flags, user_data);
>>>+    if (!ret) {
>>>+        int64_t *fence_ptr;
>>>+
>>>+        for_each_pipe(display, pipe) {
>>>+            igt_pipe_t *pipe_obj = &display->pipes[pipe];
>>>+
>>>+            fence_ptr = pipe_obj->out_fence_ptr;
>>>+            if (!fence_ptr)
>>>+                continue;
>>>+
>>>+            if (flags & DRM_MODE_ATOMIC_TEST_ONLY) {
>>>+                igt_assert(*fence_ptr == -1);
>>>+            } else {
>>>+                igt_assert(*fence_ptr >= 0);
>>>+                ret = sw_sync_wait(*fence_ptr, 1000);
>>>+                igt_assert(ret == 0);
>>>+                close(*fence_ptr);
>>>+            }
>>>+        }
>>>+    }
>>>+
>>>    drmModeAtomicFree(req);
>>>    return ret;
>>>
>>>diff --git a/tests/kms_atomic_transition.c
>>>b/tests/kms_atomic_transition.c
>>>index b7d99975..08f9499f 100644
>>>--- a/tests/kms_atomic_transition.c
>>>+++ b/tests/kms_atomic_transition.c
>>>@@ -132,6 +132,7 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>    struct plane_parms parms[IGT_MAX_PLANES];
>>>    bool skip_test = false;
>>>    unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
>>>+    int out_fence, ret;
>>
>>out_fence needs to be 64-bit.
>
>Ack, fixed in v3.
>
>>
>>>
>>>    if (nonblocking)
>>>        flags |= DRM_MODE_ATOMIC_NONBLOCK;
>>>@@ -198,9 +199,11 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>     * planes to fix this
>>>     */
>>>    while (1) {
>>>-        int ret;
>>>-
>>>        wm_setup_plane(display, pipe, iter_max - 1, parms);
>>>+
>>>+        if (fencing)
>>>+            igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>>>+                (int64_t *) &out_fence);
>>>        ret = igt_display_try_commit_atomic(display,
>>>DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
>>>
>>>        if (ret != -EINVAL || n_planes < 3)
>>>@@ -231,6 +234,9 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>
>>>        wm_setup_plane(display, pipe, i, parms);
>>>
>>>+        if (fencing)
>>>+            igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>>>&out_fence);
>>>+
>>>        igt_display_commit_atomic(display, flags, (void *)(unsigned
>>>long)i);
>>>        drmHandleEvent(display->drm_fd, &drm_events);
>>>
>>>@@ -239,6 +245,10 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>
>>>            wm_setup_plane(display, pipe, 0, parms);
>>>
>>>+            if (fencing)
>>>+                igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>>>+                    (int64_t *) &out_fence);
>>>+
>>>            igt_display_commit_atomic(display, flags, (void *)0UL);
>>>
>>>            drmHandleEvent(display->drm_fd, &drm_events);
>>>@@ -252,6 +262,9 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>                if (type == TRANSITION_MODESET)
>>>                    igt_output_override_mode(output, &override_mode);
>>>
>>>+                if (fencing)
>>>+                    igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>>>&out_fence);
>>>+
>>>                igt_display_commit_atomic(display, flags, (void
>>>*)(unsigned long)j);
>>>                drmHandleEvent(display->drm_fd, &drm_events);
>>>
>>>@@ -259,6 +272,9 @@ run_transition_test(igt_display_t *display, enum
>>>pipe pipe, igt_output_t *output
>>>                if (type == TRANSITION_MODESET)
>>>                    igt_output_override_mode(output, NULL);
>>>
>>>+                if (fencing)
>>>+                    igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
>>>&out_fence);
>>>+
>>>                igt_display_commit_atomic(display, flags, (void
>>>*)(unsigned long)i);
>>>                drmHandleEvent(display->drm_fd, &drm_events);
>>>            }
>>>@@ -588,14 +604,26 @@ igt_main
>>>        for_each_pipe_with_valid_output(&display, pipe, output)
>>>            run_transition_test(&display, pipe, output,
>>>TRANSITION_PLANES, false, false);
>>>
>>>+    igt_subtest("plane-all-transition-fencing")
>>>+        for_each_pipe_with_valid_output(&display, pipe, output)
>>>+            run_transition_test(&display, pipe, output,
>>>TRANSITION_PLANES, false, true);
>>>+
>>>    igt_subtest("plane-all-transition-nonblocking")
>>>        for_each_pipe_with_valid_output(&display, pipe, output)
>>>            run_transition_test(&display, pipe, output,
>>>TRANSITION_PLANES, true, false);
>>>
>>>+    igt_subtest("plane-all-transition-nonblocking-fencing")
>>>+        for_each_pipe_with_valid_output(&display, pipe, output)
>>>+            run_transition_test(&display, pipe, output,
>>>TRANSITION_PLANES, true, true);
>>>+
>>
>>This test makes my kernel very unhappy running on drm-next on mali-dp.
>>Any ideas?
>
>Hmm. I haven't seen anything like this.
>I did my testing on drm-misc/drm-misc-next, unfortunately I don't 
>have any access to mali hardware of any kind :/
>

Yeah fair enough. I'll see if I can figure any more out when I'm back
in the office in January.

-Brian

>Rob.
>
>>
>>WARN -> Stall -> BUG:
>>
>>[  131.657643] WARNING: CPU: 0 PID: 2124 at
>>drivers/gpu/drm/drm_atomic_helper.c:1041
>>drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
>>[  131.670293] Modules linked in: mali_dp tda998x drm_kms_helper drm
>>ip_tables x_tables ipv6
>>[  131.678416]
>>[  131.679890] CPU: 0 PID: 2124 Comm: kms_atomic_tran Not tainted
>>4.9.0-rc8 #267
>>[  131.686950] Hardware name: ARM Juno development board (r0) (DT)
>>[  131.692806] task: ffff800970ae0000 task.stack: ffff8009746c0000
>>[  131.698732] PC is at drm_atomic_helper_wait_for_fences+0xcc/0xd4
>>[drm_kms_helper]
>>[  131.706206] LR is at drm_atomic_helper_commit+0x7c/0x11c
>>[drm_kms_helper]
>>[  131.712923] pc : [<ffff000000bdba1c>] lr : [<ffff000000bde958>]
>>pstate: 20000145
>>[  131.720241] sp : ffff8009746c3b40
>>[  131.723516] x29: ffff8009746c3b40 x28: ffff80096fd40c00
>>[  131.728778] x27: 0000000022d216e0 x26: ffff80096fd40a80
>>[  131.734039] x25: 0000000000000018 x24: 0000000000000001
>>[  131.739300] x23: ffff80096fd40a80 x22: 0000000000000001
>>[  131.744561] x21: ffff80096fd40c00 x20: 0000000000000000
>>[  131.749823] x19: ffff80096fd40b00 x18: 0000000000000000
>>[  131.755084] x17: 0000ffffa5f64b00 x16: ffff0000081e7c88
>>[  131.760344] x15: 0000000000000000 x14: 0000000000000000
>>[  131.765605] x13: 0000000000000007 x12: 000000000000ca35
>>[  131.770865] x11: 0000000000000006 x10: 000000000000ca35
>>[  131.776126] x9 : 0000000000000000 x8 : ffff80097479f500
>>[  131.781387] x7 : 0000000000000000 x6 : 000000000000003f
>>[  131.786647] x5 : ffff80096fd40648 x4 : 0000000000000000
>>[  131.791908] x3 : ffff80096fd40600 x2 : 0000000000000001
>>[  131.797168] x1 : 0000000000000000 x0 : ffff80096f61f280
>>[  131.802429]
>>[  131.803898] ---[ end trace f3a899d81ca41342 ]---
>>[  131.808464] Call trace:
>>[  131.810882] Exception stack(0xffff8009746c3970 to 0xffff8009746c3aa0)
>>[  131.817256] 3960:                                   ffff80096fd40b00
>>0001000000000000
>>[  131.825008] 3980: ffff8009746c3b40 ffff000000bdba1c ffff8009746c3a30
>>ffff0000080fe1e4
>>[  131.832759] 39a0: ffff0000009c3038 ffff80097085b800 0000000000000001
>>ffff8009746c3d70
>>[  131.840509] 39c0: ffff80096fd40a80 0000000000000001 0000000000000018
>>ffff80096fd40a80
>>[  131.848260] 39e0: 0000000022d216e0 ffff80096fd40c00 ffff80097085c038
>>0000000000000000
>>[  131.856010] 3a00: ffff000008e15130 0000000000000140 ffff80096f61f280
>>0000000000000000
>>[  131.863761] 3a20: 0000000000000001 ffff80096fd40600 0000000000000000
>>ffff80096fd40648
>>[  131.871511] 3a40: 000000000000003f 0000000000000000 ffff80097479f500
>>0000000000000000
>>[  131.879262] 3a60: 000000000000ca35 0000000000000006 000000000000ca35
>>0000000000000007
>>[  131.887012] 3a80: 0000000000000000 0000000000000000 ffff0000081e7c88
>>0000ffffa5f64b00
>>[  131.894830] [<ffff000000bdba1c>]
>>drm_atomic_helper_wait_for_fences+0xcc/0xd4 [drm_kms_helper]
>>[  131.903338] [<ffff000000bde958>] drm_atomic_helper_commit+0x7c/0x11c
>>[drm_kms_helper]
>>[  131.911252] [<ffff0000009a10a8>] drm_atomic_commit+0x48/0x68 [drm]
>>[  131.917532] [<ffff0000009a26f4>] drm_mode_atomic_ioctl+0x42c/0xa40 [drm]
>>[  131.924324] [<ffff00000098d8e8>] drm_ioctl+0x188/0x458 [drm]
>>[  131.929929] [<ffff0000081e75a0>] do_vfs_ioctl+0xb4/0x79c
>>[  131.935186] [<ffff0000081e7d0c>] SyS_ioctl+0x84/0x98
>>[  131.940101] [<ffff000008082f4c>] __sys_trace_return+0x0/0x4
>>n:2124) igt-kms-CRITICAL: Last errno: 62, Timer expired
>>****  END  ****
>>Subtest plane-all-transition-nonblocking-fencing: FAIL (2.151s)
>>[  363.609017] INFO: task kworker/u12:4:1087 blocked for more than 120
>>seconds.
>>[  363.616021]       Tainted: G        W       4.9.0-rc8 #267
>>[  363.621473] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
>>disables this message.
>>[  363.629237] kworker/u12:4   D    0  1087      2 0x00000000
>>[  363.634770] Workqueue: events_unbound commit_work [drm_kms_helper]
>>[  363.640903] Call trace:
>>[  363.643328] [<ffff000008085550>] __switch_to+0x90/0xa4
>>[  363.648431] [<ffff000008881ac8>] __schedule+0x178/0x564
>>[  363.653618] [<ffff000008881ef0>] schedule+0x3c/0xa0
>>[  363.658461] [<ffff000008884c34>] schedule_timeout+0x148/0x218
>>[  363.664165] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
>>[  363.670383] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
>>[  363.676495] [<ffff000000bdb9b8>]
>>drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
>>[  363.685017] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
>>[  363.691646] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
>>[  363.698211] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
>>[  363.703912] [<ffff0000080d346c>] worker_thread+0x58/0x434
>>[  363.709269] [<ffff0000080d8f24>] kthread+0xd4/0xe8
>>[  363.714024] [<ffff000008082e80>] ret_from_fork+0x10/0x50
>>[  484.440951] INFO: task kworker/u12:4:1087 blocked for more than 120
>>seconds.
>>[  484.440957]       Tainted: G        W       4.9.0-rc8 #267
>>[  484.440959] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
>>disables this message.
>>[  484.440966] kworker/u12:4   D    0  1087      2 0x00000000
>>[  484.441059] Workqueue: events_unbound commit_work [drm_kms_helper]
>>[  484.441060] Call trace:
>>[  484.441072] [<ffff000008085550>] __switch_to+0x90/0xa4
>>[  484.441080] [<ffff000008881ac8>] __schedule+0x178/0x564
>>[  484.441085] [<ffff000008881ef0>] schedule+0x3c/0xa0
>>[  484.441092] [<ffff000008884c34>] schedule_timeout+0x148/0x218
>>[  484.441099] [<ffff00000852dfb8>] dma_fence_default_wait+0x1cc/0x20c
>>[  484.441105] [<ffff00000852db38>] dma_fence_wait_timeout+0x1c/0x34
>>[  484.441177] [<ffff000000bdb9b8>]
>>drm_atomic_helper_wait_for_fences+0x68/0xd4 [drm_kms_helper]
>>[  484.441250] [<ffff000000bde868>] commit_tail+0x28/0x84 [drm_kms_helper]
>>[  484.441321] [<ffff000000bde8d4>] commit_work+0x10/0x18 [drm_kms_helper]
>>[  484.441329] [<ffff0000080d3258>] process_one_work+0x128/0x2e4
>>[  484.441334] [<ffff0000080d346c>] worker_thread+0x58/0x434
>>[  484.441339] [<ffff0000080d8f24>] kthread+0xd4/0xe8
>>[  484.441344] [<ffff000008082e80>] ret_from_fork+0x10/0x50
>>[  485.464997] [drm:drm_atomic_helper_swap_state [drm_kms_helper]]
>>*ERROR* [CRTC:32:crtc-0] hw_done timed out
>>[  495.704997] [drm:drm_atomic_helper_wait_for_dependencies
>>[drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] hw_done timed out
>>[  505.944998] [drm:drm_atomic_helper_wait_for_dependencies
>>[drm_kms_helper]] *ERROR* [CRTC:32:crtc-0] flip_done timed out
>>[  506.391339] ------------[ cut here ]------------
>>[  506.395909] kernel BUG at drivers/dma-buf/dma-fence.c:178!
>>[  506.401337] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP
>>[  506.406763] Modules linked in: mali_dp tda998x drm_kms_helper drm
>>ip_tables x_tables ipv6
>>[  506.414894] CPU: 3 PID: 2124 Comm: kms_atomic_tran Tainted: G
>>W       4.9.0-rc8 #267
>>[  506.423158] Hardware name: ARM Juno development board (r0) (DT)
>>[  506.429015] task: ffff800970ae0000 task.stack: ffff8009746c0000
>>[  506.434879] PC is at dma_fence_release+0x44/0x48
>>[  506.439448] LR is at sync_file_free+0x48/0x70
>>[  506.443757] pc : [<ffff00000852e504>] lr : [<ffff00000852f7cc>]
>>pstate: 80000145
>>[  506.451074] sp : ffff8009746c3b70
>>[  506.454349] x29: ffff8009746c3b70 x28: ffff8009746c0000
>>[  506.459610] x27: 0000000000000001 x26: ffff000008d3728c
>>[  506.464870] x25: ffff800975d10510 x24: ffff8009768d3b50
>>[  506.470130] x23: ffff800976c3ec20 x22: ffff8009720c7e40
>>[  506.475390] x21: ffff8009768d3b50 x20: 0000000000000010
>>[  506.480650] x19: ffff80096f61f100 x18: 0000000000000000
>>[  506.485909] x17: 4000000000000000 x16: ffffffffffffffff
>>[  506.491170] x15: 0000000000000040 x14: dead000000000100
>>[  506.496430] x13: dead000000000200 x12: 00000000ffffffff
>>[  506.501690] x11: 0000000000000068 x10: ffff800975f18700
>>[  506.506950] x9 : 0000000040000000 x8 : 0000000000210d00
>>[  506.512210] x7 : ffff800970ae0678 x6 : 0000000000000000
>>[  506.517470] x5 : 0000000000000000 x4 : 0000000000000000
>>[  506.522730] x3 : ffff800976753ce0 x2 : ffff80096f61f2a0
>>[  506.527989] x1 : 0000000000000000 x0 : ffff80096f61f280
>>[  506.533248]
>>[  506.534719] Process kms_atomic_tran (pid: 2124, stack limit =
>>0xffff8009746c0020)
>>[  506.542124] Stack: (0xffff8009746c3b70 to 0xffff8009746c4000)
>>[  506.547810] 3b60:                                   ffff8009746c3b80
>>ffff00000852f7cc
>>[  506.555561] 3b80: ffff8009746c3ba0 ffff00000852f824 ffff800975d10500
>>ffff8009768d3b50
>>[  506.563311] 3ba0: ffff8009746c3bb0 ffff0000081d6b24 ffff8009746c3c00
>>ffff0000081d6cc0
>>[  506.571062] 3bc0: ffff80097479bf00 ffff800970ae0678 ffff800970ae0000
>>ffff800970ae06ac
>>[  506.578813] 3be0: ffff000008e0f000 ffff800975f18768 0000000008430000
>>ffff0000080da458
>>[  506.586564] 3c00: ffff8009746c3c10 ffff0000080d72d4 ffff8009746c3c50
>>ffff0000080c016c
>>[  506.594314] 3c20: ffff800970ae0000 ffff8009746c3cb0 0000000000000001
>>ffff800970ac0000
>>[  506.602065] 3c40: ffff000008d35000 ffff0000080c0168 ffff8009746c3cc0
>>ffff0000080c088c
>>[  506.609815] 3c60: ffff800970ac0000 0000000000000002 ffff8009746c0000
>>ffff800970ac0000
>>[  506.617566] 3c80: ffff800974608000 ffff8009746c3de8 0000000008430000
>>ffff000008d3728c
>>[  506.625316] 3ca0: 0000000000000001 ffff8009746c0000 ffff8009746c3cf0
>>ffff0000080ca3dc
>>[  506.633067] 3cc0: ffff8009746c3cf0 ffff0000080ca514 ffff8009746c0000
>>ffff8009746c3e08
>>[  506.640818] 3ce0: ffff800974608808 ffff800970ac0000 ffff8009746c3d70
>>ffff000008087850
>>[  506.648568] 3d00: 0000000000000201 ffff8009746c3de8 ffff8009746c0000
>>ffff8009746c3ec0
>>[  506.656319] 3d20: 0000000000000000 ffff8009746c3ec0 0000000000000123
>>000000000000008b
>>[  506.664069] 3d40: ffff000008892000 ffff8009746c0000 0000000000000000
>>0000000000000000
>>[  506.671820] 3d60: 5555000000004100 ffff000008b04a20 ffff8009746c3e90
>>ffff000008087e2c
>>[  506.679570] 3d80: 0000000000000201 ffff8009746c0000 ffff8009746c0000
>>ffff8009746c3ec0
>>[  506.687320] 3da0: 0000000000000000 0000000000000015 0000000000000123
>>000000000000008b
>>[  506.695071] 3dc0: ffff000008892000 ffff8009746c0000 0000000000000000
>>0000000000000000
>>[  506.702821] 3de0: ffff8009746c3e20 ffff0000081decc4 ffff8009746c3e40
>>ffff0000081472d0
>>[  506.710572] 3e00: ffff8009748fa800 0000000000000002 00000000fffffffa
>>000000000000084c
>>[  506.718322] 3e20: 0000000000000000 0000000000000000 0000000000000000
>>0000000000000000
>>[  506.726072] 3e40: 0000000000000000 0000000000000000 0000000000000000
>>0000000000000000
>>[  506.733822] 3e60: 0000000000000000 0000000000000000 0000000000000000
>>0000000000000000
>>[  506.741572] 3e80: 0000000000000000 ffff000008082f58 0000000000000000
>>ffff000008082ddc
>>[  506.749323] 3ea0: 0000000000000200 0000ffffeac382b8 ffffffffffffffff
>>0000ffffa625d6c8
>>[  506.757073] 3ec0: 0000000000000003 00000000c03864bc 0000ffffeac382b8
>>0000000000000011
>>[  506.764823] 3ee0: 0000000022d216a0 0000000000000005 0000000000000022
>>0000000022d213b0
>>[  506.772573] 3f00: 000000000000001d 0000000000000000 0000001000000020
>>0000ffffeac38400
>>[  506.780323] 3f20: 0000001300000020 0000000000000000 0000000000000000
>>0000000000000000
>>[  506.788074] 3f40: 0000ffffa6230278 0000ffffa5f64b00 0000000000000000
>>0000000022d216c0
>>[  506.795824] 3f60: 0000ffffeac382b8 00000000c03864bc 0000000000000003
>>0000000022d1d410
>>[  506.803575] 3f80: 0000000000000022 0000000022d216e0 0000000022d217b0
>>0000000022d1c7e0
>>[  506.811325] 3fa0: 0000000000000010 0000ffffeac38220 0000ffffa621797c
>>0000ffffeac38220
>>[  506.819075] 3fc0: 0000ffffa5f64b08 0000000060000000 0000000000000000
>>ffffffffffffffff
>>[  506.826825] 3fe0: 0000000000000000 0000000000000000 0000000000000000
>>0000000000000000
>>[  506.834572] Call trace:
>>[  506.836990] Exception stack(0xffff8009746c39a0 to 0xffff8009746c3ad0)
>>[  506.843365] 39a0: ffff80096f61f100 0001000000000000 ffff8009746c3b70
>>ffff00000852e504
>>[  506.851115] 39c0: ffff8009746c0000 0000000180170016 0000000100170017
>>ffff7e0025dbbf80
>>[  506.858866] 39e0: ffff8009746c3b00 ffff0000081bb910 ffff80096ec34800
>>ffff8009746c0000
>>[  506.866617] 3a00: ffff00000819826c ffff7e0025d39500 ffff8009746c3b30
>>ffff0000081bbe50
>>[  506.874367] 3a20: ffff7e0025bd87c0 ffff8009746c0000 0000000000158143
>>ffff80096f61f580
>>[  506.882118] 3a40: ffff80096f61f280 0000000000000000 ffff80096f61f2a0
>>ffff800976753ce0
>>[  506.889867] 3a60: 0000000000000000 0000000000000000 0000000000000000
>>ffff800970ae0678
>>[  506.897618] 3a80: 0000000000210d00 0000000040000000 ffff800975f18700
>>0000000000000068
>>[  506.905368] 3aa0: 00000000ffffffff dead000000000200 dead000000000100
>>0000000000000040
>>[  506.913117] 3ac0: ffffffffffffffff 4000000000000000
>>[  506.917945] [<ffff00000852e504>] dma_fence_release+0x44/0x48
>>[  506.923546] [<ffff00000852f7cc>] sync_file_free+0x48/0x70
>>[  506.928888] [<ffff00000852f824>] sync_file_release+0x30/0x3c
>>[  506.934490] [<ffff0000081d6b24>] __fput+0x94/0x1d8
>>[  506.939229] [<ffff0000081d6cc0>] ____fput+0xc/0x14
>>[  506.943972] [<ffff0000080d72d4>] task_work_run+0xc4/0xe4
>>[  506.949230] [<ffff0000080c016c>] do_exit+0x2d0/0x980
>>[  506.954143] [<ffff0000080c088c>] do_group_exit+0x40/0x9c
>>[  506.959401] [<ffff0000080ca514>] get_signal+0x1e8/0x4f0
>>[  506.964573] [<ffff000008087850>] do_signal+0x198/0x554
>>[  506.969657] [<ffff000008087e2c>] do_notify_resume+0x88/0xa4
>>[  506.975171] [<ffff000008082ddc>] work_pending+0x8/0x10
>>[  506.980257] Code: 8b010000 97ef7a27 a8c17bfd d65f03c0 (d4210000)
>>[  506.988726] ---[ end trace f3a899d81ca41343 ]---
>>[  506.993312] Fixing recursive fault but reboot is needed!
>>
>>Thanks,
>>Brian
>>>    igt_subtest("plane-all-modeset-transition")
>>>        for_each_pipe_with_valid_output(&display, pipe, output)
>>>            run_transition_test(&display, pipe, output,
>>>TRANSITION_MODESET, false, false);
>>>
>>>+    igt_subtest("plane-all-modeset-transition-fencing")
>>>+        for_each_pipe_with_valid_output(&display, pipe, output)
>>>+            run_transition_test(&display, pipe, output,
>>>TRANSITION_MODESET, false, true);
>>>+
>>>    igt_subtest("plane-toggle-modeset-transition")
>>>        for_each_pipe_with_valid_output(&display, pipe, output)
>>>            run_transition_test(&display, pipe, output,
>>>TRANSITION_MODESET_DISABLE, false, false);
>>>--
>>>2.11.0
>>>
diff mbox

Patch

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index fe1b356d..eb59ab36 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -49,6 +49,7 @@ 
 #include "intel_chipset.h"
 #include "igt_debugfs.h"
 #include "igt_sysfs.h"
+#include "sw_sync.h"
 
 /**
  * SECTION:igt_kms
@@ -2184,6 +2185,27 @@  static int igt_atomic_commit(igt_display_t *display, uint32_t flags, void *user_
 	}
 
 	ret = drmModeAtomicCommit(display->drm_fd, req, flags, user_data);
+	if (!ret) {
+		int64_t *fence_ptr;
+
+		for_each_pipe(display, pipe) {
+			igt_pipe_t *pipe_obj = &display->pipes[pipe];
+
+			fence_ptr = pipe_obj->out_fence_ptr;
+			if (!fence_ptr)
+				continue;
+
+			if (flags & DRM_MODE_ATOMIC_TEST_ONLY) {
+				igt_assert(*fence_ptr == -1);
+			} else {
+				igt_assert(*fence_ptr >= 0);
+				ret = sw_sync_wait(*fence_ptr, 1000);
+				igt_assert(ret == 0);
+				close(*fence_ptr);
+			}
+		}
+	}
+
 	drmModeAtomicFree(req);
 	return ret;
 
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index b7d99975..08f9499f 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -132,6 +132,7 @@  run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	struct plane_parms parms[IGT_MAX_PLANES];
 	bool skip_test = false;
 	unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
+	int out_fence, ret;
 
 	if (nonblocking)
 		flags |= DRM_MODE_ATOMIC_NONBLOCK;
@@ -198,9 +199,11 @@  run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	 * planes to fix this
 	 */
 	while (1) {
-		int ret;
-
 		wm_setup_plane(display, pipe, iter_max - 1, parms);
+
+		if (fencing)
+			igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
+			    (int64_t *) &out_fence);
 		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 
 		if (ret != -EINVAL || n_planes < 3)
@@ -231,6 +234,9 @@  run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 
 		wm_setup_plane(display, pipe, i, parms);
 
+		if (fencing)
+			igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
+
 		igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
 		drmHandleEvent(display->drm_fd, &drm_events);
 
@@ -239,6 +245,10 @@  run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 
 			wm_setup_plane(display, pipe, 0, parms);
 
+			if (fencing)
+				igt_pipe_set_out_fence_ptr(&display->pipes[pipe],
+				    (int64_t *) &out_fence);
+
 			igt_display_commit_atomic(display, flags, (void *)0UL);
 
 			drmHandleEvent(display->drm_fd, &drm_events);
@@ -252,6 +262,9 @@  run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 				if (type == TRANSITION_MODESET)
 					igt_output_override_mode(output, &override_mode);
 
+				if (fencing)
+					igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
+
 				igt_display_commit_atomic(display, flags, (void *)(unsigned long)j);
 				drmHandleEvent(display->drm_fd, &drm_events);
 
@@ -259,6 +272,9 @@  run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 				if (type == TRANSITION_MODESET)
 					igt_output_override_mode(output, NULL);
 
+				if (fencing)
+					igt_pipe_set_out_fence_ptr(&display->pipes[pipe], &out_fence);
+
 				igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
 				drmHandleEvent(display->drm_fd, &drm_events);
 			}
@@ -588,14 +604,26 @@  igt_main
 		for_each_pipe_with_valid_output(&display, pipe, output)
 			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, false);
 
+	igt_subtest("plane-all-transition-fencing")
+		for_each_pipe_with_valid_output(&display, pipe, output)
+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, true);
+
 	igt_subtest("plane-all-transition-nonblocking")
 		for_each_pipe_with_valid_output(&display, pipe, output)
 			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, false);
 
+	igt_subtest("plane-all-transition-nonblocking-fencing")
+		for_each_pipe_with_valid_output(&display, pipe, output)
+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, true);
+
 	igt_subtest("plane-all-modeset-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
 			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, false);
 
+	igt_subtest("plane-all-modeset-transition-fencing")
+		for_each_pipe_with_valid_output(&display, pipe, output)
+			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, true);
+
 	igt_subtest("plane-toggle-modeset-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
 			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false, false);