Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2] tests/intel/gem_ctx_persistence: Wait for context termination
@ 2024-11-18 12:16 Krzysztof Niemiec
  2024-11-19  1:09 ` ✓ CI.xeBAT: success for tests/intel/gem_ctx_persistence: Wait for context termination (rev3) Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Krzysztof Niemiec @ 2024-11-18 12:16 UTC (permalink / raw)
  To: igt-dev; +Cc: Chris Wilson, Nirmoy Das, Krzysztof Niemiec

In some of the subtests, there is a race condition - if a non-persistent
context is not terminated by the driver before the associated spinner is
ended and probed for status, the status will be incorrectly reported as
completed.

Add a sleep instruction before the assert to give the kernel time to
clean up.

v2:
 - Update the patch description,
 - Change the previous expression to a simpler usleep(),
 - Add a usleep() call in test_saturated_hostile_all(), as this behavior
   is also shown in this subtest.

Signed-off-by: Krzysztof Niemiec <krzysztof.niemiec@intel.com>
---
 tests/intel/gem_ctx_persistence.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/intel/gem_ctx_persistence.c b/tests/intel/gem_ctx_persistence.c
index 974444cf1..d90b78267 100644
--- a/tests/intel/gem_ctx_persistence.c
+++ b/tests/intel/gem_ctx_persistence.c
@@ -1029,6 +1029,9 @@ test_saturated_hostile_all(int i915, const intel_ctx_t *base_ctx,
 	igt_spin_busywait_until_started(spin);
 	intel_ctx_destroy(i915, ctx);
 
+	/* Give the kernel some time to terminate the context */
+	usleep(reset_timeout_ms * 1000);
+
 	/* Hostile request requires a GPU reset to terminate */
 	igt_assert_eq(wait_for_status(spin->out_fence, reset_timeout_ms), -EIO);
 
@@ -1173,6 +1176,9 @@ static void __smoker(int i915, const intel_ctx_cfg_t *cfg,
 	drm_close_driver(fd);
 	flush_delayed_fput(i915);
 
+	/* Give the kernel some time to terminate the context */
+	usleep(reset_timeout_ms * 1000);
+
 	igt_spin_end(spin);
 
 	igt_assert_eq(wait_for_status(spin->out_fence, timeout), expected);
-- 
2.45.2


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

end of thread, other threads:[~2024-11-20  9:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-18 12:16 [PATCH i-g-t v2] tests/intel/gem_ctx_persistence: Wait for context termination Krzysztof Niemiec
2024-11-19  1:09 ` ✓ CI.xeBAT: success for tests/intel/gem_ctx_persistence: Wait for context termination (rev3) Patchwork
2024-11-19  1:20 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-11-20  9:56   ` Krzysztof Niemiec
2024-11-19 12:15 ` [PATCH i-g-t v2] tests/intel/gem_ctx_persistence: Wait for context termination Nirmoy Das
2024-11-19 12:25 ` ✗ CI.xeFULL: failure for tests/intel/gem_ctx_persistence: Wait for context termination (rev3) Patchwork
2024-11-20  9:58   ` Krzysztof Niemiec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox