Skip to contentSkip to conversation

drm/i915/selftests: Move test flush to outside vm->mutex

PATCH In review Tvrtko Ursulin 3 participants 5 messages Jun 12, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/selftests: Move test flush to outside vm->mutex

From: Tvrtko Ursulin <[email protected]>

As per our locking rules it is not allowed to wait on requests while holding locks. In this case we were trying to idle the GPU while holding the vm->mutex.

---
 drivers/gpu/drm/i915/selftests/i915_gem_evict.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/selftests/i915_gem_evict.c +3 -2
index 028baae9631f..67f4497c8224 100644
@@ -498,8 +498,6 @@ static int igt_evict_contexts(void *arg)
 
 	mutex_lock(&ggtt->vm.mutex);
 out_locked:
-	if (igt_flush_test(i915))
-		err = -EIO;
 	while (reserved) {
 		struct reserved *next = reserved->next;
 
@@ -513,6 +511,9 @@ static int igt_evict_contexts(void *arg)
 	mutex_unlock(&ggtt->vm.mutex);
 	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
 
+	if (igt_flush_test(i915))
+		err = -EIO;
+
 	return err;
 }
 
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Quoting Tvrtko Ursulin (2020-06-12 15:44:51)

Quoted 5 lines

From: Tvrtko Ursulin <[email protected]>

As per our locking rules it is not allowed to wait on requests while holding locks. In this case we were trying to idle the GPU while holding the vm->mutex.

Synchronous eviction would like to have a word.

Quoted 19 lines
---
 drivers/gpu/drm/i915/selftests/i915_gem_evict.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/selftests/i915_gem_evict.c +0 -2
index 028baae9631f..67f4497c8224 100644
@@ -498,8 +498,6 @@ static int igt_evict_contexts(void *arg)
 
        mutex_lock(&ggtt->vm.mutex);
 out_locked:
