drm/i915: Neuter virtual rq->engine on retire
Subsystems (2)
PATCH 1/1 drm/i915: Neuter virtual rq->engine on retire
We do not hold a reference to rq->engine, and so if it is a virtual engine it may have already been freed by the time we free the request. The last reference we hold on the virtual engine is via rq->context, and that is released on request retirement. So if we find ourselves retiring a virtual request, redirect it to a real sibling.
--- drivers/gpu/drm/i915/i915_request.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/gpu/drm/i915/i915_request.c +17 -0
@@ -242,9 +242,26 @@ static void remove_from_engine(struct i915_request *rq)spin_lock (&engine->active.lock); locked = engine; } +list_del_init (&rq->sched.link);clear_bit (I915_FENCE_FLAG_PQUEUE , &rq->fence.flags);clear_bit (I915_FENCE_FLAG_HOLD , &rq->fence.flags); + +/* +* During i915_fence_release we stash one request on the +* rq->engine for use as an emergency reserve. However, we +* neither want to keep a request on a virtual engine, nor do +* we hold a reference to a virtual engine at that point. So +* if rq->engine is virtual, replace it with a real one. Which +* one is immaterial at this point as the request has been +* retired, and if it was a virtual engine will not have any +* signaling or other related paraphernalia. +* +* However, it would be nice if we didn't have to... +*/ +if (intel_engine_is_virtual (rq->engine)) + rq->engine =intel_virtual_engine_get_sibling (rq->engine,0 ); +spin_unlock_irq (&locked->active.lock); }
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Chris Wilson (2020-05-19 15:51:31)
Quoted 30 lines
We do not hold a reference to
rq->engine, and so if it is a virtual engine it may have already been freed by the time we free the request. The last reference we hold on the virtual engine is viarq->context, and that is released on request retirement. So if we find ourselves retiring a virtual request, redirect it to a real sibling.Fixes 43acd6516ca9 ("drm/i915: Keep a per-engine request pool")Signed-off-by Chris Wilson <[email protected]>Cc Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/i915_request.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/gpu/drm/i915/i915_request.c +5
-0@@ -242,9 +242,26 @@ static void remove_from_engine(struct i915_request *rq)spin_lock (&engine->active.lock); locked = engine; } +list_del_init (&rq->sched.link);clear_bit (I915_FENCE_FLAG_PQUEUE , &rq->fence.flags);clear_bit (I915_FENCE_FLAG_HOLD , &rq->fence.flags); + +/* +* During i915_fence_release we stash one request on the +* rq->engine for use as an emergency reserve. However, we
drivers/gpu/drm/i915/i915_request.c static void remove_from_engine(struct i915_request *rq) · line 262
Quoted 10 lines
drivers/gpu/drm/i915/i915_request.c +10
-0+* neither want to keep a request on a virtual engine, nor do +* we hold a reference to a virtual engine at that point. So +* if rq->engine is virtual, replace it with a real one. Which +* one is immaterial at this point as the request has been +* retired, and if it was a virtual engine will not have any +* signaling or other related paraphernalia. +* +* However, it would be nice if we didn't have to... +*/ +if (intel_engine_is_virtual (rq->engine))
Hmm. execlists_dequeue will assert that rq->engine == veng before finding out that the request was completed. Annoyingly we would need some veng magic to cmpxchg(&ve->request, rq, NULL)
drivers/gpu/drm/i915/i915_request.c static void remove_from_engine(struct i915_request *rq) · line 263
Quoted 1 line
drivers/gpu/drm/i915/i915_request.c +1
-0+ rq->engine =intel_virtual_engine_get_sibling (rq->engine,0 );
Back to the drawing board for a bit. Although removing the assert might be the easiest course of action.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Chris Wilson (2020-05-19 18:00:04)
Quoted 46 lines
Quoting Chris Wilson (2020-05-19 15:51:31)
Quoted 30 lines
We do not hold a reference to
rq->engine, and so if it is a virtual engine it may have already been freed by the time we free the request. The last reference we hold on the virtual engine is viarq->context, and that is released on request retirement. So if we find ourselves retiring a virtual request, redirect it to a real sibling.Fixes 43acd6516ca9 ("drm/i915: Keep a per-engine request pool")Signed-off-by Chris Wilson <[email protected]>Cc Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/i915_request.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/gpu/drm/i915/i915_request.c +5
-0@@ -242,9 +242,26 @@ static void remove_from_engine(struct i915_request *rq)spin_lock (&engine->active.lock); locked = engine; } +list_del_init (&rq->sched.link);clear_bit (I915_FENCE_FLAG_PQUEUE , &rq->fence.flags);clear_bit (I915_FENCE_FLAG_HOLD , &rq->fence.flags); + +/* +* During i915_fence_release we stash one request on the +* rq->engine for use as an emergency reserve. However, we drivers/gpu/drm/i915/i915_request.c static void remove_from_engine(struct i915_request *rq) · line 262
Quoted 10 lines
drivers/gpu/drm/i915/i915_request.c +10
-0+* neither want to keep a request on a virtual engine, nor do +* we hold a reference to a virtual engine at that point. So +* if rq->engine is virtual, replace it with a real one. Which +* one is immaterial at this point as the request has been +* retired, and if it was a virtual engine will not have any +* signaling or other related paraphernalia. +* +* However, it would be nice if we didn't have to... +*/ +if (intel_engine_is_virtual (rq->engine))Hmm.
execlists_dequeuewill assert thatrq->engine== veng before finding out that the request was completed. Annoyingly we would need some veng magic tocmpxchg(&ve->request, rq, NULL)
Quoted 4 lines
drivers/gpu/drm/i915/i915_request.c static void remove_from_engine(struct i915_request *rq) · line 263
Quoted 1 line
drivers/gpu/drm/i915/i915_request.c +1
-0+ rq->engine =intel_virtual_engine_get_sibling (rq->engine,0 );Back to the drawing board for a bit. Although removing the assert might be the easiest course of action.
A viable alternative would appear not to be to reset rq->engine back to veng on preemption. It's currently done for consistency, but correctness trumps consistency. :|
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Neuter virtual rq->engine on retire
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: drm/i915: Neuter virtual rq->engine on retire
URL : https://patchwork.freedesktop.org/series/77425/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_8506 -> Patchwork_17714
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/index.html
Known issues
------------
Here are the changes found in Patchwork_17714 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live@execlists:
- fi-skl-lmem: [PASS][1] -> [INCOMPLETE][2] ([i915#1874])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/fi-skl-lmem/igt@i915_selftest@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/fi-skl-lmem/igt@i915_selftest@[email protected]
* igt@kms_chamelium@hdmi-crc-fast:
- fi-kbl-7500u: [PASS][3] -> [FAIL][4] ([i915#1372])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/fi-kbl-7500u/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/fi-kbl-7500u/igt@[email protected]
#### Possible fixes ####
* igt@i915_selftest@live@execlists:
- fi-kbl-8809g: [INCOMPLETE][5] ([i915#1874]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/fi-kbl-8809g/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/fi-kbl-8809g/igt@i915_selftest@[email protected]
[i915#1372]: https://gitlab.freedesktop.org/drm/intel/issues/1372
[i915#1874]: https://gitlab.freedesktop.org/drm/intel/issues/1874
Participating hosts (49 -> 43)
------------------------------
Missing (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper fi-bdw-samus
Build changes
-------------
* Linux: CI_DRM_8506 -> Patchwork_17714
CI-20190529: 20190529
CI_DRM_8506: d6a73e9084ff6adfabbad014bc294d254484f304 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5661: a772a7c7a761c6125bc0af5284ad603478107737 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17714: a0cd84201117cc81f472e452c31a43ac972ed941 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
a0cd84201117 drm/i915: Neuter virtual rq->engine on retire
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915: Neuter virtual rq->engine on retire
In reply to Chris Wilson== Series Details ==
== Series Details ==
Series: drm/i915: Neuter virtual rq->engine on retire
URL : https://patchwork.freedesktop.org/series/77425/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_8506_full -> Patchwork_17714_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Known issues
------------
Here are the changes found in Patchwork_17714_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@kms_hdr@bpc-switch-suspend:
- shard-kbl: [PASS][1] -> [INCOMPLETE][2] ([i915#155])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-kbl2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-kbl1/igt@[email protected]
* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
- shard-kbl: [PASS][3] -> [DMESG-WARN][4] ([i915#180]) +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-kbl3/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-kbl6/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: [PASS][5] -> [FAIL][6] ([fdo#108145] / [i915#265])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-skl5/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-skl5/igt@[email protected]
* igt@kms_psr@psr2_primary_page_flip:
- shard-iclb: [PASS][7] -> [SKIP][8] ([fdo#109441]) +2 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-iclb2/igt@kms_psr@psr2_primary_page_flip.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-iclb8/igt@kms_psr@psr2_primary_page_flip.html
* igt@kms_setmode@basic:
- shard-skl: [PASS][9] -> [FAIL][10] ([i915#31])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-skl3/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-skl7/igt@[email protected]
#### Possible fixes ####
* igt@gen9_exec_parse@allowed-all:
- shard-apl: [DMESG-WARN][11] ([i915#1436] / [i915#716]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-apl6/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-apl8/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-64x21-offscreen:
- shard-skl: [FAIL][13] ([i915#54]) -> [PASS][14] +1 similar issue
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-skl4/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-skl2/igt@[email protected]
* {igt@kms_flip@flip-vs-suspend-interruptible@b-edp1}:
- shard-skl: [INCOMPLETE][15] ([i915#198]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-skl5/igt@kms_flip@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-skl1/igt@kms_flip@[email protected]
* {igt@kms_flip@flip-vs-suspend-interruptible@c-dp1}:
- shard-apl: [DMESG-WARN][17] ([i915#180]) -> [PASS][18] +1 similar issue
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-apl4/igt@kms_flip@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-apl6/igt@kms_flip@[email protected]
* {igt@kms_flip@flip-vs-suspend@a-dp1}:
- shard-kbl: [DMESG-WARN][19] ([i915#180]) -> [PASS][20] +4 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-kbl1/igt@kms_flip@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-kbl4/igt@kms_flip@[email protected]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-cpu:
- shard-snb: [SKIP][21] ([fdo#109271]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-snb1/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-cpu.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-snb1/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-cpu.html
* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-min:
- shard-skl: [FAIL][23] ([fdo#108145] / [i915#265]) -> [PASS][24] +2 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-skl9/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-skl2/igt@[email protected]
* igt@kms_psr@psr2_cursor_blt:
- shard-iclb: [SKIP][25] ([fdo#109441]) -> [PASS][26] +3 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-iclb6/igt@kms_psr@psr2_cursor_blt.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-iclb2/igt@kms_psr@psr2_cursor_blt.html
* igt@kms_setmode@basic:
- shard-kbl: [FAIL][27] ([i915#31]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-kbl6/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-kbl2/igt@[email protected]
* {igt@prime_vgem@sync@rcs0}:
- shard-iclb: [INCOMPLETE][29] ([i915#409]) -> [PASS][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-iclb8/igt@prime_vgem@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-iclb5/igt@prime_vgem@[email protected]
#### Warnings ####
* igt@kms_fbcon_fbt@fbc-suspend:
- shard-kbl: [DMESG-FAIL][31] ([i915#180] / [i915#95]) -> [FAIL][32] ([i915#1121] / [i915#93] / [i915#95])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8506/shard-kbl1/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/shard-kbl4/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[i915#1121]: https://gitlab.freedesktop.org/drm/intel/issues/1121
[i915#1436]: https://gitlab.freedesktop.org/drm/intel/issues/1436
[i915#155]: https://gitlab.freedesktop.org/drm/intel/issues/155
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#198]: https://gitlab.freedesktop.org/drm/intel/issues/198
[i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
[i915#31]: https://gitlab.freedesktop.org/drm/intel/issues/31
[i915#409]: https://gitlab.freedesktop.org/drm/intel/issues/409
[i915#54]: https://gitlab.freedesktop.org/drm/intel/issues/54
[i915#716]: https://gitlab.freedesktop.org/drm/intel/issues/716
[i915#93]: https://gitlab.freedesktop.org/drm/intel/issues/93
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95
Participating hosts (11 -> 11)
------------------------------
No changes in participating hosts
Build changes
-------------
* Linux: CI_DRM_8506 -> Patchwork_17714
CI-20190529: 20190529
CI_DRM_8506: d6a73e9084ff6adfabbad014bc294d254484f304 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5661: a772a7c7a761c6125bc0af5284ad603478107737 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_17714: a0cd84201117cc81f472e452c31a43ac972ed941 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_17714/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx