From: Karthik B S <karthik.b.s@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: pranay.samala@intel.com, Karthik B S <karthik.b.s@intel.com>,
S Sebinraj <s.sebinraj@intel.com>,
Krzysztof Karas <krzysztof.karas@intel.com>
Subject: [PATCH i-g-t v2] tests/kms_explicit_fence: Rescue pending IN_FENCE waits on test failures
Date: Wed, 6 May 2026 14:44:42 +0530 [thread overview]
Message-ID: <20260506091442.2241511-1-karthik.b.s@intel.com> (raw)
Track per-plane timeline/fence state across the in-flight NONBLOCK atomic
commit and install an exit handler to signal any still-unsignaled fences.
This prevents cleanup hangs when an assertion fires after commit
submission but before the test signals the blocking fence.
V2:
- Drop the redundant 'active' variable
- Reset timelines[i] to -1 in signal_pending_fences()
Cc: S Sebinraj <s.sebinraj@intel.com>
Cc: Krzysztof Karas <krzysztof.karas@intel.com>
Signed-off-by: Karthik B S <karthik.b.s@intel.com>
Reviewed-by: S Sebinraj <s.sebinraj@intel.com>
---
tests/kms_explicit_fence.c | 44 ++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/tests/kms_explicit_fence.c b/tests/kms_explicit_fence.c
index 2ec9bf39d..930f5a970 100644
--- a/tests/kms_explicit_fence.c
+++ b/tests/kms_explicit_fence.c
@@ -68,6 +68,38 @@ typedef struct {
igt_pipe_crc_t *pipe_crc;
} data_t;
+/*
+ * State tracked across the lifetime of an in-flight atomic commit that has
+ * IN_FENCEs attached. The exit handler uses this to unblock any pending
+ * commit if an assert hits between the commit and the point where
+ * the test would otherwise signal the unsignaled fence(s).
+ */
+static struct {
+ int timelines[NUM_PLANES];
+ bool needs_signal[NUM_PLANES];
+} pending_fence_state = {
+ .timelines = { -1, -1, -1 },
+};
+
+static void signal_pending_fences(int sig)
+{
+ for (int i = 0; i < NUM_PLANES; i++) {
+ if (pending_fence_state.timelines[i] < 0)
+ continue;
+
+ if (pending_fence_state.needs_signal[i]) {
+ /*
+ * Best-effort: advance the timeline so the kernel
+ * stops waiting on this IN_FENCE.
+ */
+ sw_sync_timeline_inc(pending_fence_state.timelines[i], 1);
+ pending_fence_state.needs_signal[i] = false;
+ }
+
+ pending_fence_state.timelines[i] = -1;
+ }
+}
+
static void setup_output(data_t *data)
{
igt_display_t *display = &data->display;
@@ -242,6 +274,9 @@ static void multiplane_atomic_fence_wait(data_t *data)
/* Attach IN_FENCE_FD to plane */
igt_plane_set_fence_fd(planes[i], fences[i]);
+
+ pending_fence_state.timelines[i] = timelines[i];
+ pending_fence_state.needs_signal[i] = !should_signal[i];
}
/* Swap overlay colors to detect scanout changes via CRC */
@@ -299,6 +334,7 @@ static void multiplane_atomic_fence_wait(data_t *data)
igt_assert_crc_equal(&crc_before, &crc_after);
/* Now signal the blocking fence (overlay2) */
+ pending_fence_state.needs_signal[PLANE_OVERLAY2_IDX] = false;
sw_sync_timeline_inc(timelines[PLANE_OVERLAY2_IDX], 1);
/* Wait for overlay2 fence to be signaled */
@@ -353,6 +389,13 @@ int igt_main()
data.pipe_crc = igt_pipe_crc_new(data.drm_fd, data.crtc->crtc_index,
IGT_PIPE_CRC_SOURCE_AUTO);
+
+ /*
+ * Make sure that on a failure mid-test, any unsignalled
+ * IN_FENCE that the kernel is still waiting on gets
+ * signaled so cleanup can complete instead of hanging.
+ */
+ igt_install_exit_handler(signal_pending_fences);
}
igt_describe("Test atomic commit with 3 planes (1 primary, 2 overlay) "
@@ -363,6 +406,7 @@ int igt_main()
multiplane_atomic_fence_wait(&data);
igt_fixture() {
+ signal_pending_fences(0);
reset_display_state(&data);
igt_pipe_crc_free(data.pipe_crc);
cleanup_crtc(&data);
--
2.43.0
next reply other threads:[~2026-05-06 9:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 9:14 Karthik B S [this message]
2026-05-06 13:52 ` ✗ i915.CI.BAT: failure for tests/kms_explicit_fence: Rescue pending IN_FENCE waits on test failures (rev2) Patchwork
2026-05-06 13:54 ` ✓ Xe.CI.BAT: success " Patchwork
2026-05-06 15:15 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-05-07 6:02 ` [PATCH i-g-t v2] tests/kms_explicit_fence: Rescue pending IN_FENCE waits on test failures Krzysztof Karas
2026-05-08 4:39 ` ✓ i915.CI.BAT: success for tests/kms_explicit_fence: Rescue pending IN_FENCE waits on test failures (rev2) Patchwork
2026-05-08 23:20 ` ✗ i915.CI.Full: failure " Patchwork
2026-05-11 4:30 ` Karthik B S
2026-05-11 3:40 ` [PATCH i-g-t v2] tests/kms_explicit_fence: Rescue pending IN_FENCE waits on test failures Samala, Pranay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260506091442.2241511-1-karthik.b.s@intel.com \
--to=karthik.b.s@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=krzysztof.karas@intel.com \
--cc=pranay.samala@intel.com \
--cc=s.sebinraj@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox