drm/i915: Avoid GPU Hang when comming out of s3 or s4
Subsystems (3)
PATCH v3 1/1 drm/i915: Avoid GPU Hang when comming out of s3 or s4
This patch fixes a timing issue that causes a GPU hang when the system comes out of power saving.
During pm_resume, We are submitting batchbuffers before enabling Interrupts this is causing us to miss the context switch interrupt, and in consequence intel_execlists_handle_ctx_events is not triggered.
This patch is based on a patch from Deepak S <[email protected]> from another platform.
The patch fixes an issue introduced by:
commit e7778be1eab918274f79603d7c17b3ec8be77386 drm/i915: Fix startup failure in LRC mode after recent init changes
The above patch added a call to init_context() to fix an issue introduced by a previous patch. But, it then opened up a small timing window for the batches being added by the init_context (basically setting up the context) to complete before the interrupts have been turned on, thus hanging the GPU.
BUG: https://bugs.freedesktop.org/show_bug.cgi?id=89600
--- drivers/gpu/drm/i915/i915_drv.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +7 -3
@@ -734,6 +734,12 @@ static int i915_drm_resume(struct drm_device *dev)intel_init_pch_refclk (dev);drm_mode_config_reset (dev); +/* Interrupts have to enabled so that any batches that are completed +* when the context is restarted are caught so that the ring buffer +* does not handle. +*/ +intel_runtime_pm_enable_interrupts (dev_priv); +mutex_lock (&dev->struct_mutex);if (i915_gem_init_hw (dev)) {DRM_ERROR ("failed to re-initialize GPU, declaring wedged!\n" );
@@ -741,9 +747,7 @@ static int i915_drm_resume(struct drm_device *dev) }mutex_unlock (&dev->struct_mutex); -/* We need working interrupts for modeset enabling ... */ -intel_runtime_pm_enable_interrupts (dev_priv); - +/* This must follow the pm enable interrupts */ intel_modeset_init_hw (dev);spin_lock_irq (&dev_priv->irq_lock);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 31 lines · Peter Antoine
This patch fixes a timing issue that causes a GPU hang when the system comes out of power saving.
During
pm_resume, We are submitting batchbuffers before enabling Interrupts this is causing us to miss the context switch interrupt, and in consequenceintel_execlists_handle_ctx_eventsis not triggered.This patch is based on a patch from Deepak S <[email protected]> from another platform.
The patch fixes an issue introduced by:
commite7778be1eab918274f79603d7c17b3ec8be77386drm/i915: Fix startup failure in LRC mode after recent init changesThe above patch added a call to
init_context()to fix an issue introduced by a previous patch. But, it then opened up a small timing window for the batches being added by theinit_context(basically setting up the context) to complete before the interrupts have been turned on, thus hanging the GPU.BUG: https://bugs.freedesktop.org/show_bug.cgi?id=89600Signed-off-by Peter Antoine <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_drv.c +0
-0
drivers/gpu/drm/i915/i915_drv.c static int i915_drm_resume(struct drm_device *dev) · line 740
Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.c +4
-0@@ -734,6 +734,12 @@ static int i915_drm_resume(struct drm_device *dev)intel_init_pch_refclk (dev);drm_mode_config_reset (dev); +/* Interrupts have to enabled so that any batches that are completed +* when the context is restarted are caught so that the ring buffer +* does not handle. +*/
The comment above is ungrammatical, and the format is not the preferred one. How about this instead:
/*
* Interrupts have to be enabled before reinitialising the
* hardware, so that batchbuffers can be submitted and the
* resulting interrupts handled. Failure to do so will result
* in a ring hang, as the batches will not be seen to complete. */
Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.c +2
-0+intel_runtime_pm_enable_interrupts (dev_priv); +mutex_lock (&dev->struct_mutex);if (i915_gem_init_hw (dev)) {DRM_ERROR ("failed to re-initialize GPU, declaring wedged!\n" );
drivers/gpu/drm/i915/i915_drv.c static int i915_drm_resume(struct drm_device *dev) · line 753
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +1
-3@@ -741,9 +747,7 @@ static int i915_drm_resume(struct drm_device *dev) }mutex_unlock (&dev->struct_mutex); -/* We need working interrupts for modeset enabling ... */ -intel_runtime_pm_enable_interrupts (dev_priv); - +/* This must follow the pm enable interrupts */ intel_modeset_init_hw (dev);spin_lock_irq (&dev_priv->irq_lock);
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 14 lines · Peter Antoine
This patch fixes a timing issue that causes a GPU hang when the system comes out of power saving.
During
pm_resume, We are submitting batchbuffers before enabling Interrupts this is causing us to miss the context switch interrupt, and in consequenceintel_execlists_handle_ctx_eventsis not triggered.This patch is based on a patch from Deepak S <[email protected]> from another platform.
The patch fixes an issue introduced by:
commite7778be1eab918274f79603d7c17b3ec8be77386drm/i915: Fix startup failure in LRC mode after recent init changes
Quoted 7 lines
The above patch added a call to
init_context()to fix an issue introduced by a previous patch. But, it then opened up a small timing window for the batches being added by theinit_context(basically setting up the context) to complete before the interrupts have been turned on, thus hanging the GPU.BUG: https://bugs.freedesktop.org/show_bug.cgi?id=89600
It's Bugzilla: Also this needs to be backported to 4.0, so needs an
Cc: [email protected]
With this change the resume code is now again in-line wrt interrupt enabling and gem_init_hw with the driver load and gpu reset code.
Cheers, Daniel
Quoted 36 lines
Signed-off-by Peter Antoine <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_drv.c +7
-3@@ -734,6 +734,12 @@ static int i915_drm_resume(struct drm_device *dev)intel_init_pch_refclk (dev);drm_mode_config_reset (dev); +/* Interrupts have to enabled so that any batches that are completed +* when the context is restarted are caught so that the ring buffer +* does not handle. +*/ +intel_runtime_pm_enable_interrupts (dev_priv); +mutex_lock (&dev->struct_mutex);if (i915_gem_init_hw (dev)) {DRM_ERROR ("failed to re-initialize GPU, declaring wedged!\n" );@@ -741,9 +747,7 @@ static int i915_drm_resume(struct drm_device *dev) }mutex_unlock (&dev->struct_mutex); -/* We need working interrupts for modeset enabling ... */ -intel_runtime_pm_enable_interrupts (dev_priv); - +/* This must follow the pm enable interrupts */ intel_modeset_init_hw (dev);spin_lock_irq (&dev_priv->irq_lock);Signature · 1 line
1.9.1
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
PATCH v4 1/1 drm/i915: Avoid GPU Hang when comming out of s3 or s4
This patch fixed a timing issue that causes a GPU hang when a the system comes out of power saving.
During pm_resume, We are submitting batchbuffers before enabling Interrupts this is causing us to miss the context switch interrupt, and in consequence intel_execlists_handle_ctx_events is not triggered.
This patch is based on a patch from Deepak S <[email protected]> from another platform.
The patch fixes an issue introduced by:
commit e7778be1eab918274f79603d7c17b3ec8be77386 drm/i915: Fix startup failure in LRC mode after recent init changes
The above patch added a call to init_context() to fix an issue introduced by a previous patch. But, it then opened up a small timing window for the batches being added by the init_context (basically setting up the context) to complete before the interrupts have been turned on, thus hanging the GPU.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89600
--- drivers/gpu/drm/i915/i915_drv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +8 -3
@@ -734,6 +734,13 @@ static int i915_drm_resume(struct drm_device *dev)intel_init_pch_refclk (dev);drm_mode_config_reset (dev); +/* +* Interrupts have to be enabled before any batches are run. If not the +* GPU will hang. The init_hw will initiate batches to update/restore +* the context. +*/ +intel_runtime_pm_enable_interrupts (dev_priv); +mutex_lock (&dev->struct_mutex);if (i915_gem_init_hw (dev)) {DRM_ERROR ("failed to re-initialize GPU, declaring wedged!\n" );
@@ -741,9 +748,7 @@ static int i915_drm_resume(struct drm_device *dev) }mutex_unlock (&dev->struct_mutex); -/* We need working interrupts for modeset enabling ... */ -intel_runtime_pm_enable_interrupts (dev_priv); - +/* This must follow the pm enable interrupts */ intel_modeset_init_hw (dev);spin_lock_irq (&dev_priv->irq_lock);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 20 lines · Peter Antoine
This patch fixed a timing issue that causes a GPU hang when a the system comes out of power saving.
During
pm_resume, We are submitting batchbuffers before enabling Interrupts this is causing us to miss the context switch interrupt, and in consequenceintel_execlists_handle_ctx_eventsis not triggered.This patch is based on a patch from Deepak S <[email protected]> from another platform.
The patch fixes an issue introduced by:
commite7778be1eab918274f79603d7c17b3ec8be77386drm/i915: Fix startup failure in LRC mode after recent init changesThe above patch added a call to
init_context()to fix an issue introduced by a previous patch. But, it then opened up a small timing window for the batches being added by theinit_context(basically setting up the context) to complete before the interrupts have been turned on, thus hanging the GPU.
Quoted 5 lines
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89600
Signed-off-by Peter Antoine <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
<formletter>
This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read Documentation/stable_kernel_rules.txt for how to do this properly.
</formletter>
Task id: 6380 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV 276/276 276/276
ILK -1 302/302 301/302 SNB -1 314/314 313/314 IVB 338/338 338/338 BYT 286/286 286/286
BDW -1 320/320 319/320
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*ILK igt@kms_flip@flip-vs-dpms-interruptible PASS(2) DMESG_WARN(1)
(dmesg patch applied)drm:intel_pch_fifo_underrun_irq_handler[i915]]*ERROR*PCH_transcoder_A_FIFO_underrun@PCH transcoder A FIFO underrun
SNB igt@pm_rpm@dpms-mode-unset-non-lpsp DMESG_WARN(13)PASS(1) DMESG_WARN(1)
(dmesg patch applied)WARNING:at_drivers/gpu/drm/i915/intel_uncore.c:#assert_device_not_suspended[i915]()@WARNING:.* at .* assert_device_not_suspended+0x
*BDW igt@gem_fence_thrash@bo-write-verify-y PASS(2) DMESG_WARN(1)
(dmesg patch applied)WARNING:at_drivers/gpu/drm/i915/intel_display.c:#assert_plane[i915]()@WARNING:.* at .* assert_plane assertion_failure@assertion failure
WARNING:at_drivers/gpu/drm/drm_irq.c:#drm_wait_one_vblank[drm]()@WARNING:.* at .* drm_wait_one_vblank+0x
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v5 1/1 drm/i915: Avoid GPU Hang when comming out of s3 or s4
In reply to Daniel VetterThis patch fixed a timing issue that causes a GPU hang when a the system comes out of power saving.
During pm_resume, We are submitting batchbuffers before enabling Interrupts this is causing us to miss the context switch interrupt, and in consequence intel_execlists_handle_ctx_events is not triggered.
This patch is based on a patch from Deepak S <[email protected]> from another platform.
The patch fixes an issue introduced by:
commit e7778be1eab918274f79603d7c17b3ec8be77386 drm/i915: Fix startup failure in LRC mode after recent init changes
The above patch added a call to init_context() to fix an issue introduced by a previous patch. But, it then opened up a small timing window for the batches being added by the init_context (basically setting up the context) to complete before the interrupts have been turned on, thus hanging the GPU.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89600
--- drivers/gpu/drm/i915/i915_drv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +8 -3
@@ -734,6 +734,13 @@ static int i915_drm_resume(struct drm_device *dev)intel_init_pch_refclk (dev);drm_mode_config_reset (dev); +/* +* Interrupts have to be enabled before any batches are run. If not the +* GPU will hang. The init_hw will initiate batches to update/restore +* the context. +*/ +intel_runtime_pm_enable_interrupts (dev_priv); +mutex_lock (&dev->struct_mutex);if (i915_gem_init_hw (dev)) {DRM_ERROR ("failed to re-initialize GPU, declaring wedged!\n" );
@@ -741,9 +748,7 @@ static int i915_drm_resume(struct drm_device *dev) }mutex_unlock (&dev->struct_mutex); -/* We need working interrupts for modeset enabling ... */ -intel_runtime_pm_enable_interrupts (dev_priv); - +/* This must follow the pm enable interrupts */ intel_modeset_init_hw (dev);spin_lock_irq (&dev_priv->irq_lock);
Signature · 1 line
1.9.1
Jani Nikula
maintainerQuoted 20 lines · Peter Antoine
This patch fixed a timing issue that causes a GPU hang when a the system comes out of power saving.
During
pm_resume, We are submitting batchbuffers before enabling Interrupts this is causing us to miss the context switch interrupt, and in consequenceintel_execlists_handle_ctx_eventsis not triggered.This patch is based on a patch from Deepak S <[email protected]> from another platform.
The patch fixes an issue introduced by:
commite7778be1eab918274f79603d7c17b3ec8be77386drm/i915: Fix startup failure in LRC mode after recent init changesThe above patch added a call to
init_context()to fix an issue introduced by a previous patch. But, it then opened up a small timing window for the batches being added by theinit_context(basically setting up the context) to complete before the interrupts have been turned on, thus hanging the GPU.
Quoted 3 lines
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89600
Signed-off-by Peter Antoine <[email protected]>
I pushed some version of this patch to drm-intel-fixes yesterday, with some comment modifications. Thanks for the patch and review.
For future reference, please add some changelog to your patches so it's easier to know what's changed between versions.
BR,
Jani.
Quoted 40 lines
--- drivers/gpu/drm/i915/i915_drv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_drv.c +8
-3@@ -734,6 +734,13 @@ static int i915_drm_resume(struct drm_device *dev)intel_init_pch_refclk (dev);drm_mode_config_reset (dev); +/* +* Interrupts have to be enabled before any batches are run. If not the +* GPU will hang. The init_hw will initiate batches to update/restore +* the context. +*/ +intel_runtime_pm_enable_interrupts (dev_priv); +mutex_lock (&dev->struct_mutex);if (i915_gem_init_hw (dev)) {DRM_ERROR ("failed to re-initialize GPU, declaring wedged!\n" );@@ -741,9 +748,7 @@ static int i915_drm_resume(struct drm_device *dev) }mutex_unlock (&dev->struct_mutex); -/* We need working interrupts for modeset enabling ... */ -intel_runtime_pm_enable_interrupts (dev_priv); - +/* This must follow the pm enable interrupts */ intel_modeset_init_hw (dev);spin_lock_irq (&dev_priv->irq_lock);Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Task id: 6380 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV 276/276 276/276
ILK -1 302/302 301/302 SNB -1 314/314 313/314 IVB 338/338 338/338 BYT 286/286 286/286
BDW -1 320/320 319/320
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
*ILK igt@kms_flip@flip-vs-dpms-interruptible PASS(2) DMESG_WARN(1)
(dmesg patch applied)drm:intel_pch_fifo_underrun_irq_handler[i915]]*ERROR*PCH_transcoder_A_FIFO_underrun@PCH transcoder A FIFO underrun
SNB igt@pm_rpm@dpms-mode-unset-non-lpsp DMESG_WARN(13)PASS(1) DMESG_WARN(1)
(dmesg patch applied)WARNING:at_drivers/gpu/drm/i915/intel_uncore.c:#assert_device_not_suspended[i915]()@WARNING:.* at .* assert_device_not_suspended+0x
*BDW igt@gem_fence_thrash@bo-write-verify-y PASS(2) DMESG_WARN(1)
(dmesg patch applied)WARNING:at_drivers/gpu/drm/i915/intel_display.c:#assert_plane[i915]()@WARNING:.* at .* assert_plane assertion_failure@assertion failure
WARNING:at_drivers/gpu/drm/drm_irq.c:#drm_wait_one_vblank[drm]()@WARNING:.* at .* drm_wait_one_vblank+0x
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 14 lines · Peter Antoine
This patch fixes a timing issue that causes a GPU hang when the system comes out of power saving.
During
pm_resume, We are submitting batchbuffers before enabling Interrupts this is causing us to miss the context switch interrupt, and in consequenceintel_execlists_handle_ctx_eventsis not triggered.This patch is based on a patch from Deepak S <[email protected]> from another platform.
The patch fixes an issue introduced by:
commite7778be1eab918274f79603d7c17b3ec8be77386drm/i915: Fix startup failure in LRC mode after recent init changes
Quoted 8 lines
The above patch added a call to
init_context()to fix an issue introduced by a previous patch. But, it then opened up a small timing window for the batches being added by theinit_context(basically setting up the context) to complete before the interrupts have been turned on, thus hanging the GPU.BUG: https://bugs.freedesktop.org/show_bug.cgi?id=89600Signed-off-by Peter Antoine <[email protected]>
btw can you please follow up with a patch to encode these depencies? A
WARN_ON(!irqs_enabled);
in execlists_context_unqueue after the spinlock assert would be good I think.
-Daniel
Quoted 35 lines
--- drivers/gpu/drm/i915/i915_drv.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/i915_drv.c +7
-3@@ -734,6 +734,12 @@ static int i915_drm_resume(struct drm_device *dev)intel_init_pch_refclk (dev);drm_mode_config_reset (dev); +/* Interrupts have to enabled so that any batches that are completed +* when the context is restarted are caught so that the ring buffer +* does not handle. +*/ +intel_runtime_pm_enable_interrupts (dev_priv); +mutex_lock (&dev->struct_mutex);if (i915_gem_init_hw (dev)) {DRM_ERROR ("failed to re-initialize GPU, declaring wedged!\n" );@@ -741,9 +747,7 @@ static int i915_drm_resume(struct drm_device *dev) }mutex_unlock (&dev->struct_mutex); -/* We need working interrupts for modeset enabling ... */ -intel_runtime_pm_enable_interrupts (dev_priv); - +/* This must follow the pm enable interrupts */ intel_modeset_init_hw (dev);spin_lock_irq (&dev_priv->irq_lock);Signature · 1 line
1.9.1
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