From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH] tests/gem_exec_params: test overly large batch
Date: Tue, 13 Oct 2020 13:11:39 +0100 [thread overview]
Message-ID: <20201013121139.104017-1-matthew.auld@intel.com> (raw)
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
next reply other threads:[~2020-10-13 12:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-13 12:11 Matthew Auld [this message]
2020-10-13 12:21 ` [Intel-gfx] [igt-dev] [PATCH] tests/gem_exec_params: test overly large batch Chris Wilson
2020-10-13 14:40 ` Chris Wilson
2020-10-13 13:54 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201013121139.104017-1-matthew.auld@intel.com \
--to=matthew.auld@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox