Skip to contentSkip to conversation

tests/intel/xe_exec_fault_mode: Don't return early

PATCH Superseded Nirmoy Das 3 participants 3 messages Sep 4, 2024

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

PATCH v5 1/1 tests/intel/xe_exec_fault_mode: Don't return early

Tests that are causing pagefaults should wait for exec to queue ban/finish otherwise pending engine resets because of on-going pagefaults would cause failure in subsequent tests to fail.

Not all execs will generate page faults and in such case reading ban property is not enough but the signal should either -EIO or 0. so read that instead.

v2: specify timeout reason and iterate over exec_queues(Andrzej)
v3: increase timeout
v4: check for signal status to be -EIO/0.
v5: code rearrangement and other minor fixes(Andrzej)

---
 tests/intel/xe_exec_fault_mode.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
tests/intel/xe_exec_fault_mode.c +12 -2
index 1f1f1e50b..9cc51b7d3 100644
@@ -324,9 +324,19 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	xe_wait_ufence(fd, &data[0].vm_sync, USER_FENCE_VALUE,
 		       bind_exec_queues[0], NSEC_PER_SEC);
 
-	if (!(flags & INVALID_FAULT) && !(flags & INVALID_VA)) {
+	if (flags & INVALID_FAULT) {
+		for (i = 0; i < n_execs; i++) {
+			int ret;
+			int64_t timeout = NSEC_PER_SEC;
+
+			ret = __xe_wait_ufence(fd, &data[i].exec_sync, USER_FENCE_VALUE,
+					       exec_queues[i % n_exec_queues], &timeout);
+			igt_assert(ret == -EIO || ret == 0);
+		}
+	} else if (!(flags & INVALID_VA)) {
 		for (i = j; i < n_execs; i++)
-				igt_assert_eq(data[i].data, 0xc0ffee);
+			igt_assert_eq(data[i].data, 0xc0ffee);
+
 	}
 
 	for (i = 0; i < n_exec_queues; i++) {
Signature · 1 line
2.42.0
Reviewed-by on v5 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Das, Nirmoy <[email protected]>
Sent: Wednesday, September 4, 2024 2:15 PM
To: [email protected]
Cc: [email protected]; Das, Nirmoy <[email protected]>; Hajda, Andrzej <[email protected]>; Brost, Matthew <[email protected]>; Upadhyay, Tejas <[email protected]>
Subject: [PATCH i-g-t v5] tests/intel/xe_exec_fault_mode: Don't return early

Quoted 1 line

Tests that are causing pagefaults should wait for exec to queue ban/finish

Typo here it seems, " exec queue to ban/finish "

Quoted 49 lines

otherwise pending engine resets because of on-going pagefaults would cause failure in subsequent tests to fail.

Not all execs will generate page faults and in such case reading ban property is not enough but the signal should either -EIO or 0.
so read that instead.

v2: specify timeout reason and iterate over exec_queues(Andrzej)
v3: increase timeout
v4: check for signal status to be -EIO/0.
v5: code rearrangement and other minor fixes(Andrzej)

---
 tests/intel/xe_exec_fault_mode.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
tests/intel/xe_exec_fault_mode.c +12 -2
index 1f1f1e50b..9cc51b7d3 100644
@@ -324,9 +324,19 @@ test_exec(int fd, struct
 drm_xe_engine_class_instance *eci,
 	xe_wait_ufence(fd, &data[0].vm_sync, USER_FENCE_VALUE,
 		       bind_exec_queues[0], NSEC_PER_SEC);
 
-	if (!(flags & INVALID_FAULT) && !(flags & INVALID_VA)) {
+	if (flags & INVALID_FAULT) {
+		for (i = 0; i < n_execs; i++) {
+			int ret;
+			int64_t timeout = NSEC_PER_SEC;
+
+			ret = __xe_wait_ufence(fd, &data[i].exec_sync,
 USER_FENCE_VALUE,
+					       exec_queues[i % n_exec_queues],
 &timeout);
+			igt_assert(ret == -EIO || ret == 0);
+		}
+	} else if (!(flags & INVALID_VA)) {
 		for (i = j; i < n_execs; i++)
-				igt_assert_eq(data[i].data, 0xc0ffee);
+			igt_assert_eq(data[i].data, 0xc0ffee);
+

tests/intel/xe_exec_fault_mode.c test_exec(int fd, struct drm_xe_engine_class_instance *eci, · line 342

Quoted 3 lines
tests/intel/xe_exec_fault_mode.c +0 -0
 	}
 
 	for (i = 0; i < n_exec_queues; i++) {

With that fixed, I see its helping in syncing test progress and helps resolving wait fence timeout. Following "wait fence timeout -62" failure sometime " [174.208129] xe 0000:00:02.0: [drm] Schedule disable failed to respond " warning is also thrown. This might also help there. LGTM,

Quoted 2 lines

--
2.42.0

Reviewed-by on v5 1/1
#2 lore raw
In reply to Nirmoy Das
Quoted 13 lines · Nirmoy Das

Tests that are causing pagefaults should wait for exec to queue ban/finish otherwise pending engine resets because of on-going pagefaults would cause failure in subsequent tests to fail.

Not all execs will generate page faults and in such case reading ban property is not enough but the signal should either -EIO or 0. so read that instead.

v2: specify timeout reason and iterate over exec_queues(Andrzej)
v3: increase timeout
v4: check for signal status to be -EIO/0.
v5: code rearrangement and other minor fixes(Andrzej)

Quoted 6 lines

Regards
Andrzej

Quoted 30 lines
---
  tests/intel/xe_exec_fault_mode.c | 14 ++++++++++++--
  1 file changed, 12 insertions(+), 2 deletions(-)
tests/intel/xe_exec_fault_mode.c +12 -2
index 1f1f1e50b..9cc51b7d3 100644
@@ -324,9 +324,19 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
  	xe_wait_ufence(fd, &data[0].vm_sync, USER_FENCE_VALUE,
  		       bind_exec_queues[0], NSEC_PER_SEC);
 
-	if (!(flags & INVALID_FAULT) && !(flags & INVALID_VA)) {
+	if (flags & INVALID_FAULT) {
+		for (i = 0; i < n_execs; i++) {
+			int ret;
+			int64_t timeout = NSEC_PER_SEC;
+
+			ret = __xe_wait_ufence(fd, &data[i].exec_sync, USER_FENCE_VALUE,
+					       exec_queues[i % n_exec_queues], &timeout);
+			igt_assert(ret == -EIO || ret == 0);
+		}
+	} else if (!(flags & INVALID_VA)) {
  		for (i = j; i < n_execs; i++)
-				igt_assert_eq(data[i].data, 0xc0ffee);
+			igt_assert_eq(data[i].data, 0xc0ffee);
+
  	}
 
  	for (i = 0; i < n_exec_queues; i++) {