From: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 2/3] tests/gem_exec_alignment.c: Update subtest many
Date: Thu, 12 Mar 2020 10:09:32 +0100 [thread overview]
Message-ID: <20200312090933.20001-3-dominik.grzegorzek@intel.com> (raw)
In-Reply-To: <20200312090933.20001-1-dominik.grzegorzek@intel.com>
Updated subtest many, that was unusable due to the long
time of execution. For that purpose global timeout was added.
Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
tests/i915/gem_exec_alignment.c | 62 +++++++++++++++++++++------------
1 file changed, 40 insertions(+), 22 deletions(-)
diff --git a/tests/i915/gem_exec_alignment.c b/tests/i915/gem_exec_alignment.c
index b7c11947..0353d02b 100644
--- a/tests/i915/gem_exec_alignment.c
+++ b/tests/i915/gem_exec_alignment.c
@@ -39,6 +39,8 @@
#include <signal.h>
#include "drm.h"
+#define MANY_TIMEOUT 10
+
IGT_TEST_DESCRIPTION("Exercises the basic execbuffer using object alignments");
static uint32_t find_last_bit(uint64_t x)
@@ -102,8 +104,9 @@ static void many(int fd)
uint32_t bbe = MI_BATCH_BUFFER_END;
struct drm_i915_gem_exec_object2 *execobj;
struct drm_i915_gem_execbuffer2 execbuf;
- uint64_t gtt_size, ram_size;
- uint64_t alignment, max_alignment, count, i;
+ uint64_t gtt_size, ram_size, flags;
+ uint64_t alignment, max_alignment, count, max_count, curr_count, i;
+ int ret;
gtt_size = gem_aperture_size(fd);
if (!gem_uses_full_ppgtt(fd))
@@ -118,7 +121,9 @@ static void many(int fd)
max_alignment = 4096;
else
max_alignment = 1ull << (max_alignment - 1);
- count = gtt_size / max_alignment / 2;
+ max_count = count = gtt_size / max_alignment / 2;
+
+ flags = (gtt_size-1) >> 32 ? 1<<3 : 0; /* EXEC_OBJECT_SUPPORTS_48B_ADDRESS */
igt_info("gtt_size=%lld MiB, max-alignment=%lld, count=%lld\n",
(long long)gtt_size/1024/1024,
@@ -131,40 +136,53 @@ static void many(int fd)
for (i = 0; i < count; i++) {
execobj[i].handle = gem_create(fd, 4096);
- if ((gtt_size-1) >> 32)
- execobj[i].flags = 1<<3; /* EXEC_OBJECT_SUPPORTS_48B_ADDRESS */
+ execobj[i].flags = flags;
}
execobj[i].handle = gem_create(fd, 4096);
- if ((gtt_size-1) >> 32)
- execobj[i].flags = 1<<3; /* EXEC_OBJECT_SUPPORTS_48B_ADDRESS */
+ execobj[i].flags = flags;
gem_write(fd, execobj[i].handle, 0, &bbe, sizeof(bbe));
+
memset(&execbuf, 0, sizeof(execbuf));
execbuf.buffers_ptr = to_user_pointer(execobj);
execbuf.buffer_count = count + 1;
igt_require(__gem_execbuf(fd, &execbuf) == 0);
- for (alignment = 4096; alignment < gtt_size; alignment <<= 1) {
- for (i = 0; i < count; i++)
- execobj[i].alignment = alignment;
+ alignment_set_timeout(MANY_TIMEOUT, 0);
+
+ for (alignment = 4096; alignment < gtt_size && !timed_out; alignment <<= 1) {
if (alignment > max_alignment) {
uint64_t factor = alignment / max_alignment;
- execbuf.buffer_count = 2*count / factor;
- execbuf.buffers_ptr =
- to_user_pointer(execobj + count - execbuf.buffer_count + 1);
+ max_count = 2 * count / factor;
}
- igt_debug("testing %lld x alignment=%#llx [%db]\n",
- (long long)execbuf.buffer_count - 1,
- (long long)alignment,
- find_last_bit(alignment)-1);
- gem_execbuf(fd, &execbuf);
- for(i = count - execbuf.buffer_count + 1; i < count; i++) {
- igt_assert_eq_u64(execobj[i].alignment, alignment);
- igt_assert_eq_u64(execobj[i].offset % alignment, 0);
+ for (i = 0; i < count; i++)
+ execobj[i].alignment = alignment;
+
+ for (curr_count = 1; curr_count < max_count; curr_count <<= 1) {
+
+ execbuf.buffer_count = curr_count;
+ execbuf.buffers_ptr =
+ to_user_pointer(execobj + count - execbuf.buffer_count + 1);
+
+ igt_debug("testing %lld x alignment=%#llx [%db]\n",
+ (long long)execbuf.buffer_count,
+ (long long)alignment,
+ find_last_bit(alignment)-1);
+ ret = __gem_execbuf(fd, &execbuf);
+
+ if (timed_out)
+ break;
+
+ igt_assert_eq(ret, 0);
+
+ for (i = count - execbuf.buffer_count + 1; i < count; i++) {
+ igt_assert_eq_u64(execobj[i].alignment, alignment);
+ igt_assert_eq_u64(execobj[i].offset % alignment, 0);
+ }
}
}
-
+ alignment_reset_timeout();
for (i = 0; i < count; i++)
gem_close(fd, execobj[i].handle);
gem_close(fd, execobj[i].handle);
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-03-12 9:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-12 9:09 [igt-dev] [PATCH i-g-t 0/3] tests/gem_exec_alignment.c: Update subtests Dominik Grzegorzek
2020-03-12 9:09 ` [igt-dev] [PATCH i-g-t 1/3] tests/gem_exec_alignment.c: Timeout alarm wrappers Dominik Grzegorzek
2020-03-12 9:09 ` Dominik Grzegorzek [this message]
2020-03-12 9:09 ` [igt-dev] [PATCH i-g-t 3/3] tests/gem_exec_alignment.c: Add priority inversion test Dominik Grzegorzek
2020-03-12 9:32 ` [igt-dev] ✗ GitLab.Pipeline: failure for tests/gem_exec_alignment.c: Update subtests Patchwork
2020-03-12 9:47 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2020-03-12 10:06 ` [igt-dev] [PATCH i-g-t 0/3] " Chris Wilson
2020-03-13 2:37 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2020-03-16 12:03 [igt-dev] [PATCH i-g-t 0/3] " Dominik Grzegorzek
2020-03-16 12:03 ` [igt-dev] [PATCH i-g-t 2/3] tests/gem_exec_alignment.c: Update subtest many Dominik Grzegorzek
2020-03-19 7:38 [igt-dev] [PATCH i-g-t 0/3] tests/gem_exec_alignment.c: Update subtests Dominik Grzegorzek
2020-03-19 7:38 ` [igt-dev] [PATCH i-g-t 2/3] tests/gem_exec_alignment.c: Update subtest many Dominik Grzegorzek
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=20200312090933.20001-3-dominik.grzegorzek@intel.com \
--to=dominik.grzegorzek@intel.com \
--cc=igt-dev@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