* [RFC] drm/i915/guc: Keep the previous context pinned until the next one has been completed
@ 2016-02-11 10:39 Tvrtko Ursulin
2016-02-15 15:08 ` ✗ Fi.CI.BAT: failure for " Patchwork
0 siblings, 1 reply; 2+ messages in thread
From: Tvrtko Ursulin @ 2016-02-11 10:39 UTC (permalink / raw)
To: Intel-gfx; +Cc: Tvrtko Ursulin
From: Tvrtko Ursulin <tvrtko@ursulin.net>
In GuC mode submitting requests is only putting them into the
GuC queue with the actual submission to hardware following at
some future point. This makes the per engine last context
tracking insufficient for closing the premature context unpin
race.
Instead we need to make requests track and pin the previous
context on the same engine, and only unpin them when they
themselves are retired.
This will ensure context remain pinned until the are fully
saved by the GPU in all cases.
This patch adds overhead to the request retire path which
could be avoided by refactoring LRC pinning to make it track
the VMA and cache the kmap in the VMA as suggested by Chris
Wilson.
It is also not tested in GuC mode at all so just speculative.
Signed-off-by: Tvrtko Ursulin <tvrtko@ursulin.net>
Cc: Alex Dai <yu.dai@intel.com>
Cc: Dave Gordon <david.s.gordon@intel.com>
Cc: Nick Hoath <nicholas.hoath@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_drv.h | 6 ++++++
drivers/gpu/drm/i915/i915_gem.c | 5 +++++
drivers/gpu/drm/i915/intel_lrc.c | 15 +++++++++++++++
3 files changed, 26 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e11eef1e5134..090172de81a0 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2313,6 +2313,12 @@ struct drm_i915_gem_request {
/** Execlists no. of times this request has been sent to the ELSP */
int elsp_submitted;
+ /**
+ * Context of the request precedeing this one on the same engine.
+ * Can be NULL.
+ */
+ struct intel_context *previous_ctx;
+
};
struct drm_i915_gem_request * __must_check
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index ef53bb314639..c63c3072a8a9 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1428,6 +1428,11 @@ static void i915_gem_request_retire(struct drm_i915_gem_request *request)
list_del_init(&request->list);
i915_gem_request_remove_from_client(request);
+ if (request->previous_ctx) {
+ intel_lr_context_unpin(request->previous_ctx, request->ring);
+ request->previous_ctx = NULL;
+ }
+
i915_gem_request_unreference(request);
}
diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 3a03646e343d..89eb892df4ae 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -783,6 +783,21 @@ intel_logical_ring_advance_and_submit(struct drm_i915_gem_request *request)
if (intel_ring_stopped(engine))
return 0;
+ /*
+ * Pin the previous context on this engine to ensure it is not
+ * prematurely unpinned in GuC mode.
+ * Previous context will be unpinned when this request is retired,
+ * ensuring the GPU has switched out from the previous context and into
+ * a new context at that point.
+ */
+ if (i915.enable_guc_submission && engine->last_context) {
+ request->previous_ctx = engine->last_context;
+ intel_lr_context_pin(request->previous_ctx, engine);
+ }
+
+ /*
+ * Track and pin the last context submitted on an engine.
+ */
if (engine->last_context != request->ctx) {
if (engine->last_context)
intel_lr_context_unpin(engine->last_context, engine);
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 2+ messages in thread
* ✗ Fi.CI.BAT: failure for drm/i915/guc: Keep the previous context pinned until the next one has been completed
2016-02-11 10:39 [RFC] drm/i915/guc: Keep the previous context pinned until the next one has been completed Tvrtko Ursulin
@ 2016-02-15 15:08 ` Patchwork
0 siblings, 0 replies; 2+ messages in thread
From: Patchwork @ 2016-02-15 15:08 UTC (permalink / raw)
To: Tvrtko Ursulin; +Cc: intel-gfx
== Summary ==
Series 3278v1 drm/i915/guc: Keep the previous context pinned until the next one has been completed
http://patchwork.freedesktop.org/api/1.0/series/3278/revisions/1/mbox/
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
pass -> INCOMPLETE (hsw-gt2)
Subgroup suspend-read-crc-pipe-b:
dmesg-warn -> PASS (skl-i5k-2)
Subgroup suspend-read-crc-pipe-c:
pass -> DMESG-WARN (skl-i5k-2)
dmesg-warn -> PASS (bsw-nuc-2)
Test pm_rpm:
Subgroup basic-pci-d3-state:
fail -> PASS (bdw-nuci7)
pass -> DMESG-WARN (byt-nuc)
bdw-nuci7 total:162 pass:152 dwarn:0 dfail:0 fail:0 skip:10
bdw-ultra total:165 pass:152 dwarn:0 dfail:0 fail:0 skip:13
bsw-nuc-2 total:165 pass:135 dwarn:1 dfail:0 fail:0 skip:29
byt-nuc total:165 pass:140 dwarn:1 dfail:0 fail:0 skip:24
hsw-brixbox total:165 pass:151 dwarn:0 dfail:0 fail:0 skip:14
hsw-gt2 total:43 pass:38 dwarn:0 dfail:0 fail:0 skip:4
ilk-hp8440p total:165 pass:116 dwarn:0 dfail:0 fail:1 skip:48
ivb-t430s total:165 pass:150 dwarn:0 dfail:0 fail:1 skip:14
skl-i5k-2 total:165 pass:149 dwarn:1 dfail:0 fail:0 skip:15
snb-dellxps total:165 pass:142 dwarn:0 dfail:0 fail:1 skip:22
snb-x220t total:165 pass:142 dwarn:0 dfail:0 fail:2 skip:21
Results at /archive/results/CI_IGT_test/Patchwork_1395/
f2110d8eac120416f8f5669f2aa561d9ab330a77 drm-intel-nightly: 2016y-02m-15d-09h-53m-04s UTC integration manifest
5fb1d5339f588317a492cacdd66c182aeff051b7 drm/i915/guc: Keep the previous context pinned until the next one has been completed
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-15 15:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-11 10:39 [RFC] drm/i915/guc: Keep the previous context pinned until the next one has been completed Tvrtko Ursulin
2016-02-15 15:08 ` ✗ Fi.CI.BAT: failure for " Patchwork
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).