[igt-dev] [RFC PATCH i-g-t v3] tests/gem_exec_reloc: Don't filter out invalid addresses

Vanshidhar Konda vanshidhar.r.konda at intel.com
Wed Oct 30 21:19:43 UTC 2019


On Wed, Oct 30, 2019 at 06:15:35PM +0100, Janusz Krzysztofik wrote:
>Commit a355b2d6eb42 ("igt/gem_exec_reloc: Filter out unavailable
>addresses for !ppgtt") introduced filtering of addresses possibly
>occupied by other users of shared GTT.  Unfortunately, that filtering
>doesn't distinguish actually occupied addresses from otherwise invalid
>softpin offsets.  For example, on a future hardware backing store with
>a page size larger than 4 kB incorrect object alignment is assumed and
>the test results are distorted as it happily skips over incorrectly
>aligned objects instead of reporting the problem.
>
>Filter out failing addresses only if not reported as invalid.
>
>Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
>Cc: Chris Wilson <chris at chris-wilson.co.uk>
>---
> tests/i915/gem_exec_reloc.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
>diff --git a/tests/i915/gem_exec_reloc.c b/tests/i915/gem_exec_reloc.c
>index fdd9661d..1d0c791e 100644
>--- a/tests/i915/gem_exec_reloc.c
>+++ b/tests/i915/gem_exec_reloc.c
>@@ -520,7 +520,7 @@ static void basic_range(int fd, unsigned flags)
> 	uint64_t gtt_size = gem_aperture_size(fd);
> 	const uint32_t bbe = MI_BATCH_BUFFER_END;
> 	igt_spin_t *spin = NULL;
>-	int count, n;
>+	int count, n, err;
>
> 	igt_require(gem_has_softpin(fd));
>
>@@ -542,8 +542,11 @@ static void basic_range(int fd, unsigned flags)
> 		gem_write(fd, obj[n].handle, 0, &bbe, sizeof(bbe));
> 		execbuf.buffers_ptr = to_user_pointer(&obj[n]);
> 		execbuf.buffer_count = 1;
>-		if (__gem_execbuf(fd, &execbuf))
>+		err = __gem_execbuf(fd, &execbuf);
>+		if (err) {
>+			igt_assert(err != -EINVAL);
> 			continue;

The addresses to which the object is being pinned is generated as part
of the test. The code is just assuming that the address needs to be 4K
aligned instead of figuring out what the alignment requirement for the
device is.

Shouldn't the test be updated to generate virtual addresses per the
alignment requirements of the test device instead of just assuming 4K
increments are good?

Vanshi

>+		}
>
> 		igt_debug("obj[%d] handle=%d, address=%llx\n",
> 			  n, obj[n].handle, (long long)obj[n].offset);
>@@ -562,8 +565,11 @@ static void basic_range(int fd, unsigned flags)
> 		gem_write(fd, obj[n].handle, 0, &bbe, sizeof(bbe));
> 		execbuf.buffers_ptr = to_user_pointer(&obj[n]);
> 		execbuf.buffer_count = 1;
>-		if (__gem_execbuf(fd, &execbuf))
>+		err = __gem_execbuf(fd, &execbuf);
>+		if (err) {
>+			igt_assert(err != -EINVAL);
> 			continue;
>+		}
>
> 		igt_debug("obj[%d] handle=%d, address=%llx\n",
> 			  n, obj[n].handle, (long long)obj[n].offset);
>-- 
>2.21.0
>
>_______________________________________________
>igt-dev mailing list
>igt-dev at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/igt-dev


More information about the igt-dev mailing list