public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2] tests/intel/xe_oa: Extend enable-disable to read after disabling stream
@ 2026-03-30 20:14 Ashutosh Dixit
  2026-03-31  5:11 ` ✓ Xe.CI.BAT: success for tests/intel/xe_oa: Extend enable-disable to read after disabling stream (rev3) Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ashutosh Dixit @ 2026-03-30 20:14 UTC (permalink / raw)
  To: igt-dev; +Cc: Umesh Nerlige Ramappa

Extend enable-disable subtest to validate the new feature of reading after
disabling OA stream.

v2: s/igt_assert_eq(ret, sizeof(buf));/igt_assert_lt(0, ret);/

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 tests/intel/xe_oa.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index 387f29535e..f0944c74b5 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -2774,6 +2774,32 @@ test_enable_disable(const struct drm_xe_oa_unit *oau)
 	get_stream_status(stream_fd);
 	igt_assert_eq(ret, sizeof(buf));
 
+	/* Wait again for more reports */
+	pollfd.fd = stream_fd;
+	pollfd.events = POLLIN;
+	poll(&pollfd, 1, -1);
+	igt_assert(pollfd.revents & POLLIN);
+
+	do_ioctl(stream_fd, DRM_XE_OBSERVATION_IOCTL_DISABLE, 0);
+
+	/*
+	 * Ensure some reports can be read even with disabled stream. These
+	 * can be less than WAIT_NUM_REPORTS, if pollin was left set in the
+	 * kernel after the previous read (since read buffer is small)
+	 */
+	while ((ret = read(stream_fd, buf, sizeof(buf))) < 0 && errno == EINTR)
+		;
+	get_stream_status(stream_fd);
+	igt_assert_lt(0, ret);
+
+	/* In non-blocking mode read till we see a -EAGAIN, signifying all available data is read */
+	set_fd_flags(stream_fd, O_CLOEXEC | O_NONBLOCK);
+	while ((ret = read(stream_fd, buf, sizeof(buf))) > 0 ||
+	       (ret == -1 && (errno == EINTR || errno == EIO)))
+		;
+	igt_assert_eq(ret, -1);
+	igt_assert_eq(errno, EAGAIN);
+
 	__perf_close(stream_fd);
 }
 
-- 
2.48.1


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

end of thread, other threads:[~2026-03-31 15:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 20:14 [PATCH i-g-t v2] tests/intel/xe_oa: Extend enable-disable to read after disabling stream Ashutosh Dixit
2026-03-31  5:11 ` ✓ Xe.CI.BAT: success for tests/intel/xe_oa: Extend enable-disable to read after disabling stream (rev3) Patchwork
2026-03-31  5:30 ` ✓ i915.CI.BAT: " Patchwork
2026-03-31 10:55 ` ✓ Xe.CI.FULL: " Patchwork
2026-03-31 15:56 ` ✗ i915.CI.Full: failure " Patchwork

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