* [PATCH] drm/i915/selftests: Exercise reset to break stuck GTT eviction
@ 2018-07-16 11:45 Chris Wilson
2018-07-16 12:00 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Chris Wilson @ 2018-07-16 11:45 UTC (permalink / raw)
To: intel-gfx
We must be able to reset the GPU while we are waiting on it to perform
an eviction (unbinding an active vma). So attach a spinning request to a
target vma and try and it evict it from a thread to see if that blocks
indefinitely.
v2: Add a wait for the thread to start just in case that takes more than
10ms...
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
There are quite a few functions that indirectly wait, which should we
cover? Should we more or less just exercise i915_vma_unbind(),
fence_update(), or try and cover the callers should they be adapted
differently in future?
-Chris
---
.../gpu/drm/i915/selftests/intel_hangcheck.c | 171 +++++++++++++++++-
1 file changed, 169 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
index 73462a65a330..48c00a96ce72 100644
--- a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
+++ b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
@@ -27,6 +27,7 @@
#include "../i915_selftest.h"
#include "i915_random.h"
#include "igt_flush_test.h"
+#include "igt_wedge_me.h"
#include "mock_context.h"
#include "mock_drm.h"
@@ -921,7 +922,7 @@ static u32 fake_hangcheck(struct i915_request *rq, u32 mask)
return reset_count;
}
-static int igt_wait_reset(void *arg)
+static int igt_reset_wait(void *arg)
{
struct drm_i915_private *i915 = arg;
struct i915_request *rq;
@@ -995,6 +996,170 @@ static int igt_wait_reset(void *arg)
return err;
}
+struct evict_vma {
+ struct completion completion;
+ struct i915_vma *vma;
+};
+
+static int evict_vma(void *data)
+{
+ struct evict_vma *arg = data;
+ struct i915_address_space *vm = arg->vma->vm;
+ struct drm_i915_private *i915 = vm->i915;
+ struct drm_mm_node evict = arg->vma->node;
+ int err;
+
+ completion_done(&arg->completion);
+
+ mutex_lock(&i915->drm.struct_mutex);
+ err = i915_gem_evict_for_node(vm, &evict, 0);
+ mutex_unlock(&i915->drm.struct_mutex);
+
+ return err;
+}
+
+static int __igt_reset_evict_vma(struct drm_i915_private *i915,
+ struct i915_address_space *vm)
+{
+ struct drm_i915_gem_object *obj;
+ struct task_struct *tsk = NULL;
+ struct i915_request *rq;
+ struct evict_vma arg;
+ struct hang h;
+ int err;
+
+ if (!intel_engine_can_store_dword(i915->engine[RCS]))
+ return 0;
+
+ /* Check that we can recover an unbind stuck on a hanging request */
+
+ global_reset_lock(i915);
+
+ mutex_lock(&i915->drm.struct_mutex);
+ err = hang_init(&h, i915);
+ if (err)
+ goto unlock;
+
+ obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
+ if (IS_ERR(obj)) {
+ err = PTR_ERR(obj);
+ goto fini;
+ }
+
+ arg.vma = i915_vma_instance(obj, vm, NULL);
+ if (IS_ERR(arg.vma)) {
+ err = PTR_ERR(arg.vma);
+ goto out_obj;
+ }
+
+ rq = hang_create_request(&h, i915->engine[RCS]);
+ if (IS_ERR(rq)) {
+ err = PTR_ERR(rq);
+ goto out_obj;
+ }
+
+ err = i915_vma_pin(arg.vma, 0, 0,
+ i915_vma_is_ggtt(arg.vma) ? PIN_GLOBAL : PIN_USER);
+ if (err)
+ goto out_obj;
+
+ err = i915_vma_move_to_active(arg.vma, rq, EXEC_OBJECT_WRITE);
+ i915_vma_unpin(arg.vma);
+
+ i915_request_get(rq);
+ i915_request_add(rq);
+ if (err)
+ goto out_rq;
+
+ mutex_unlock(&i915->drm.struct_mutex);
+
+ if (!wait_until_running(&h, rq)) {
+ struct drm_printer p = drm_info_printer(i915->drm.dev);
+
+ pr_err("%s: Failed to start request %x, at %x\n",
+ __func__, rq->fence.seqno, hws_seqno(&h, rq));
+ intel_engine_dump(rq->engine, &p, "%s\n", rq->engine->name);
+
+ i915_gem_set_wedged(i915);
+ goto out_reset;
+ }
+
+ init_completion(&arg.completion);
+
+ tsk = kthread_run(evict_vma, &arg, "igt/evict_vma");
+ if (IS_ERR(tsk)) {
+ err = PTR_ERR(tsk);
+ tsk = NULL;
+ goto out_reset;
+ }
+
+ wait_for_completion(&arg.completion);
+
+ if (wait_for(waitqueue_active(&rq->execute), 10)) {
+ struct drm_printer p = drm_info_printer(i915->drm.dev);
+
+ pr_err("igt/evict_vma kthread did not wait\n");
+ intel_engine_dump(rq->engine, &p, "%s\n", rq->engine->name);
+
+ i915_gem_set_wedged(i915);
+ goto out_reset;
+ }
+
+out_reset:
+ fake_hangcheck(rq, intel_engine_flag(rq->engine));
+
+ if (tsk) {
+ struct igt_wedge_me w;
+
+ /* The reset, even indirectly, should take less than 10ms. */
+ igt_wedge_on_timeout(&w, i915, HZ / 10 /* 100ms timeout*/)
+ err = kthread_stop(tsk);
+ }
+
+ mutex_lock(&i915->drm.struct_mutex);
+out_rq:
+ i915_request_put(rq);
+out_obj:
+ i915_gem_object_put(obj);
+fini:
+ hang_fini(&h);
+unlock:
+ mutex_unlock(&i915->drm.struct_mutex);
+ global_reset_unlock(i915);
+
+ if (i915_terminally_wedged(&i915->gpu_error))
+ return -EIO;
+
+ return err;
+}
+
+static int igt_reset_evict_ggtt(void *arg)
+{
+ struct drm_i915_private *i915 = arg;
+
+ return __igt_reset_evict_vma(i915, &i915->ggtt.vm);
+}
+
+static int igt_reset_evict_ppgtt(void *arg)
+{
+ struct drm_i915_private *i915 = arg;
+ struct i915_gem_context *ctx;
+ int err;
+
+ mutex_lock(&i915->drm.struct_mutex);
+ ctx = kernel_context(i915);
+ mutex_unlock(&i915->drm.struct_mutex);
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
+
+ err = 0;
+ if (ctx->ppgtt) /* aliasing == global gtt locking, covered above */
+ err = __igt_reset_evict_vma(i915, &ctx->ppgtt->vm);
+
+ kernel_context_close(ctx);
+ return err;
+}
+
static int wait_for_others(struct drm_i915_private *i915,
struct intel_engine_cs *exclude)
{
@@ -1240,8 +1405,10 @@ int intel_hangcheck_live_selftests(struct drm_i915_private *i915)
SUBTEST(igt_reset_idle_engine),
SUBTEST(igt_reset_active_engine),
SUBTEST(igt_reset_engines),
- SUBTEST(igt_wait_reset),
SUBTEST(igt_reset_queue),
+ SUBTEST(igt_reset_wait),
+ SUBTEST(igt_reset_evict_ggtt),
+ SUBTEST(igt_reset_evict_ppgtt),
SUBTEST(igt_handle_error),
};
bool saved_hangcheck;
--
2.18.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread
* ✗ Fi.CI.CHECKPATCH: warning for drm/i915/selftests: Exercise reset to break stuck GTT eviction
2018-07-16 11:45 [PATCH] drm/i915/selftests: Exercise reset to break stuck GTT eviction Chris Wilson
@ 2018-07-16 12:00 ` Patchwork
2018-07-16 12:25 ` ✗ Fi.CI.BAT: failure " Patchwork
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-07-16 12:00 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/selftests: Exercise reset to break stuck GTT eviction
URL : https://patchwork.freedesktop.org/series/46593/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip
b5b59b84a80b drm/i915/selftests: Exercise reset to break stuck GTT eviction
-:142: WARNING:WAITQUEUE_ACTIVE: waitqueue_active without comment
#142: FILE: drivers/gpu/drm/i915/selftests/intel_hangcheck.c:1098:
+ if (wait_for(waitqueue_active(&rq->execute), 10)) {
total: 0 errors, 1 warnings, 0 checks, 196 lines checked
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
* ✗ Fi.CI.BAT: failure for drm/i915/selftests: Exercise reset to break stuck GTT eviction
2018-07-16 11:45 [PATCH] drm/i915/selftests: Exercise reset to break stuck GTT eviction Chris Wilson
2018-07-16 12:00 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
@ 2018-07-16 12:25 ` Patchwork
2018-07-16 13:40 ` [PATCH] " Chris Wilson
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-07-16 12:25 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/selftests: Exercise reset to break stuck GTT eviction
URL : https://patchwork.freedesktop.org/series/46593/
State : failure
== Summary ==
= CI Bug Log - changes from CI_DRM_4493 -> Patchwork_9670 =
== Summary - FAILURE ==
Serious unknown changes coming with Patchwork_9670 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_9670, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/46593/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in Patchwork_9670:
=== IGT changes ===
==== Possible regressions ====
igt@drv_selftest@live_hangcheck:
fi-hsw-peppy: PASS -> INCOMPLETE
fi-hsw-4770r: PASS -> INCOMPLETE
fi-blb-e6850: PASS -> INCOMPLETE
fi-pnv-d510: PASS -> INCOMPLETE
fi-cfl-8700k: PASS -> INCOMPLETE
{fi-cfl-8109u}: PASS -> INCOMPLETE
fi-cfl-s3: PASS -> INCOMPLETE
fi-bwr-2160: PASS -> INCOMPLETE
fi-snb-2600: PASS -> INCOMPLETE
fi-whl-u: PASS -> INCOMPLETE
fi-ivb-3520m: PASS -> INCOMPLETE
fi-hsw-4770: PASS -> INCOMPLETE
fi-ivb-3770: PASS -> INCOMPLETE
fi-ilk-650: PASS -> INCOMPLETE
fi-bsw-n3050: PASS -> INCOMPLETE
igt@drv_selftest@live_workarounds:
{fi-cfl-8109u}: PASS -> DMESG-FAIL
==== Warnings ====
igt@drv_selftest@live_guc:
fi-kbl-7567u: PASS -> SKIP +1
igt@drv_selftest@live_hangcheck:
fi-bdw-5557u: DMESG-FAIL (fdo#106560) -> INCOMPLETE
== Known issues ==
Here are the changes found in Patchwork_9670 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@drv_selftest@live_hangcheck:
{fi-kbl-8809g}: NOTRUN -> INCOMPLETE (fdo#107207)
fi-kbl-7500u: PASS -> INCOMPLETE (fdo#107207)
fi-skl-6700hq: NOTRUN -> INCOMPLETE (fdo#107207)
fi-skl-gvtdvm: PASS -> INCOMPLETE (fdo#105600, fdo#107207)
fi-skl-6700k2: PASS -> INCOMPLETE (fdo#107207)
fi-elk-e7500: PASS -> INCOMPLETE (fdo#103989)
fi-cfl-guc: PASS -> INCOMPLETE (fdo#106693)
fi-skl-guc: PASS -> DMESG-FAIL (fdo#107174)
fi-skl-6600u: PASS -> INCOMPLETE (fdo#107207)
fi-kbl-r: PASS -> INCOMPLETE (fdo#107207)
fi-byt-n2820: PASS -> INCOMPLETE (fdo#102657)
fi-kbl-guc: PASS -> INCOMPLETE (fdo#107207, fdo#106693)
fi-skl-6770hq: PASS -> INCOMPLETE (fdo#107207)
fi-bxt-dsi: PASS -> INCOMPLETE (fdo#103927)
fi-bxt-j4205: PASS -> INCOMPLETE (fdo#103927)
fi-skl-6260u: PASS -> INCOMPLETE (fdo#107207)
fi-glk-j4005: PASS -> INCOMPLETE (fdo#103359, k.org#198133, fdo#107207)
fi-bdw-gvtdvm: PASS -> INCOMPLETE (fdo#105600)
fi-kbl-x1275: PASS -> INCOMPLETE (fdo#107207)
fi-kbl-7567u: PASS -> DMESG-FAIL (fdo#106947, fdo#106560)
fi-glk-dsi: PASS -> INCOMPLETE (fdo#107207)
igt@gem_mmap_gtt@basic-copy:
{fi-kbl-8809g}: NOTRUN -> DMESG-WARN (fdo#107222)
igt@gem_mmap_gtt@basic-wc:
{fi-kbl-8809g}: NOTRUN -> DMESG-WARN (fdo#107221) +6
igt@gem_ringfill@basic-default-hang:
{fi-kbl-8809g}: NOTRUN -> DMESG-WARN (fdo#107222, fdo#107221)
igt@prime_vgem@basic-fence-flip:
fi-ilk-650: PASS -> FAIL (fdo#104008)
==== Warnings ====
igt@gem_exec_suspend@basic-s4-devices:
{fi-kbl-8809g}: INCOMPLETE (fdo#107139) -> DMESG-WARN (fdo#107139)
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
fdo#102657 https://bugs.freedesktop.org/show_bug.cgi?id=102657
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fdo#105600 https://bugs.freedesktop.org/show_bug.cgi?id=105600
fdo#106560 https://bugs.freedesktop.org/show_bug.cgi?id=106560
fdo#106693 https://bugs.freedesktop.org/show_bug.cgi?id=106693
fdo#106947 https://bugs.freedesktop.org/show_bug.cgi?id=106947
fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139
fdo#107174 https://bugs.freedesktop.org/show_bug.cgi?id=107174
fdo#107207 https://bugs.freedesktop.org/show_bug.cgi?id=107207
fdo#107221 https://bugs.freedesktop.org/show_bug.cgi?id=107221
fdo#107222 https://bugs.freedesktop.org/show_bug.cgi?id=107222
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133
== Participating hosts (44 -> 39) ==
Additional (1): fi-skl-6700hq
Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-snb-2520m fi-ctg-p8600 fi-kbl-7560u
== Build changes ==
* Linux: CI_DRM_4493 -> Patchwork_9670
CI_DRM_4493: c69b4c1274cccaa270c1e4daa68228724c80603a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4558: d8e97e1710b27a3931a1c53d1dd88c0e709c085b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9670: b5b59b84a80bcce4823fc7f8dfa337ec1a1c9dca @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
b5b59b84a80b drm/i915/selftests: Exercise reset to break stuck GTT eviction
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9670/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] drm/i915/selftests: Exercise reset to break stuck GTT eviction
2018-07-16 11:45 [PATCH] drm/i915/selftests: Exercise reset to break stuck GTT eviction Chris Wilson
2018-07-16 12:00 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2018-07-16 12:25 ` ✗ Fi.CI.BAT: failure " Patchwork
@ 2018-07-16 13:40 ` Chris Wilson
2018-07-16 13:43 ` Tvrtko Ursulin
2018-07-16 18:16 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/selftests: Exercise reset to break stuck GTT eviction (rev2) Patchwork
2018-07-16 18:37 ` ✗ Fi.CI.BAT: failure " Patchwork
4 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2018-07-16 13:40 UTC (permalink / raw)
To: intel-gfx
We must be able to reset the GPU while we are waiting on it to perform
an eviction (unbinding an active vma). So attach a spinning request to a
target vma and try and it evict it from a thread to see if that blocks
indefinitely.
v2: Add a wait for the thread to start just in case that takes more than
10ms...
v3: complete() not completion_done() to signal the completion.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
.../gpu/drm/i915/selftests/intel_hangcheck.c | 171 +++++++++++++++++-
1 file changed, 169 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
index 73462a65a330..65d66cdedd26 100644
--- a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
+++ b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
@@ -27,6 +27,7 @@
#include "../i915_selftest.h"
#include "i915_random.h"
#include "igt_flush_test.h"
+#include "igt_wedge_me.h"
#include "mock_context.h"
#include "mock_drm.h"
@@ -921,7 +922,7 @@ static u32 fake_hangcheck(struct i915_request *rq, u32 mask)
return reset_count;
}
-static int igt_wait_reset(void *arg)
+static int igt_reset_wait(void *arg)
{
struct drm_i915_private *i915 = arg;
struct i915_request *rq;
@@ -995,6 +996,170 @@ static int igt_wait_reset(void *arg)
return err;
}
+struct evict_vma {
+ struct completion completion;
+ struct i915_vma *vma;
+};
+
+static int evict_vma(void *data)
+{
+ struct evict_vma *arg = data;
+ struct i915_address_space *vm = arg->vma->vm;
+ struct drm_i915_private *i915 = vm->i915;
+ struct drm_mm_node evict = arg->vma->node;
+ int err;
+
+ complete(&arg->completion);
+
+ mutex_lock(&i915->drm.struct_mutex);
+ err = i915_gem_evict_for_node(vm, &evict, 0);
+ mutex_unlock(&i915->drm.struct_mutex);
+
+ return err;
+}
+
+static int __igt_reset_evict_vma(struct drm_i915_private *i915,
+ struct i915_address_space *vm)
+{
+ struct drm_i915_gem_object *obj;
+ struct task_struct *tsk = NULL;
+ struct i915_request *rq;
+ struct evict_vma arg;
+ struct hang h;
+ int err;
+
+ if (!intel_engine_can_store_dword(i915->engine[RCS]))
+ return 0;
+
+ /* Check that we can recover an unbind stuck on a hanging request */
+
+ global_reset_lock(i915);
+
+ mutex_lock(&i915->drm.struct_mutex);
+ err = hang_init(&h, i915);
+ if (err)
+ goto unlock;
+
+ obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
+ if (IS_ERR(obj)) {
+ err = PTR_ERR(obj);
+ goto fini;
+ }
+
+ arg.vma = i915_vma_instance(obj, vm, NULL);
+ if (IS_ERR(arg.vma)) {
+ err = PTR_ERR(arg.vma);
+ goto out_obj;
+ }
+
+ rq = hang_create_request(&h, i915->engine[RCS]);
+ if (IS_ERR(rq)) {
+ err = PTR_ERR(rq);
+ goto out_obj;
+ }
+
+ err = i915_vma_pin(arg.vma, 0, 0,
+ i915_vma_is_ggtt(arg.vma) ? PIN_GLOBAL : PIN_USER);
+ if (err)
+ goto out_obj;
+
+ err = i915_vma_move_to_active(arg.vma, rq, EXEC_OBJECT_WRITE);
+ i915_vma_unpin(arg.vma);
+
+ i915_request_get(rq);
+ i915_request_add(rq);
+ if (err)
+ goto out_rq;
+
+ mutex_unlock(&i915->drm.struct_mutex);
+
+ if (!wait_until_running(&h, rq)) {
+ struct drm_printer p = drm_info_printer(i915->drm.dev);
+
+ pr_err("%s: Failed to start request %x, at %x\n",
+ __func__, rq->fence.seqno, hws_seqno(&h, rq));
+ intel_engine_dump(rq->engine, &p, "%s\n", rq->engine->name);
+
+ i915_gem_set_wedged(i915);
+ goto out_reset;
+ }
+
+ init_completion(&arg.completion);
+
+ tsk = kthread_run(evict_vma, &arg, "igt/evict_vma");
+ if (IS_ERR(tsk)) {
+ err = PTR_ERR(tsk);
+ tsk = NULL;
+ goto out_reset;
+ }
+
+ wait_for_completion(&arg.completion);
+
+ if (wait_for(waitqueue_active(&rq->execute), 10)) {
+ struct drm_printer p = drm_info_printer(i915->drm.dev);
+
+ pr_err("igt/evict_vma kthread did not wait\n");
+ intel_engine_dump(rq->engine, &p, "%s\n", rq->engine->name);
+
+ i915_gem_set_wedged(i915);
+ goto out_reset;
+ }
+
+out_reset:
+ fake_hangcheck(rq, intel_engine_flag(rq->engine));
+
+ if (tsk) {
+ struct igt_wedge_me w;
+
+ /* The reset, even indirectly, should take less than 10ms. */
+ igt_wedge_on_timeout(&w, i915, HZ / 10 /* 100ms timeout*/)
+ err = kthread_stop(tsk);
+ }
+
+ mutex_lock(&i915->drm.struct_mutex);
+out_rq:
+ i915_request_put(rq);
+out_obj:
+ i915_gem_object_put(obj);
+fini:
+ hang_fini(&h);
+unlock:
+ mutex_unlock(&i915->drm.struct_mutex);
+ global_reset_unlock(i915);
+
+ if (i915_terminally_wedged(&i915->gpu_error))
+ return -EIO;
+
+ return err;
+}
+
+static int igt_reset_evict_ggtt(void *arg)
+{
+ struct drm_i915_private *i915 = arg;
+
+ return __igt_reset_evict_vma(i915, &i915->ggtt.vm);
+}
+
+static int igt_reset_evict_ppgtt(void *arg)
+{
+ struct drm_i915_private *i915 = arg;
+ struct i915_gem_context *ctx;
+ int err;
+
+ mutex_lock(&i915->drm.struct_mutex);
+ ctx = kernel_context(i915);
+ mutex_unlock(&i915->drm.struct_mutex);
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
+
+ err = 0;
+ if (ctx->ppgtt) /* aliasing == global gtt locking, covered above */
+ err = __igt_reset_evict_vma(i915, &ctx->ppgtt->vm);
+
+ kernel_context_close(ctx);
+ return err;
+}
+
static int wait_for_others(struct drm_i915_private *i915,
struct intel_engine_cs *exclude)
{
@@ -1240,8 +1405,10 @@ int intel_hangcheck_live_selftests(struct drm_i915_private *i915)
SUBTEST(igt_reset_idle_engine),
SUBTEST(igt_reset_active_engine),
SUBTEST(igt_reset_engines),
- SUBTEST(igt_wait_reset),
SUBTEST(igt_reset_queue),
+ SUBTEST(igt_reset_wait),
+ SUBTEST(igt_reset_evict_ggtt),
+ SUBTEST(igt_reset_evict_ppgtt),
SUBTEST(igt_handle_error),
};
bool saved_hangcheck;
--
2.18.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/i915/selftests: Exercise reset to break stuck GTT eviction
2018-07-16 13:40 ` [PATCH] " Chris Wilson
@ 2018-07-16 13:43 ` Tvrtko Ursulin
0 siblings, 0 replies; 7+ messages in thread
From: Tvrtko Ursulin @ 2018-07-16 13:43 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
On 16/07/2018 14:40, Chris Wilson wrote:
> We must be able to reset the GPU while we are waiting on it to perform
> an eviction (unbinding an active vma). So attach a spinning request to a
> target vma and try and it evict it from a thread to see if that blocks
> indefinitely.
>
> v2: Add a wait for the thread to start just in case that takes more than
> 10ms...
> v3: complete() not completion_done() to signal the completion.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> .../gpu/drm/i915/selftests/intel_hangcheck.c | 171 +++++++++++++++++-
> 1 file changed, 169 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
> index 73462a65a330..65d66cdedd26 100644
> --- a/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
> +++ b/drivers/gpu/drm/i915/selftests/intel_hangcheck.c
> @@ -27,6 +27,7 @@
> #include "../i915_selftest.h"
> #include "i915_random.h"
> #include "igt_flush_test.h"
> +#include "igt_wedge_me.h"
>
> #include "mock_context.h"
> #include "mock_drm.h"
> @@ -921,7 +922,7 @@ static u32 fake_hangcheck(struct i915_request *rq, u32 mask)
> return reset_count;
> }
>
> -static int igt_wait_reset(void *arg)
> +static int igt_reset_wait(void *arg)
> {
> struct drm_i915_private *i915 = arg;
> struct i915_request *rq;
> @@ -995,6 +996,170 @@ static int igt_wait_reset(void *arg)
> return err;
> }
>
> +struct evict_vma {
> + struct completion completion;
> + struct i915_vma *vma;
> +};
> +
> +static int evict_vma(void *data)
> +{
> + struct evict_vma *arg = data;
> + struct i915_address_space *vm = arg->vma->vm;
> + struct drm_i915_private *i915 = vm->i915;
> + struct drm_mm_node evict = arg->vma->node;
> + int err;
> +
> + complete(&arg->completion);
> +
> + mutex_lock(&i915->drm.struct_mutex);
> + err = i915_gem_evict_for_node(vm, &evict, 0);
> + mutex_unlock(&i915->drm.struct_mutex);
> +
> + return err;
> +}
> +
> +static int __igt_reset_evict_vma(struct drm_i915_private *i915,
> + struct i915_address_space *vm)
> +{
> + struct drm_i915_gem_object *obj;
> + struct task_struct *tsk = NULL;
> + struct i915_request *rq;
> + struct evict_vma arg;
> + struct hang h;
> + int err;
> +
> + if (!intel_engine_can_store_dword(i915->engine[RCS]))
> + return 0;
> +
> + /* Check that we can recover an unbind stuck on a hanging request */
> +
> + global_reset_lock(i915);
> +
> + mutex_lock(&i915->drm.struct_mutex);
> + err = hang_init(&h, i915);
> + if (err)
> + goto unlock;
> +
> + obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
> + if (IS_ERR(obj)) {
> + err = PTR_ERR(obj);
> + goto fini;
> + }
> +
> + arg.vma = i915_vma_instance(obj, vm, NULL);
> + if (IS_ERR(arg.vma)) {
> + err = PTR_ERR(arg.vma);
> + goto out_obj;
> + }
> +
> + rq = hang_create_request(&h, i915->engine[RCS]);
> + if (IS_ERR(rq)) {
> + err = PTR_ERR(rq);
> + goto out_obj;
> + }
> +
> + err = i915_vma_pin(arg.vma, 0, 0,
> + i915_vma_is_ggtt(arg.vma) ? PIN_GLOBAL : PIN_USER);
> + if (err)
> + goto out_obj;
> +
> + err = i915_vma_move_to_active(arg.vma, rq, EXEC_OBJECT_WRITE);
> + i915_vma_unpin(arg.vma);
> +
> + i915_request_get(rq);
> + i915_request_add(rq);
> + if (err)
> + goto out_rq;
> +
> + mutex_unlock(&i915->drm.struct_mutex);
> +
> + if (!wait_until_running(&h, rq)) {
> + struct drm_printer p = drm_info_printer(i915->drm.dev);
> +
> + pr_err("%s: Failed to start request %x, at %x\n",
> + __func__, rq->fence.seqno, hws_seqno(&h, rq));
> + intel_engine_dump(rq->engine, &p, "%s\n", rq->engine->name);
> +
> + i915_gem_set_wedged(i915);
> + goto out_reset;
> + }
> +
> + init_completion(&arg.completion);
> +
> + tsk = kthread_run(evict_vma, &arg, "igt/evict_vma");
> + if (IS_ERR(tsk)) {
> + err = PTR_ERR(tsk);
> + tsk = NULL;
> + goto out_reset;
> + }
> +
> + wait_for_completion(&arg.completion);
> +
> + if (wait_for(waitqueue_active(&rq->execute), 10)) {
> + struct drm_printer p = drm_info_printer(i915->drm.dev);
> +
> + pr_err("igt/evict_vma kthread did not wait\n");
> + intel_engine_dump(rq->engine, &p, "%s\n", rq->engine->name);
> +
> + i915_gem_set_wedged(i915);
> + goto out_reset;
> + }
> +
> +out_reset:
> + fake_hangcheck(rq, intel_engine_flag(rq->engine));
> +
> + if (tsk) {
> + struct igt_wedge_me w;
> +
> + /* The reset, even indirectly, should take less than 10ms. */
> + igt_wedge_on_timeout(&w, i915, HZ / 10 /* 100ms timeout*/)
> + err = kthread_stop(tsk);
> + }
> +
> + mutex_lock(&i915->drm.struct_mutex);
> +out_rq:
> + i915_request_put(rq);
> +out_obj:
> + i915_gem_object_put(obj);
> +fini:
> + hang_fini(&h);
> +unlock:
> + mutex_unlock(&i915->drm.struct_mutex);
> + global_reset_unlock(i915);
> +
> + if (i915_terminally_wedged(&i915->gpu_error))
> + return -EIO;
> +
> + return err;
> +}
> +
> +static int igt_reset_evict_ggtt(void *arg)
> +{
> + struct drm_i915_private *i915 = arg;
> +
> + return __igt_reset_evict_vma(i915, &i915->ggtt.vm);
> +}
> +
> +static int igt_reset_evict_ppgtt(void *arg)
> +{
> + struct drm_i915_private *i915 = arg;
> + struct i915_gem_context *ctx;
> + int err;
> +
> + mutex_lock(&i915->drm.struct_mutex);
> + ctx = kernel_context(i915);
> + mutex_unlock(&i915->drm.struct_mutex);
> + if (IS_ERR(ctx))
> + return PTR_ERR(ctx);
> +
> + err = 0;
> + if (ctx->ppgtt) /* aliasing == global gtt locking, covered above */
> + err = __igt_reset_evict_vma(i915, &ctx->ppgtt->vm);
> +
> + kernel_context_close(ctx);
> + return err;
> +}
> +
> static int wait_for_others(struct drm_i915_private *i915,
> struct intel_engine_cs *exclude)
> {
> @@ -1240,8 +1405,10 @@ int intel_hangcheck_live_selftests(struct drm_i915_private *i915)
> SUBTEST(igt_reset_idle_engine),
> SUBTEST(igt_reset_active_engine),
> SUBTEST(igt_reset_engines),
> - SUBTEST(igt_wait_reset),
> SUBTEST(igt_reset_queue),
> + SUBTEST(igt_reset_wait),
> + SUBTEST(igt_reset_evict_ggtt),
> + SUBTEST(igt_reset_evict_ppgtt),
> SUBTEST(igt_handle_error),
> };
> bool saved_hangcheck;
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
* ✗ Fi.CI.CHECKPATCH: warning for drm/i915/selftests: Exercise reset to break stuck GTT eviction (rev2)
2018-07-16 11:45 [PATCH] drm/i915/selftests: Exercise reset to break stuck GTT eviction Chris Wilson
` (2 preceding siblings ...)
2018-07-16 13:40 ` [PATCH] " Chris Wilson
@ 2018-07-16 18:16 ` Patchwork
2018-07-16 18:37 ` ✗ Fi.CI.BAT: failure " Patchwork
4 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-07-16 18:16 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/selftests: Exercise reset to break stuck GTT eviction (rev2)
URL : https://patchwork.freedesktop.org/series/46593/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip
6c8f1c3ed3ce drm/i915/selftests: Exercise reset to break stuck GTT eviction
-:144: WARNING:WAITQUEUE_ACTIVE: waitqueue_active without comment
#144: FILE: drivers/gpu/drm/i915/selftests/intel_hangcheck.c:1098:
+ if (wait_for(waitqueue_active(&rq->execute), 10)) {
total: 0 errors, 1 warnings, 0 checks, 196 lines checked
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
* ✗ Fi.CI.BAT: failure for drm/i915/selftests: Exercise reset to break stuck GTT eviction (rev2)
2018-07-16 11:45 [PATCH] drm/i915/selftests: Exercise reset to break stuck GTT eviction Chris Wilson
` (3 preceding siblings ...)
2018-07-16 18:16 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/selftests: Exercise reset to break stuck GTT eviction (rev2) Patchwork
@ 2018-07-16 18:37 ` Patchwork
4 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2018-07-16 18:37 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/selftests: Exercise reset to break stuck GTT eviction (rev2)
URL : https://patchwork.freedesktop.org/series/46593/
State : failure
== Summary ==
= CI Bug Log - changes from CI_DRM_4499 -> Patchwork_9678 =
== Summary - FAILURE ==
Serious unknown changes coming with Patchwork_9678 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in Patchwork_9678, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/46593/revisions/2/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in Patchwork_9678:
=== IGT changes ===
==== Possible regressions ====
igt@drv_selftest@live_hangcheck:
fi-cfl-guc: PASS -> DMESG-FAIL
== Known issues ==
Here are the changes found in Patchwork_9678 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@drv_selftest@live_hangcheck:
fi-skl-guc: PASS -> DMESG-FAIL (fdo#107174)
==== Possible fixes ====
igt@drv_selftest@live_coherency:
fi-gdg-551: DMESG-FAIL (fdo#107164) -> PASS
igt@drv_selftest@live_hangcheck:
fi-skl-6260u: DMESG-FAIL (fdo#106560, fdo#107174) -> PASS
igt@gem_exec_suspend@basic-s3:
{fi-cfl-8109u}: INCOMPLETE (fdo#107187) -> PASS
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
fdo#106560 https://bugs.freedesktop.org/show_bug.cgi?id=106560
fdo#107164 https://bugs.freedesktop.org/show_bug.cgi?id=107164
fdo#107174 https://bugs.freedesktop.org/show_bug.cgi?id=107174
fdo#107187 https://bugs.freedesktop.org/show_bug.cgi?id=107187
== Participating hosts (46 -> 41) ==
Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u
== Build changes ==
* Linux: CI_DRM_4499 -> Patchwork_9678
CI_DRM_4499: 30c05928fc8cdb8bbbf052fec71f484654cf2a49 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4558: d8e97e1710b27a3931a1c53d1dd88c0e709c085b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9678: 6c8f1c3ed3ce992b781cf0253858aa6cd220ff74 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
6c8f1c3ed3ce drm/i915/selftests: Exercise reset to break stuck GTT eviction
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9678/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-07-16 18:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 11:45 [PATCH] drm/i915/selftests: Exercise reset to break stuck GTT eviction Chris Wilson
2018-07-16 12:00 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2018-07-16 12:25 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-07-16 13:40 ` [PATCH] " Chris Wilson
2018-07-16 13:43 ` Tvrtko Ursulin
2018-07-16 18:16 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/selftests: Exercise reset to break stuck GTT eviction (rev2) Patchwork
2018-07-16 18:37 ` ✗ Fi.CI.BAT: failure " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.