Commit 60a0933b authored by Chris Wilson's avatar Chris Wilson

drm/i915/selftests: Use request managed wakerefs

Since commit 79ffac85 ("drm/i915: Invert the GEM wakeref
hierarchy"), the request creation itself took responsibility for
managing the engine/GT wakerefs and so we can remove the redundant grabs
in our selftests.

References: 79ffac85 ("drm/i915: Invert the GEM wakeref hierarchy")
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190620102432.31580-1-chris@chris-wilson.co.uk
parent cffa1eb8
...@@ -31,7 +31,6 @@ static int live_nop_switch(void *arg) ...@@ -31,7 +31,6 @@ static int live_nop_switch(void *arg)
struct intel_engine_cs *engine; struct intel_engine_cs *engine;
struct i915_gem_context **ctx; struct i915_gem_context **ctx;
enum intel_engine_id id; enum intel_engine_id id;
intel_wakeref_t wakeref;
struct igt_live_test t; struct igt_live_test t;
struct drm_file *file; struct drm_file *file;
unsigned long n; unsigned long n;
...@@ -53,7 +52,6 @@ static int live_nop_switch(void *arg) ...@@ -53,7 +52,6 @@ static int live_nop_switch(void *arg)
return PTR_ERR(file); return PTR_ERR(file);
mutex_lock(&i915->drm.struct_mutex); mutex_lock(&i915->drm.struct_mutex);
wakeref = intel_runtime_pm_get(&i915->runtime_pm);
ctx = kcalloc(nctx, sizeof(*ctx), GFP_KERNEL); ctx = kcalloc(nctx, sizeof(*ctx), GFP_KERNEL);
if (!ctx) { if (!ctx) {
...@@ -152,7 +150,6 @@ static int live_nop_switch(void *arg) ...@@ -152,7 +150,6 @@ static int live_nop_switch(void *arg)
} }
out_unlock: out_unlock:
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
mutex_unlock(&i915->drm.struct_mutex); mutex_unlock(&i915->drm.struct_mutex);
mock_file_free(i915, file); mock_file_free(i915, file);
return err; return err;
...@@ -507,7 +504,6 @@ static int igt_ctx_exec(void *arg) ...@@ -507,7 +504,6 @@ static int igt_ctx_exec(void *arg)
dw = 0; dw = 0;
while (!time_after(jiffies, end_time)) { while (!time_after(jiffies, end_time)) {
struct i915_gem_context *ctx; struct i915_gem_context *ctx;
intel_wakeref_t wakeref;
ctx = live_context(i915, file); ctx = live_context(i915, file);
if (IS_ERR(ctx)) { if (IS_ERR(ctx)) {
...@@ -523,7 +519,6 @@ static int igt_ctx_exec(void *arg) ...@@ -523,7 +519,6 @@ static int igt_ctx_exec(void *arg)
} }
} }
with_intel_runtime_pm(&i915->runtime_pm, wakeref)
err = gpu_fill(obj, ctx, engine, dw); err = gpu_fill(obj, ctx, engine, dw);
if (err) { if (err) {
pr_err("Failed to fill dword %lu [%lu/%lu] with gpu (%s) in ctx %u [full-ppgtt? %s], err=%d\n", pr_err("Failed to fill dword %lu [%lu/%lu] with gpu (%s) in ctx %u [full-ppgtt? %s], err=%d\n",
...@@ -623,7 +618,6 @@ static int igt_shared_ctx_exec(void *arg) ...@@ -623,7 +618,6 @@ static int igt_shared_ctx_exec(void *arg)
ncontexts = 0; ncontexts = 0;
while (!time_after(jiffies, end_time)) { while (!time_after(jiffies, end_time)) {
struct i915_gem_context *ctx; struct i915_gem_context *ctx;
intel_wakeref_t wakeref;
ctx = kernel_context(i915); ctx = kernel_context(i915);
if (IS_ERR(ctx)) { if (IS_ERR(ctx)) {
...@@ -642,8 +636,6 @@ static int igt_shared_ctx_exec(void *arg) ...@@ -642,8 +636,6 @@ static int igt_shared_ctx_exec(void *arg)
} }
} }
err = 0;
with_intel_runtime_pm(&i915->runtime_pm, wakeref)
err = gpu_fill(obj, ctx, engine, dw); err = gpu_fill(obj, ctx, engine, dw);
if (err) { if (err) {
pr_err("Failed to fill dword %lu [%lu/%lu] with gpu (%s) in ctx %u [full-ppgtt? %s], err=%d\n", pr_err("Failed to fill dword %lu [%lu/%lu] with gpu (%s) in ctx %u [full-ppgtt? %s], err=%d\n",
...@@ -1030,7 +1022,6 @@ __igt_ctx_sseu(struct drm_i915_private *i915, ...@@ -1030,7 +1022,6 @@ __igt_ctx_sseu(struct drm_i915_private *i915,
struct i915_gem_context *ctx; struct i915_gem_context *ctx;
struct intel_context *ce; struct intel_context *ce;
struct intel_sseu pg_sseu; struct intel_sseu pg_sseu;
intel_wakeref_t wakeref;
struct drm_file *file; struct drm_file *file;
int ret; int ret;
...@@ -1078,12 +1069,10 @@ __igt_ctx_sseu(struct drm_i915_private *i915, ...@@ -1078,12 +1069,10 @@ __igt_ctx_sseu(struct drm_i915_private *i915,
goto out_unlock; goto out_unlock;
} }
wakeref = intel_runtime_pm_get(&i915->runtime_pm);
ce = i915_gem_context_get_engine(ctx, RCS0); ce = i915_gem_context_get_engine(ctx, RCS0);
if (IS_ERR(ce)) { if (IS_ERR(ce)) {
ret = PTR_ERR(ce); ret = PTR_ERR(ce);
goto out_rpm; goto out_put;
} }
ret = intel_context_pin(ce); ret = intel_context_pin(ce);
...@@ -1117,8 +1106,7 @@ __igt_ctx_sseu(struct drm_i915_private *i915, ...@@ -1117,8 +1106,7 @@ __igt_ctx_sseu(struct drm_i915_private *i915,
intel_context_unpin(ce); intel_context_unpin(ce);
out_context: out_context:
intel_context_put(ce); intel_context_put(ce);
out_rpm: out_put:
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
i915_gem_object_put(obj); i915_gem_object_put(obj);
out_unlock: out_unlock:
...@@ -1207,8 +1195,6 @@ static int igt_ctx_readonly(void *arg) ...@@ -1207,8 +1195,6 @@ static int igt_ctx_readonly(void *arg)
unsigned int id; unsigned int id;
for_each_engine(engine, i915, id) { for_each_engine(engine, i915, id) {
intel_wakeref_t wakeref;
if (!intel_engine_can_store_dword(engine)) if (!intel_engine_can_store_dword(engine))
continue; continue;
...@@ -1223,8 +1209,6 @@ static int igt_ctx_readonly(void *arg) ...@@ -1223,8 +1209,6 @@ static int igt_ctx_readonly(void *arg)
i915_gem_object_set_readonly(obj); i915_gem_object_set_readonly(obj);
} }
err = 0;
with_intel_runtime_pm(&i915->runtime_pm, wakeref)
err = gpu_fill(obj, ctx, engine, dw); err = gpu_fill(obj, ctx, engine, dw);
if (err) { if (err) {
pr_err("Failed to fill dword %lu [%lu/%lu] with gpu (%s) in ctx %u [full-ppgtt? %s], err=%d\n", pr_err("Failed to fill dword %lu [%lu/%lu] with gpu (%s) in ctx %u [full-ppgtt? %s], err=%d\n",
...@@ -1488,7 +1472,6 @@ static int igt_vm_isolation(void *arg) ...@@ -1488,7 +1472,6 @@ static int igt_vm_isolation(void *arg)
struct drm_i915_private *i915 = arg; struct drm_i915_private *i915 = arg;
struct i915_gem_context *ctx_a, *ctx_b; struct i915_gem_context *ctx_a, *ctx_b;
struct intel_engine_cs *engine; struct intel_engine_cs *engine;
intel_wakeref_t wakeref;
struct igt_live_test t; struct igt_live_test t;
struct drm_file *file; struct drm_file *file;
I915_RND_STATE(prng); I915_RND_STATE(prng);
...@@ -1535,8 +1518,6 @@ static int igt_vm_isolation(void *arg) ...@@ -1535,8 +1518,6 @@ static int igt_vm_isolation(void *arg)
GEM_BUG_ON(ctx_b->vm->total != vm_total); GEM_BUG_ON(ctx_b->vm->total != vm_total);
vm_total -= I915_GTT_PAGE_SIZE; vm_total -= I915_GTT_PAGE_SIZE;
wakeref = intel_runtime_pm_get(&i915->runtime_pm);
count = 0; count = 0;
for_each_engine(engine, i915, id) { for_each_engine(engine, i915, id) {
IGT_TIMEOUT(end_time); IGT_TIMEOUT(end_time);
...@@ -1560,7 +1541,7 @@ static int igt_vm_isolation(void *arg) ...@@ -1560,7 +1541,7 @@ static int igt_vm_isolation(void *arg)
err = read_from_scratch(ctx_b, engine, err = read_from_scratch(ctx_b, engine,
offset, &value); offset, &value);
if (err) if (err)
goto out_rpm; goto out_unlock;
if (value) { if (value) {
pr_err("%s: Read %08x from scratch (offset 0x%08x_%08x), after %lu reads!\n", pr_err("%s: Read %08x from scratch (offset 0x%08x_%08x), after %lu reads!\n",
...@@ -1569,7 +1550,7 @@ static int igt_vm_isolation(void *arg) ...@@ -1569,7 +1550,7 @@ static int igt_vm_isolation(void *arg)
lower_32_bits(offset), lower_32_bits(offset),
this); this);
err = -EINVAL; err = -EINVAL;
goto out_rpm; goto out_unlock;
} }
this++; this++;
...@@ -1579,8 +1560,6 @@ static int igt_vm_isolation(void *arg) ...@@ -1579,8 +1560,6 @@ static int igt_vm_isolation(void *arg)
pr_info("Checked %lu scratch offsets across %d engines\n", pr_info("Checked %lu scratch offsets across %d engines\n",
count, RUNTIME_INFO(i915)->num_engines); count, RUNTIME_INFO(i915)->num_engines);
out_rpm:
intel_runtime_pm_put(&i915->runtime_pm, wakeref);
out_unlock: out_unlock:
if (igt_live_test_end(&t)) if (igt_live_test_end(&t))
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