Re: [PATCH 2/4] tests/intel/xe_oa: Do not assume OA buffer is prefilled with zeroes

Umesh Nerlige Ramappa <[email protected]>
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
On Mon, Jul 20, 2026 at 12:42:44PM -0700, Dixit, Ashutosh wrote:
>On Fri, 17 Jul 2026 14:00:30 -0700, Umesh Nerlige Ramappa wrote:
>>
>> The tail address test assumes that the OA buffer is preset to zeroes. Modify
>> logic to be independent of this assumption.
>
>Are we going to stop memset'ing OA buffer to 0 in the kernel? Even

Yes, I am planning to remove the memset in the kernel.

>otherwise, because this patch is a generalization of the OA buffer being 0:
>
>Reviewed-by: Ashutosh Dixit <[email protected]>

Thanks,
Umesh
>
>
>>
>> Signed-off-by: Umesh Nerlige Ramappa <[email protected]>
>> ---
>>  tests/intel/xe_oa.c | 29 ++++++++++++++++++-----------
>>  1 file changed, 18 insertions(+), 11 deletions(-)
>>
>> diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
>> index e7e4f5601b61..98f00d377a86 100644
>> --- a/tests/intel/xe_oa.c
>> +++ b/tests/intel/xe_oa.c
>> @@ -4634,7 +4634,7 @@ static void closed_fd_and_unmapped_access(const struct drm_xe_oa_unit *oau)
>>   * format size is not a power of 2. This means that the last report will not be
>>   * broken down across the OA buffer end. Instead it will be written to the
>>   * beginning of the OA buffer. We will check the end of the buffer to ensure it
>> - * has zeroes in it.
>> + * has not been written into.
>>   */
>>  static void
>>  test_tail_address_wrap(const struct drm_xe_oa_unit *oau, size_t oa_buffer_size)
>> @@ -4649,6 +4649,7 @@ test_tail_address_wrap(const struct drm_xe_oa_unit *oau, size_t oa_buffer_size)
>>		DRM_XE_OA_PROPERTY_OA_METRIC_SET, test_set->perf_oa_metrics_set,
>>		DRM_XE_OA_PROPERTY_OA_FORMAT, __ff(fmt),
>>		DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT, exponent,
>> +		DRM_XE_OA_PROPERTY_OA_DISABLED, true,
>>		DRM_XE_OA_PROPERTY_OA_BUFFER_SIZE, buffer_size,
>>	};
>>	struct intel_xe_oa_open_prop param = {
>> @@ -4656,25 +4657,31 @@ test_tail_address_wrap(const struct drm_xe_oa_unit *oau, size_t oa_buffer_size)
>>		.properties_ptr = to_user_pointer(properties),
>>	};
>>	u32 fmt_size = get_oa_format(fmt).size;
>> -	u32 zero_size = buffer_size % fmt_size;
>> -	u32 *zero_area, *buffer_end, *buffer_start;
>> +	u32 area_size = buffer_size % fmt_size;
>> +	u32 *area, *buffer_end, *buffer_start;
>> +	u32 *content = malloc(area_size);
>>
>> -	igt_require(zero_size);
>> +	igt_require(area_size);
>> +	igt_require(content);
>
>igt_assert(content);
>
>>
>>	stream_fd = __perf_open(drm_fd, &param, false);
>>	set_fd_flags(stream_fd, O_CLOEXEC);
>> -
>> -	wait_for_oa_buffer_overflow(stream_fd, 100);
>> -
>>	buffer_start = mmap(0, buffer_size, PROT_READ, MAP_PRIVATE, stream_fd, 0);
>>	igt_assert(buffer_start);
>>
>> -	zero_area = buffer_start + (buffer_size - zero_size) / 4;
>> +	area = buffer_start + (buffer_size - area_size) / 4;
>>	buffer_end = buffer_start + buffer_size / 4;
>>
>> -	dump_report(zero_area, zero_size / 4, "zero_area");
>> -	while (zero_area < buffer_end)
>> -		igt_assert_eq(*zero_area++, 0);
>> +	memcpy(content, area, area_size);
>> +	dump_report(area, area_size / 4, "contents before");
>> +
>> +	do_ioctl(stream_fd, DRM_XE_OBSERVATION_IOCTL_ENABLE, 0);
>> +	wait_for_oa_buffer_overflow(stream_fd, 100);
>> +	do_ioctl(stream_fd, DRM_XE_OBSERVATION_IOCTL_DISABLE, 0);
>> +
>> +	dump_report(area, area_size / 4, "contents after");
>> +	while (area < buffer_end)
>> +		igt_assert_eq(*area++, *content++);
>>
>>	munmap(buffer_start, buffer_size);
>>
>> --
>> 2.51.0
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.