Commit 6cd96877 authored by John Harrison's avatar John Harrison Committed by Matt Roper

drm/i915/pvc: Reduce stack usage in reset selftest with extra blitter engine

PVC adds extra blitter engines (in the following patch). The reset
selftest has a local array on the stack which is sized by the number
of engines. The increase pushes the size of this array to the point
where it trips the 'stack too large' compile warning. This patch takes
the allocation of the stack and makes it dynamic instead.

v2 (MattR):
 - Minor cosmetic changes:  re-sort definition and allocate using
   kmalloc_array().  (Tvrtko)

Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Signed-off-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Reviewed-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220505213812.3979301-7-matthew.d.roper@intel.com
parent 4de23dca
...@@ -976,6 +976,7 @@ static int __igt_reset_engines(struct intel_gt *gt, ...@@ -976,6 +976,7 @@ static int __igt_reset_engines(struct intel_gt *gt,
{ {
struct i915_gpu_error *global = &gt->i915->gpu_error; struct i915_gpu_error *global = &gt->i915->gpu_error;
struct intel_engine_cs *engine, *other; struct intel_engine_cs *engine, *other;
struct active_engine *threads;
enum intel_engine_id id, tmp; enum intel_engine_id id, tmp;
struct hang h; struct hang h;
int err = 0; int err = 0;
...@@ -996,8 +997,11 @@ static int __igt_reset_engines(struct intel_gt *gt, ...@@ -996,8 +997,11 @@ static int __igt_reset_engines(struct intel_gt *gt,
h.ctx->sched.priority = 1024; h.ctx->sched.priority = 1024;
} }
threads = kmalloc_array(I915_NUM_ENGINES, sizeof(*threads), GFP_KERNEL);
if (!threads)
return -ENOMEM;
for_each_engine(engine, gt, id) { for_each_engine(engine, gt, id) {
struct active_engine threads[I915_NUM_ENGINES] = {};
unsigned long device = i915_reset_count(global); unsigned long device = i915_reset_count(global);
unsigned long count = 0, reported; unsigned long count = 0, reported;
bool using_guc = intel_engine_uses_guc(engine); bool using_guc = intel_engine_uses_guc(engine);
...@@ -1016,7 +1020,7 @@ static int __igt_reset_engines(struct intel_gt *gt, ...@@ -1016,7 +1020,7 @@ static int __igt_reset_engines(struct intel_gt *gt,
break; break;
} }
memset(threads, 0, sizeof(threads)); memset(threads, 0, sizeof(*threads) * I915_NUM_ENGINES);
for_each_engine(other, gt, tmp) { for_each_engine(other, gt, tmp) {
struct task_struct *tsk; struct task_struct *tsk;
...@@ -1236,6 +1240,7 @@ static int __igt_reset_engines(struct intel_gt *gt, ...@@ -1236,6 +1240,7 @@ static int __igt_reset_engines(struct intel_gt *gt,
break; break;
} }
} }
kfree(threads);
if (intel_gt_is_wedged(gt)) if (intel_gt_is_wedged(gt))
err = -EIO; err = -EIO;
......
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