-       if (igt_flush_test(i915))
-               err = -EIO;
        while (reserved) {
                struct reserved *next = reserved->next;
 

drivers/gpu/drm/i915/selftests/i915_gem_evict.c static int igt_evict_contexts(void *arg) · line 515

Quoted 5 lines
drivers/gpu/drm/i915/selftests/i915_gem_evict.c +2 -0
@@ -513,6 +511,9 @@ static int igt_evict_contexts(void *arg)
        mutex_unlock(&ggtt->vm.mutex);
        intel_runtime_pm_put(&i915->runtime_pm, wakeref);
 
+       if (igt_flush_test(i915))
+               err = -EIO;

The patch is ok, since the manual drm_mm_node reservations are not used by the GTT, but the reason is a bit specious.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 31 lines · Chris Wilson

Quoting Tvrtko Ursulin (2020-06-12 15:44:51)

Quoted 5 lines

From: Tvrtko Ursulin <[email protected]>

As per our locking rules it is not allowed to wait on requests while holding locks. In this case we were trying to idle the GPU while holding the vm->mutex.

Synchronous eviction would like to have a word.

Quoted 22 lines
---
  drivers/gpu/drm/i915/selftests/i915_gem_evict.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/selftests/i915_gem_evict.c +0 -2
index 028baae9631f..67f4497c8224 100644
@@ -498,8 +498,6 @@ static int igt_evict_contexts(void *arg)
 
         mutex_lock(&ggtt->vm.mutex);
  out_locked:
-       if (igt_flush_test(i915))
-               err = -EIO;
         while (reserved) {
                 struct reserved *next = reserved->next;
 
@@ -513,6 +511,9 @@ static int igt_evict_contexts(void *arg)
         mutex_unlock(&ggtt->vm.mutex);
         intel_runtime_pm_put(&i915->runtime_pm, wakeref);
 
Quoted 5 lines

drivers/gpu/drm/i915/selftests/i915_gem_evict.c static int igt_evict_contexts(void *arg) · line 515

Quoted 2 lines
drivers/gpu/drm/i915/selftests/i915_gem_evict.c +2 -0
+       if (igt_flush_test(i915))
+               err = -EIO;

The patch is ok, since the manual drm_mm_node reservations are not used by the GTT, but the reason is a bit specious.

We have a comment in i915_request_wait which says:

/*
* We must never wait on the GPU while holding a lock as we
* may need to perform a GPU reset. So while we don't need to
* serialise wait/reset with an explicit lock, we do want
* lockdep to detect potential dependency cycles. */

And then there was a lockdep splat here https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_6595/fi-skl-6700k2/igt@i915_selftest@[email protected], which although uses some extra lockdep annotation patches, seemed to connect the two:

<4> [258.014638] Chain exists of:
&gt->reset.mutex --> fs_reclaim --> &vm->mutex
<4> [258.014640] Possible unsafe locking scenario:

<4> [258.014641]        CPU0                    CPU1
<4> [258.014641]        ----                    ----

<4> [258.014642] lock(&vm->mutex);
<4> [258.014642] lock(fs_reclaim);
<4> [258.014643] lock(&vm->mutex);
<4> [258.014644] lock(&gt->reset.mutex);
<4> [258.014645]
*** DEADLOCK ***
<4> [258.014646] 2 locks held by i915_selftest/5153:

Why despite the comment in request wait it does not otherwise see this I don't know.

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Quoting Tvrtko Ursulin (2020-06-12 16:04:15)

Quoted 39 lines · Chris Wilson
Quoted 31 lines

Quoting Tvrtko Ursulin (2020-06-12 15:44:51)

Quoted 5 lines

From: Tvrtko Ursulin <[email protected]>

As per our locking rules it is not allowed to wait on requests while holding locks. In this case we were trying to idle the GPU while holding the vm->mutex.

Synchronous eviction would like to have a word.

Quoted 22 lines
---
  drivers/gpu/drm/i915/selftests/i915_gem_evict.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/selftests/i915_gem_evict.c +0 -2
index 028baae9631f..67f4497c8224 100644
@@ -498,8 +498,6 @@ static int igt_evict_contexts(void *arg)
 
         mutex_lock(&ggtt->vm.mutex);
  out_locked:
-       if (igt_flush_test(i915))
-               err = -EIO;
         while (reserved) {
                 struct reserved *next = reserved->next;
 
@@ -513,6 +511,9 @@ static int igt_evict_contexts(void *arg)
         mutex_unlock(&ggtt->vm.mutex);
         intel_runtime_pm_put(&i915->runtime_pm, wakeref);
 
Quoted 5 lines

drivers/gpu/drm/i915/selftests/i915_gem_evict.c static int igt_evict_contexts(void *arg) · line 515

Quoted 2 lines
drivers/gpu/drm/i915/selftests/i915_gem_evict.c +2 -0
+       if (igt_flush_test(i915))
+               err = -EIO;

The patch is ok, since the manual drm_mm_node reservations are not used by the GTT, but the reason is a bit specious.

Quoted 8 lines

We have a comment in i915_request_wait which says:

/*
* We must never wait on the GPU while holding a lock as we
* may need to perform a GPU reset. So while we don't need to
* serialise wait/reset with an explicit lock, we do want
* lockdep to detect potential dependency cycles. */

That's for a lock used by reset.

Quoted 10 lines

And then there was a lockdep splat here
https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_6595/fi-skl-6700k2/igt@i915_selftest@[email protected],
which although uses some extra lockdep annotation patches, seemed to connect the two:

<4> [258.014638] Chain exists of:

   &gt->reset.mutex --> fs_reclaim --> &vm->mutex
<4> [258.014640]  Possible unsafe locking scenario:
<4> [258.014641]        CPU0                    CPU1
<4> [258.014641]        ----                    ----
Quoted 7 lines

<4> [258.014642] lock(&vm->mutex);
<4> [258.014642] lock(fs_reclaim);
<4> [258.014643] lock(&vm->mutex);
<4> [258.014644] lock(&gt->reset.mutex);
<4> [258.014645]
*** DEADLOCK ***
<4> [258.014646] 2 locks held by i915_selftest/5153:

is false.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/selftests: Move test flush to outside vm->mutex

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915/selftests: Move test flush to outside vm->mutex
URL : https://patchwork.freedesktop.org/series/78263/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_8621 -> Patchwork_17940
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_17940 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_17940, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_17940:

### IGT changes ###

#### Possible regressions ####

* igt@runner@aborted:
- fi-bdw-5557u: NOTRUN -> [FAIL][1]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/fi-bdw-5557u/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_17940 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_pm_rpm@basic-pci-d3-state:
- fi-bsw-kefka: [PASS][2] -> [DMESG-WARN][3] ([i915#1982])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8621/fi-bsw-kefka/igt@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/fi-bsw-kefka/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-byt-j1900: [PASS][4] -> [DMESG-WARN][5] ([i915#1982])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8621/fi-byt-j1900/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/fi-byt-j1900/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@execlists:
- fi-icl-y: [DMESG-FAIL][6] ([i915#1993]) -> [PASS][7]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8621/fi-icl-y/igt@i915_selftest@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/fi-icl-y/igt@i915_selftest@[email protected]

* igt@kms_busy@basic@flip:
- fi-kbl-x1275: [DMESG-WARN][8] ([i915#62] / [i915#92] / [i915#95]) -> [PASS][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8621/fi-kbl-x1275/igt@kms_busy@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/fi-kbl-x1275/igt@kms_busy@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
- fi-icl-u2: [DMESG-WARN][10] ([i915#1982]) -> [PASS][11]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8621/fi-icl-u2/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/fi-icl-u2/igt@[email protected]
- fi-bsw-kefka: [DMESG-WARN][12] ([i915#1982]) -> [PASS][13]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8621/fi-bsw-kefka/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/fi-bsw-kefka/igt@[email protected]

* igt@kms_cursor_legacy@basic-flip-after-cursor-legacy:
- fi-icl-guc: [DMESG-WARN][14] ([i915#1982]) -> [PASS][15]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8621/fi-icl-guc/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/fi-icl-guc/igt@[email protected]

#### Warnings ####

* igt@kms_cursor_legacy@basic-flip-before-cursor-legacy:
- fi-kbl-x1275: [DMESG-WARN][16] ([i915#62] / [i915#92] / [i915#95]) -> [DMESG-WARN][17] ([i915#62] / [i915#92]) +3 similar issues
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8621/fi-kbl-x1275/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/fi-kbl-x1275/igt@[email protected]

* igt@kms_flip@basic-flip-vs-wf_vblank@a-dp1:
- fi-kbl-x1275: [DMESG-WARN][18] ([i915#62] / [i915#92]) -> [DMESG-WARN][19] ([i915#62] / [i915#92] / [i915#95]) +2 similar issues
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8621/fi-kbl-x1275/igt@kms_flip@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/fi-kbl-x1275/igt@kms_flip@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#1569]: https://gitlab.freedesktop.org/drm/intel/issues/1569
[i915#192]: https://gitlab.freedesktop.org/drm/intel/issues/192
[i915#193]: https://gitlab.freedesktop.org/drm/intel/issues/193
[i915#194]: https://gitlab.freedesktop.org/drm/intel/issues/194
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#1993]: https://gitlab.freedesktop.org/drm/intel/issues/1993
[i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
[i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95

Participating hosts (49 -> 43)
------------------------------

Additional (1): fi-tgl-u2
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_8621 -> Patchwork_17940

CI-20190529: 20190529
CI_DRM_8621: acd803311fbd1e6adc38d10ca382a60c6c190be9 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5708: f66c71e29de50bae880bc81ceb0517d4e3e2dfd8 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17940: 8b6f27bd82d1191bf0bd086a8a96b232da034db2 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

8b6f27bd82d1 drm/i915/selftests: Move test flush to outside vm->mutex

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17940/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx