[PATCH i-g-t] tests/xe_eudebug.c: Enhance memory access testcases

Mika Kuoppala mika.kuoppala at linux.intel.com
Fri Dec 20 10:52:46 UTC 2024


Dominik Grzegorzek <dominik.grzegorzek at intel.com> writes:

> UMD tests revealed issues with memory read/write operations when
> accessing data at any nonzero offset within a VMA. Address this by
> verifying access to a buffer object at random unaligned offset.
>
> Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>


Thanks for fixing the really bad coverage in here,

Reviewed-by: Mika Kuoppala <mika.kuoppala at linux.intel.com>

And if you want you can add
Tested-by: Mika Kuoppala <mika.kuoppala at linux.intel.com>


> ---
>  tests/intel/xe_eudebug.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/tests/intel/xe_eudebug.c b/tests/intel/xe_eudebug.c
> index d9281f78f..51d02e06c 100644
> --- a/tests/intel/xe_eudebug.c
> +++ b/tests/intel/xe_eudebug.c
> @@ -1556,6 +1556,7 @@ static void debugger_test_vma(struct xe_eudebug_debugger *d,
>  	struct drm_xe_eudebug_vm_open vo = { 0, };
>  	uint64_t *v1, *v2;
>  	uint64_t items = va_length / sizeof(uint64_t);
> +	uint64_t offset;
>  	int fd;
>  	int r, i;
>  
> @@ -1573,14 +1574,24 @@ static void debugger_test_vma(struct xe_eudebug_debugger *d,
>  	r = pread(fd, v1, va_length, va_start);
>  	igt_assert_eq(r, va_length);
>  
> +	for (i = 0; i < items; i++)
> +		igt_assert_eq(v1[i], va_start + i);
> +
> +	/* random unaligned offset within the vm */
> +	offset = 1 + random() % (va_length / 2);
> +	r = pread(fd, (char *)v1 + offset, va_length - offset, va_start + offset);
> +	igt_assert_eq(r, va_length - offset);
>  	for (i = 0; i < items; i++)
>  		igt_assert_eq(v1[i], va_start + i);
>  
>  	for (i = 0; i < items; i++)
>  		v1[i] = va_start + i + 1;
>  
> -	r = pwrite(fd, v1, va_length, va_start);
> -	igt_assert_eq(r, va_length);
> +	r = pwrite(fd, v1, offset, va_start);
> +	igt_assert_eq(r, offset);
> +
> +	r = pwrite(fd, (char *)v1 + offset, va_length - offset, va_start + offset);
> +	igt_assert_eq(r, va_length - offset);
>  
>  	lseek(fd, va_start, SEEK_SET);
>  	r = read(fd, v2, va_length);
> -- 
> 2.34.1


More information about the igt-dev mailing list