* [Intel-gfx] [PATCH] tests/gem_exec_params: test overly large batch
@ 2020-10-13 12:11 Matthew Auld
2020-10-13 12:21 ` [Intel-gfx] [igt-dev] " Chris Wilson
2020-10-13 13:54 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
0 siblings, 2 replies; 4+ messages in thread
From: Matthew Auld @ 2020-10-13 12:11 UTC (permalink / raw)
To: igt-dev; +Cc: intel-gfx
See if can make something explode with too large batch (1ULL << 32),
while also making the batch_len implicit. We should also try each engine
since batch_len seems to have different interactions related to that.
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
tests/i915/gem_exec_params.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/tests/i915/gem_exec_params.c b/tests/i915/gem_exec_params.c
index f8a94074..e00bbd04 100644
--- a/tests/i915/gem_exec_params.c
+++ b/tests/i915/gem_exec_params.c
@@ -273,7 +273,7 @@ static void mmapped(int i915)
gem_close(i915, buf);
}
-static uint32_t batch_create_size(int fd, uint32_t size)
+static uint32_t batch_create_size(int fd, uint64_t size)
{
const uint32_t bbe = MI_BATCH_BUFFER_END;
uint32_t handle;
@@ -317,6 +317,32 @@ static void test_invalid_batch_start(int fd)
gem_close(fd, exec.handle);
}
+static void test_larger_than_life_batch(int fd)
+{
+ uint64_t size = 1ULL << 32; /* batch_len is __u32 as per the ABI */
+ struct drm_i915_gem_exec_object2 exec = {
+ .handle = batch_create_size(fd, size),
+ };
+ struct drm_i915_gem_execbuffer2 execbuf = {
+ .buffers_ptr = to_user_pointer(&exec),
+ .buffer_count = 1,
+ };
+
+ /*
+ * batch_len seems like it can have different interaction depending on
+ * the engine and HW.
+ */
+ for_each_engine(e, fd) {
+ execbuf.flags = eb_ring(e);
+ /* Make the batch_len implicit */
+ __gem_execbuf(fd, &execbuf);
+
+ gem_sync(fd, exec.handle);
+ }
+
+ gem_close(fd, exec.handle);
+}
+
struct drm_i915_gem_execbuffer2 execbuf;
struct drm_i915_gem_exec_object2 gem_exec[1];
uint32_t batch[2] = {MI_BATCH_BUFFER_END};
@@ -586,6 +612,9 @@ igt_main
igt_subtest("invalid-batch-start-offset")
test_invalid_batch_start(fd);
+ igt_subtest("larger-than-life-batch")
+ test_larger_than_life_batch(fd);
+
#define DIRT(name) \
igt_subtest(#name "-dirt") { \
execbuf.flags = 0; \
--
2.26.2
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [igt-dev] [PATCH] tests/gem_exec_params: test overly large batch
2020-10-13 12:11 [Intel-gfx] [PATCH] tests/gem_exec_params: test overly large batch Matthew Auld
@ 2020-10-13 12:21 ` Chris Wilson
2020-10-13 14:40 ` Chris Wilson
2020-10-13 13:54 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
1 sibling, 1 reply; 4+ messages in thread
From: Chris Wilson @ 2020-10-13 12:21 UTC (permalink / raw)
To: Matthew Auld, igt-dev; +Cc: intel-gfx
Quoting Matthew Auld (2020-10-13 13:11:39)
> See if can make something explode with too large batch (1ULL << 32),
> while also making the batch_len implicit. We should also try each engine
> since batch_len seems to have different interactions related to that.
>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> ---
> tests/i915/gem_exec_params.c | 31 ++++++++++++++++++++++++++++++-
> 1 file changed, 30 insertions(+), 1 deletion(-)
>
> diff --git a/tests/i915/gem_exec_params.c b/tests/i915/gem_exec_params.c
> index f8a94074..e00bbd04 100644
> --- a/tests/i915/gem_exec_params.c
> +++ b/tests/i915/gem_exec_params.c
> @@ -273,7 +273,7 @@ static void mmapped(int i915)
> gem_close(i915, buf);
> }
>
> -static uint32_t batch_create_size(int fd, uint32_t size)
> +static uint32_t batch_create_size(int fd, uint64_t size)
> {
> const uint32_t bbe = MI_BATCH_BUFFER_END;
> uint32_t handle;
> @@ -317,6 +317,32 @@ static void test_invalid_batch_start(int fd)
> gem_close(fd, exec.handle);
> }
>
> +static void test_larger_than_life_batch(int fd)
> +{
> + uint64_t size = 1ULL << 32; /* batch_len is __u32 as per the ABI */
> + struct drm_i915_gem_exec_object2 exec = {
> + .handle = batch_create_size(fd, size),
> + };
> + struct drm_i915_gem_execbuffer2 execbuf = {
> + .buffers_ptr = to_user_pointer(&exec),
> + .buffer_count = 1,
> + };
Needs intel_require_memory(2, size, CHECK_RAM)
> +
> + /*
> + * batch_len seems like it can have different interaction depending on
> + * the engine and HW.
> + */
> + for_each_engine(e, fd) {
> + execbuf.flags = eb_ring(e);
> + /* Make the batch_len implicit */
> + __gem_execbuf(fd, &execbuf);
Expect success.
> +
> + gem_sync(fd, exec.handle);
?
If you just want to be sure the system is idle, put it after the loop.
Otherwise it doesn't/shouldn't affect the interpretation of the params
(if paranoid, do both, though to ensure it is active at the time, you
would need a spinner).
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Intel-gfx] ✗ Fi.CI.BUILD: failure for tests/gem_exec_params: test overly large batch
2020-10-13 12:11 [Intel-gfx] [PATCH] tests/gem_exec_params: test overly large batch Matthew Auld
2020-10-13 12:21 ` [Intel-gfx] [igt-dev] " Chris Wilson
@ 2020-10-13 13:54 ` Patchwork
1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2020-10-13 13:54 UTC (permalink / raw)
To: Matthew Auld; +Cc: intel-gfx
== Series Details ==
Series: tests/gem_exec_params: test overly large batch
URL : https://patchwork.freedesktop.org/series/82626/
State : failure
== Summary ==
Applying: tests/gem_exec_params: test overly large batch
error: sha1 information is lacking or useless (tests/i915/gem_exec_params.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 tests/gem_exec_params: test overly large batch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [igt-dev] [PATCH] tests/gem_exec_params: test overly large batch
2020-10-13 12:21 ` [Intel-gfx] [igt-dev] " Chris Wilson
@ 2020-10-13 14:40 ` Chris Wilson
0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2020-10-13 14:40 UTC (permalink / raw)
To: Matthew Auld, igt-dev; +Cc: intel-gfx
Quoting Chris Wilson (2020-10-13 13:21:55)
> > +
> > + /*
> > + * batch_len seems like it can have different interaction depending on
> > + * the engine and HW.
> > + */
> > + for_each_engine(e, fd) {
> > + execbuf.flags = eb_ring(e);
> > + /* Make the batch_len implicit */
> > + __gem_execbuf(fd, &execbuf);
>
> Expect success.
Except for when batch > GTT size. igt_require(gem_gtt_size() > 4G) ?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-10-13 14:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-13 12:11 [Intel-gfx] [PATCH] tests/gem_exec_params: test overly large batch Matthew Auld
2020-10-13 12:21 ` [Intel-gfx] [igt-dev] " Chris Wilson
2020-10-13 14:40 ` Chris Wilson
2020-10-13 13:54 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox