]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915/selftests: Move local mock_ggtt allocations to the heap
authorChris Wilson <chris@chris-wilson.co.uk>
Sun, 17 Feb 2019 20:25:18 +0000 (20:25 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Sun, 17 Feb 2019 21:07:46 +0000 (21:07 +0000)
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: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190217202518.24730-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
drivers/gpu/drm/i915/selftests/i915_vma.c

index 3850ef4a5ec89240883c5fcb074acd4ab78be235..488994d4ec19facdcbd7ef89657c124300444cda 100644 (file)
@@ -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;
 }
 
index cf1de82741fa7c32bcb523f51dacfd46bd4a1ea9..fc594b030f5a71029cfdef8b134cffc5ec564abb 100644 (file)
@@ -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;
 }