Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t] tests/intel/xe_spin_batch: Check duration of preempter execution
@ 2024-06-21 11:53 Francois Dugast
  2024-06-21 12:36 ` ✓ CI.xeBAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Francois Dugast @ 2024-06-21 11:53 UTC (permalink / raw)
  To: igt-dev; +Cc: Francois Dugast

The preempter is expected to execute without waiting, in a short
time. The synchronous call takes roughly 1 ms under normal
conditions. This duration will be higher if the preempter is
waiting. For example if the priorities are reversed in this test
then this duration will be close to duration_ns (currently set
to 100 ms) which was undetected by the test without this change.

Signed-off-by: Francois Dugast <francois.dugast@intel.com>
---
 tests/intel/xe_spin_batch.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/intel/xe_spin_batch.c b/tests/intel/xe_spin_batch.c
index 4e95060d3..e57318801 100644
--- a/tests/intel/xe_spin_batch.c
+++ b/tests/intel/xe_spin_batch.c
@@ -253,7 +253,7 @@ static void xe_spin_fixed_duration(int fd, int gt, int class, int flags)
 	uint64_t ext = 0;
 	size_t bo_size;
 	struct xe_spin *spin;
-	struct timespec tv;
+	struct timespec tv, tv_preempter;
 	double elapsed_ms;
 	igt_stats_t stats;
 	int i;
@@ -289,9 +289,11 @@ static void xe_spin_fixed_duration(int fd, int gt, int class, int flags)
 		igt_gettime(&tv);
 		xe_exec(fd, &exec);
 		xe_spin_wait_started(spin);
-		if (flags & SPIN_FIX_DURATION_PREEMPT)
+		if (flags & SPIN_FIX_DURATION_PREEMPT) {
+			igt_gettime(&tv_preempter);
 			preempter(fd, hwe);
-
+			igt_assert(igt_nsec_elapsed(&tv_preempter) * 1e-6 < 10);
+		}
 		igt_assert(syncobj_wait(fd, &sync.handle, 1, INT64_MAX, 0, NULL));
 		igt_stats_push_float(&stats, igt_nsec_elapsed(&tv) * 1e-6);
 		syncobj_reset(fd, &sync.handle, 1);
-- 
2.43.0


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

end of thread, other threads:[~2024-06-22 14:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-21 11:53 [PATCH i-g-t] tests/intel/xe_spin_batch: Check duration of preempter execution Francois Dugast
2024-06-21 12:36 ` ✓ CI.xeBAT: success for " Patchwork
2024-06-21 12:46 ` ✓ Fi.CI.BAT: " Patchwork
2024-06-21 13:37 ` ✗ CI.xeFULL: failure " Patchwork
2024-06-21 14:28 ` [PATCH i-g-t] " Rodrigo Vivi
2024-06-21 15:00   ` Francois Dugast
2024-06-22 14:12 ` ✗ Fi.CI.IGT: failure for " Patchwork

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