Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests/intel/xe_oa: Ignore other errors when looking for buffer overflow
@ 2025-05-20 19:52 Umesh Nerlige Ramappa
  2025-05-20 21:34 ` ✓ Xe.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Umesh Nerlige Ramappa @ 2025-05-20 19:52 UTC (permalink / raw)
  To: igt-dev, Ashutosh Dixit

Occassionally other error bits will result in EIO and prematurely end
the buffer-fill test. For this test, ignore other errors.

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4565
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
 tests/intel/xe_oa.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index 73841a359daf..2022c5cb3955 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -2520,7 +2520,6 @@ test_buffer_fill(const struct drm_xe_engine_class_instance *hwe)
 	char *buf = malloc(1024);
 	bool overflow_seen;
 	u32 oa_status;
-	int len;
 
 	igt_debug("oa_period %s\n", pretty_print_oa_period(oa_period));
 	stream_fd = __perf_open(drm_fd, &param, true /* prevent_pm */);
@@ -2535,16 +2534,22 @@ test_buffer_fill(const struct drm_xe_engine_class_instance *hwe)
 
 	errno = 0;
 	/* Read 0 bytes repeatedly until you see an EIO */
-	while ((len = read(stream_fd, buf, 0)) == -1 && (errno == EINTR || errno == ENOSPC)) {
+	while (-1 == read(stream_fd, buf, 0)) {
+		if (errno == EIO) {
+			oa_status = get_stream_status(stream_fd);
+			overflow_seen = oa_status & DRM_XE_OASTATUS_BUFFER_OVERFLOW;
+			if (overflow_seen)
+				break;
+		}
 		usleep(100);
 	}
-	igt_assert_eq(len, -1);
-	igt_assert_eq(errno, EIO);
+	igt_assert(overflow_seen);
 
-	/* Ensure buffer overflowed */
+	/* Make sure the buffer overflow is cleared */
+	read(stream_fd, buf, 0);
 	oa_status = get_stream_status(stream_fd);
 	overflow_seen = oa_status & DRM_XE_OASTATUS_BUFFER_OVERFLOW;
-	igt_assert(overflow_seen);
+	igt_assert_eq(overflow_seen, 0);
 
 	__perf_close(stream_fd);
 }
-- 
2.43.0


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

end of thread, other threads:[~2025-05-22  6:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-20 19:52 [PATCH] tests/intel/xe_oa: Ignore other errors when looking for buffer overflow Umesh Nerlige Ramappa
2025-05-20 21:34 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-05-20 21:49 ` ✓ i915.CI.BAT: " Patchwork
2025-05-21  1:06 ` ✗ i915.CI.Full: failure " Patchwork
2025-05-21 11:43 ` ✗ Xe.CI.Full: " Patchwork
2025-05-21 20:12 ` [PATCH] " Dixit, Ashutosh
2025-05-21 20:25   ` Umesh Nerlige Ramappa
2025-05-22  6:37     ` Dixit, Ashutosh

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