[PATCH i-g-t 1/2] tests/intel/xe_oa: Do not discard single reports in oa-formats
Umesh Nerlige Ramappa
umesh.nerlige.ramappa at intel.com
Wed Mar 5 16:27:34 UTC 2025
On Tue, Mar 04, 2025 at 08:56:20PM -0800, Dixit, Ashutosh wrote:
>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.
Right, I will add that in the description.
>
>> 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 at 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:
Yeah, but I think I will still change that to 'buf_size - len'.
>
>Reviewed-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
Thanks,
Umesh
>
>> ;
>> 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
>>
More information about the igt-dev
mailing list