drm/i915: Also perform gpu reset under execlist mode.
Subsystems (2)
PATCH 1/1 drm/i915: Also perform gpu reset under execlist mode.
From: "Niu,Bing" <[email protected]>
It is found that i915 will not reset gpu under execlist mode when unload module. that will lead to some issues when unload/load module with different submission mode. e.g. from execlist mode to ring buffer mode via loading/unloading i915. Because HW is not in a reset state and registers are not clean under such condition.
--- drivers/gpu/drm/i915/i915_gem_context.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_gem_context.c +6 -6
@@ -372,13 +372,13 @@ void i915_gem_context_fini(struct drm_device *dev)struct intel_context *dctx = dev_priv->ring[RCS ].default_context;int i; -if (dctx->legacy_hw_ctx.rcs_state) { -/* The only known way to stop the gpu from accessing the hw context is -* to reset it. Do this as the very last operation to avoid confusing -* other code, leading to spurious errors. */ -intel_gpu_reset (dev); +/* The only known way to stop the gpu from accessing the hw context is +* to reset it. Do this as the very last operation to avoid confusing +* other code, leading to spurious errors. */ +intel_gpu_reset (dev); -/* When default context is created and switched to, base object refcount +if (dctx->legacy_hw_ctx.rcs_state) { +/* When default context is created and switched to, base object refcount * will be 2 (+1 from object creation and +1 from do_switch()). * i915_gem_context_fini() will be called after gpu_idle() has switched * to default context. So we need to unreference the base object once
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · On Thu, Jun 25, 2015 at 10:40:15PM +0800, [email protected] wrote:
From: "Niu,Bing" <[email protected]>
It is found that i915 will not reset gpu under execlist mode when unload module. that will lead to some issues when unload/load module with different submission mode. e.g. from execlist mode to ring buffer mode via loading/unloading i915. Because HW is not in a reset state and registers are not clean under such condition.
Now the reason we have the reset there is to disable writes to the power context after the memory is released. Your complaint above can easily be read as the driver is unable to correctly initialisae itself from a random GPU state, which is a fault in driver initialisation.
Have you observed stray memory writes from the GPU after the module is unloaded? If not, this would seem to be just a band-aid. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi Chris:
Thanks for the comments that extends our knowledge about this modification. Really appreciate the help. But is it possible that we still need an ordinary gpu reset here? Consider that we may modprobe i915 with i915.enable_execlists=1 then unload it, then modprobe i915.enable_execlists=0, according to bspec, changing execlist mode to ringbuffer mode, a hardware reset is needed?
Thanks,
Zhi.
Quoted 27 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Chris Wilson
Sent: Thursday, June 25, 2015 4:13 PM
To: Niu, Bing
Cc: [email protected]
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Also perform gpu reset under execlist mode.Quoted 7 lines · On Thu, Jun 25, 2015 at 10:40:15PM +0800, [email protected] wrote:
From: "Niu,Bing" <[email protected]>
It is found that i915 will not reset gpu under execlist mode when unload module. that will lead to some issues when unload/load module with different submission mode. e.g. from execlist mode to ring buffer mode via loading/unloading i915. Because HW is not in a reset state and registers are not clean under such condition.
Now the reason we have the reset there is to disable writes to the power context after the memory is released. Your complaint above can easily be read as the driver is unable to correctly initialisae itself from a random GPU state, which is a fault in driver initialisation.
Have you observed stray memory writes from the GPU after the module is unloaded? If not, this would seem to be just a band-aid. -Chris
Quoted 6 lines
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 2 lines · Zhi A
Hi Chris:
Thanks for the comments that extends our knowledge about this modification. Really appreciate the help. But is it possible that we still need an ordinary gpu reset here? Consider that we may modprobe i915 with i915.enable_execlists=1 then unload it, then modprobe i915.enable_execlists=0, according to bspec, changing execlist mode to ringbuffer mode, a hardware reset is needed?
Sounds credible that execlist -> execbuffer requires a reset. That reset should be called in execlist shutdown and documented appropriately. -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi Chris:
Thanks for the reply! I just dig the code. It looks there is no
special code path for execlist shutdown. It has init_rings(), but doesn't have cleanup_rings(), only clean_ring(), which are called for each ring one by one when i915_gem_cleanup_ringbuffer() gets called.
Do you have any advice? :)
Thanks,
Zhi.
Quoted 8 lines · Chris Wilson
Quoted 2 lines · Zhi A
Hi Chris:
Thanks for the comments that extends our knowledge about this modification. Really appreciate the help. But is it possible that we still need an ordinary gpu reset here? Consider that we may modprobe i915 with i915.enable_execlists=1 then unload it, then modprobe i915.enable_execlists=0, according to bspec, changing execlist mode to ringbuffer mode, a hardware reset is needed?Sounds credible that execlist -> execbuffer requires a reset. That reset should be called in execlist shutdown and documented appropriately. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 8 lines · Zhi Wang
Hi Chris:
Thanks for the reply! I just dig the code. It looks there is no
special code path for execlist shutdown. It hasinit_rings(), but doesn't havecleanup_rings(), onlyclean_ring(), which are called for each ring one by one wheni915_gem_cleanup_ringbuffer()gets called.Do you have any advice? :)
The quick and dirty version would be:
drivers/gpu/drm/i915/i915_gem.c +8 -1
@@ -5096,6 +5096,14 @@ i915_gem_cleanup_ringbuffer(struct drm_device *dev)for_each_ring (ring, dev_priv, i) dev_priv->gt.cleanup_ring (ring); + +if (i915.enable_execlists) +/* +* Neither the BIOS, ourselves or any other kernel +* expects the system to be in execlists mode on startup, +* so we need to reset the GPU back to legacy mode. +*/ +intel_gpu_reset (dev); } -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Thanks! :D
Thanks,
Zhi.
Quoted 22 lines · Chris Wilson
Quoted 8 lines · Zhi Wang
Hi Chris:
Thanks for the reply! I just dig the code. It looks there is no
special code path for execlist shutdown. It hasinit_rings(), but doesn't havecleanup_rings(), onlyclean_ring(), which are called for each ring one by one wheni915_gem_cleanup_ringbuffer()gets called.Do you have any advice? :)
The quick and dirty version would be:
drivers/gpu/drm/i915/i915_gem.c +1
-0@@ -5096,6 +5096,14 @@ i915_gem_cleanup_ringbuffer(struct drm_device *dev)for_each_ring (ring, dev_priv, i) dev_priv->gt.cleanup_ring (ring); +
drivers/gpu/drm/i915/i915_gem.c i915_gem_cleanup_ringbuffer(struct drm_device *dev) · line 5101
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +7
-1+if (i915.enable_execlists) +/* +* Neither the BIOS, ourselves or any other kernel +* expects the system to be in execlists mode on startup, +* so we need to reset the GPU back to legacy mode. +*/ +intel_gpu_reset (dev); } -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Chris Wilson
Quoted 7 lines · On Thu, Jun 25, 2015 at 10:40:15PM +0800, [email protected] wrote:
From: "Niu,Bing" <[email protected]>
It is found that i915 will not reset gpu under execlist mode when unload module. that will lead to some issues when unload/load module with different submission mode. e.g. from execlist mode to ring buffer mode via loading/unloading i915. Because HW is not in a reset state and registers are not clean under such condition.
Quoted 7 lines
Now the reason we have the reset there is to disable writes to the power context after the memory is released. Your complaint above can easily be read as the driver is unable to correctly initialisae itself from a random GPU state, which is a fault in driver initialisation.
Have you observed stray memory writes from the GPU after the module is unloaded? If not, this would seem to be just a band-aid.
I think as long as we don't have any bios out there enabling execlist already it's better to try to leave the gpu behind in a state consistent what we're seeing from real firmware. Otherwise we just have complexity for no reason.
Similar example is that we kill all outputs since our pte setup doesn't math the bios one (and yeah I think there too it'd be good to fill out the gtt with stolen ptes). Hence this patch makes sense for me. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx