Commit 83e3a215 authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Move local mock_ggtt allocations to the heap

This struct appears quite large and pushes our stack frame over
1024 bytes -- too high for conservative setups. So move the mock_ggtt
struct to the heap.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190217202518.24730-1-chris@chris-wilson.co.uk
parent 2a4a2754
......@@ -1681,25 +1681,31 @@ int i915_gem_gtt_mock_selftests(void)
SUBTEST(igt_gtt_insert),
};
struct drm_i915_private *i915;
struct i915_ggtt ggtt;
struct i915_ggtt *ggtt;
int err;
i915 = mock_gem_device();
if (!i915)
return -ENOMEM;
mock_init_ggtt(i915, &ggtt);
ggtt = kmalloc(sizeof(*ggtt), GFP_KERNEL);
if (!ggtt) {
err = -ENOMEM;
goto out_put;
}
mock_init_ggtt(i915, ggtt);
mutex_lock(&i915->drm.struct_mutex);
err = i915_subtests(tests, &ggtt);
err = i915_subtests(tests, ggtt);
mock_device_flush(i915);
mutex_unlock(&i915->drm.struct_mutex);
i915_gem_drain_freed_objects(i915);
mock_fini_ggtt(&ggtt);
mock_fini_ggtt(ggtt);
kfree(ggtt);
out_put:
drm_dev_put(&i915->drm);
return err;
}
......
......@@ -725,24 +725,30 @@ int i915_vma_mock_selftests(void)
SUBTEST(igt_vma_partial),
};
struct drm_i915_private *i915;
struct i915_ggtt ggtt;
struct i915_ggtt *ggtt;
int err;
i915 = mock_gem_device();
if (!i915)
return -ENOMEM;
mock_init_ggtt(i915, &ggtt);
ggtt = kmalloc(sizeof(*ggtt), GFP_KERNEL);
if (!ggtt) {
err = -ENOMEM;
goto out_put;
}
mock_init_ggtt(i915, ggtt);
mutex_lock(&i915->drm.struct_mutex);
err = i915_subtests(tests, &ggtt);
err = i915_subtests(tests, ggtt);
mock_device_flush(i915);
mutex_unlock(&i915->drm.struct_mutex);
i915_gem_drain_freed_objects(i915);
mock_fini_ggtt(&ggtt);
mock_fini_ggtt(ggtt);
kfree(ggtt);
out_put:
drm_dev_put(&i915->drm);
return err;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment