Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: igt-dev@lists.freedesktop.org, Ashutosh Dixit <ashutosh.dixit@intel.com>
Subject: [PATCH i-g-t 1/2] tests/intel/xe_oa: Do not discard single reports in oa-formats
Date: Tue,  4 Mar 2025 16:57:15 -0800	[thread overview]
Message-ID: <20250305005716.168646-2-umesh.nerlige.ramappa@intel.com> (raw)
In-Reply-To: <20250305005716.168646-1-umesh.nerlige.ramappa@intel.com>

Internally the test is expecting a single read call to return at least
two reports. If two reports are not read, the logic retries from the
beginning. This can easily fail if each read just returns one report. In
essence, many reports are available, but the logic causes test to fail.
Instead, count and use every report read when waiting for two reports to
be available.

Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
 tests/intel/xe_oa.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index dd71683928bd..e5744d830d39 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -1314,13 +1314,14 @@ read_2_oa_reports(int format_id,
 	int max_reports = default_oa_buffer_size / format_size;
 	int buf_size = format_size * max_reports * 1.5;
 	uint8_t *buf = malloc(buf_size);
+	ssize_t len = 0;
 	int n = 0;
 
 	for (int i = 0; i < 1000; i++) {
 		u32 oa_status = 0;
-		ssize_t len;
+		int ret;
 
-		while ((len = read(stream_fd, buf, buf_size)) < 0 && errno == EINTR)
+		while ((ret = read(stream_fd, buf + len, buf_size)) < 0 && errno == EINTR)
 			;
 		if (errno == EIO) {
 			oa_status = get_stream_status(stream_fd);
@@ -1328,9 +1329,10 @@ read_2_oa_reports(int format_id,
 			continue;
 		}
 
-		igt_assert(len > 0);
-		igt_debug("read %d bytes\n", (int)len);
+		igt_assert(ret > 0);
+		igt_debug("read %d bytes\n", (int)ret);
 
+		len += ret;
 		/* Need at least 2 reports */
 		if (len < 2 * format_size)
 			continue;
-- 
2.45.2


  reply	other threads:[~2025-03-05  0:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05  0:57 [PATCH i-g-t 0/2] Modify some OA tests for simulation Umesh Nerlige Ramappa
2025-03-05  0:57 ` Umesh Nerlige Ramappa [this message]
2025-03-05  4:56   ` [PATCH i-g-t 1/2] tests/intel/xe_oa: Do not discard single reports in oa-formats Dixit, Ashutosh
2025-03-05 16:27     ` Umesh Nerlige Ramappa
2025-03-05  0:57 ` [PATCH i-g-t 2/2] tests/intel/xe_oa: Enable OA tests for simulation Umesh Nerlige Ramappa
2025-03-05  5:01   ` Dixit, Ashutosh
2025-03-05 16:25     ` Umesh Nerlige Ramappa
2025-03-05  3:23 ` ✗ Xe.CI.BAT: failure for Modify some " Patchwork
2025-03-05 16:17   ` Umesh Nerlige Ramappa
2025-03-05  3:44 ` ✗ i915.CI.BAT: " Patchwork
2025-03-05 16:17   ` Umesh Nerlige Ramappa
2025-03-05  4:25 ` ✗ Xe.CI.Full: " Patchwork
2025-03-05 16:16   ` Umesh Nerlige Ramappa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250305005716.168646-2-umesh.nerlige.ramappa@intel.com \
    --to=umesh.nerlige.ramappa@intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox