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

On Tue, 04 Mar 2025 16:57:15 -0800, Umesh Nerlige Ramappa wrote:
>
> 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.

OK, you mean 1000 reads each returning just 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)

Probably never hit this but maybe 'buf_size - len' ? Otherwise:

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>

>			;
>		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  4:56 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 ` [PATCH i-g-t 1/2] tests/intel/xe_oa: Do not discard single reports in oa-formats Umesh Nerlige Ramappa
2025-03-05  4:56   ` Dixit, Ashutosh [this message]
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=878qpkt6rv.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=umesh.nerlige.ramappa@intel.com \
    /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