[PATCH i-g-t] tests/xe_eudebug.c: Enhance memory access testcases
Piatkowski, Dominik Karol
dominik.karol.piatkowski at intel.com
Fri Dec 20 07:30:28 UTC 2024
LGTM,
Reviewed-by: Dominik Karol Piątkowski <dominik.karol.piatkowski at intel.com>
> -----Original Message-----
> From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of Dominik
> Grzegorzek
> Sent: Thursday, December 19, 2024 7:48 PM
> To: igt-dev at lists.freedesktop.org
> Cc: mika.kuoppala at linux.intel.com; Grzegorzek, Dominik
> <dominik.grzegorzek at intel.com>
> Subject: [PATCH i-g-t] tests/xe_eudebug.c: Enhance memory access testcases
>
> 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>
> ---
> 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