summaryrefslogtreecommitdiff
path: root/tests/i915/gem_exec_params.c
diff options
context:
space:
mode:
authorMatthew Auld <matthew.auld@intel.com>2022-03-01 11:03:59 +0000
committerMatthew Auld <matthew.auld@intel.com>2022-03-04 15:58:19 +0000
commit506a890aecb62382a114f43e30b35d96a03fd9ef (patch)
tree15a69955dd735e53d05a5de56315d31710cfcc8d /tests/i915/gem_exec_params.c
parent698695136f8ade2391f2d8f45300eae2df02e947 (diff)
tests/i915/gem_exec_params: check available memory earlier
The shmem mmap and pwrite interfaces conveniently let us probe just a few pages, without needing to populate the entire object. On discrete and newer platforms the kernel has dropped support for both, leaving us with MMAP_OFFSET, which will always populate the entire object, for now at least. Luckily we can just move the batch creation to after checking the available memory to ensure we don't hit -ENOMEM on such platforms. Also it seems that doing a massive allocation(filling much of system memory) and then calling intel_purge_vm_caches() seems to take 40+ seconds, like when calling intel_require_memory(). Hence switching the ordering here should also help with that. For reference the larger-than-life test is just a simple regression test to ensure that some very large batch buffer(greater than ~4G) can't overflow the batch_len, causing all kinds of issues. See 57b2d834bf23 ("drm/i915/gem: Support parsing of oversize batches"). Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com> Cc: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Diffstat (limited to 'tests/i915/gem_exec_params.c')
-rw-r--r--tests/i915/gem_exec_params.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/i915/gem_exec_params.c b/tests/i915/gem_exec_params.c
index d247b8a6..da36af74 100644
--- a/tests/i915/gem_exec_params.c
+++ b/tests/i915/gem_exec_params.c
@@ -332,9 +332,7 @@ static void test_larger_than_life_batch(int fd)
const struct intel_execution_engine2 *e;
uint64_t size = 1ULL << 32; /* batch_len is __u32 as per the ABI */
const intel_ctx_t *ctx = intel_ctx_create_all_physical(fd);
- struct drm_i915_gem_exec_object2 exec = {
- .handle = batch_create_size(fd, size),
- };
+ struct drm_i915_gem_exec_object2 exec = {};
struct drm_i915_gem_execbuffer2 execbuf = {
.buffers_ptr = to_user_pointer(&exec),
.buffer_count = 1,
@@ -350,6 +348,8 @@ static void test_larger_than_life_batch(int fd)
igt_require(size < gem_aperture_size(fd));
intel_require_memory(2, size, CHECK_RAM); /* batch + shadow */
+ exec.handle = batch_create_size(fd, size);
+
for_each_ctx_engine(fd, ctx, e) {
/* Keep the batch_len implicit [0] */
execbuf.flags = e->flags;