drm/i915: Request for resets under forcewake
Subsystems (2)
PATCH 1/1 drm/i915: Request for resets under forcewake
We have a timed release of a forcewake when using I915_READ/WRITE macros. wait_for() macro will go to quite long sleep if the first read doesn't satisfy the condition for successful exit. With these two interacting, it is possible that we lose the forcewake during the wait_for() and the subsequent read will reaquire forcewake.
Further experiments with skl shows that when we lose forcewake, we lose the reset request we submitted. So this register is not power context saved.
Grab forcewakes for all engines before starting to request for resets so that all requests stay valid for the duration of reset requisition across all the engines.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92774
--- drivers/gpu/drm/i915/intel_uncore.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/intel_uncore.c +6 -0
@@ -1483,6 +1483,8 @@ static int gen8_do_reset(struct drm_device *dev)struct intel_engine_cs *engine;int i; +intel_uncore_forcewake_get (dev_priv,FORCEWAKE_ALL ); +for_each_ring (engine, dev_priv, i) {I915_WRITE (RING_RESET_CTL (engine->mmio_base),_MASKED_BIT_ENABLE (RESET_CTL_REQUEST_RESET ));
@@ -1497,6 +1499,8 @@ static int gen8_do_reset(struct drm_device *dev) } } +intel_uncore_forcewake_put (dev_priv,FORCEWAKE_ALL ); +return gen6_do_reset (dev); not_ready:
@@ -1504,6 +1508,8 @@ not_ready:I915_WRITE (RING_RESET_CTL (engine->mmio_base),_MASKED_BIT_DISABLE (RESET_CTL_REQUEST_RESET )); +intel_uncore_forcewake_put (dev_priv,FORCEWAKE_ALL ); +return -EIO ; }
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 28 lines · Mika Kuoppala
We have a timed release of a forcewake when using I915_READ/WRITE macros.
wait_for()macro will go to quite long sleep if the first read doesn't satisfy the condition for successful exit. With these two interacting, it is possible that we lose the forcewake during thewait_for()and the subsequent read will reaquire forcewake.Further experiments with skl shows that when we lose forcewake, we lose the reset request we submitted. So this register is not power context saved.
Grab forcewakes for all engines before starting to request for resets so that all requests stay valid for the duration of reset requisition across all the engines.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92774
Cc Chris Wilson <[email protected]>Tested-by Tomi Sarvela <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/i915/intel_uncore.c +0
-0
drivers/gpu/drm/i915/intel_uncore.c static int gen8_do_reset(struct drm_device *dev) · line 1485
Quoted 3 lines
drivers/gpu/drm/i915/intel_uncore.c +0
-0@@ -1483,6 +1483,8 @@ static int gen8_do_reset(struct drm_device *dev)struct intel_engine_cs *engine;int i;
/* If the power well sleeps during the reset, the reset * request may be dropped and never completes (causing -EIO). */
drivers/gpu/drm/i915/intel_uncore.c static int gen8_do_reset(struct drm_device *dev) · line 1486
Quoted 1 line
drivers/gpu/drm/i915/intel_uncore.c +1
-0+intel_uncore_forcewake_get (dev_priv,FORCEWAKE_ALL );
I wonder if this would be more useful in intel_gpu_reset(), it won't hurt any other platforms and may prevent similar snafu in future? -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
Quoted 35 lines · Chris Wilson
Quoted 28 lines · Mika Kuoppala
We have a timed release of a forcewake when using I915_READ/WRITE macros.
wait_for()macro will go to quite long sleep if the first read doesn't satisfy the condition for successful exit. With these two interacting, it is possible that we lose the forcewake during thewait_for()and the subsequent read will reaquire forcewake.Further experiments with skl shows that when we lose forcewake, we lose the reset request we submitted. So this register is not power context saved.
Grab forcewakes for all engines before starting to request for resets so that all requests stay valid for the duration of reset requisition across all the engines.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92774
Cc Chris Wilson <[email protected]>Tested-by Tomi Sarvela <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>--- drivers/gpu/drm/i915/intel_uncore.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/gpu/drm/i915/intel_uncore.c +0
-0drivers/gpu/drm/i915/intel_uncore.c static int gen8_do_reset(struct drm_device *dev) · line 1485
Quoted 3 lines
drivers/gpu/drm/i915/intel_uncore.c +0
-0@@ -1483,6 +1483,8 @@ static int gen8_do_reset(struct drm_device *dev)struct intel_engine_cs *engine;int i;/* If the power well sleeps during the reset, the reset * request may be dropped and never completes (causing -EIO). */
Quoted 4 lines
drivers/gpu/drm/i915/intel_uncore.c static int gen8_do_reset(struct drm_device *dev) · line 1486
Quoted 1 line
drivers/gpu/drm/i915/intel_uncore.c +1
-0+intel_uncore_forcewake_get (dev_priv,FORCEWAKE_ALL );I wonder if this would be more useful in
intel_gpu_reset(), it won't hurt any other platforms and may prevent similar snafu in future?
I had similar thoughts but chickened out due to forcewake_reset ending up inside the call chain on such setup.
Now with a refreshing my memory, the forcewake_reset should handle the 'restore' case.
-Mika
Quoted 4 lines
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/i915: Do graphics device reset under forcewake
In reply to Chris WilsonWe have a timed release of a forcewake when using I915_READ/WRITE macros. wait_for() macro will go to quite long sleep if the first read doesn't satisfy the condition for successful exit. With these two interacting, it is possible that we lose the forcewake during the wait_for() and the subsequent read will reaquire forcewake.
Further experiments with skl shows that when we lose forcewake, we lose the reset request we submitted. So reset request register is not power context saved.
Grab forcewakes for all engines before starting the reset/request dance so that all requests stay valid for the duration of reset requisition across all the engines.
v2: Add comment on power well sleeps. Wrap the reset handling
under forcewake instead of just reset requests (Chris)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92774
--- drivers/gpu/drm/i915/intel_uncore.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_uncore.c +10 -1
@@ -1530,13 +1530,22 @@ static int (*intel_get_gpu_reset(struct drm_device *dev))(struct drm_device *)int intel_gpu_reset (struct drm_device *dev) { +struct drm_i915_private *dev_priv =to_i915 (dev);int (*reset)(struct drm_device *); +int ret; reset =intel_get_gpu_reset (dev);if (reset ==NULL )return -ENODEV ; -return reset (dev); +/* If the power well sleeps during the reset, the reset +* request may be dropped and never completes (causing -EIO). +*/ +intel_uncore_forcewake_get (dev_priv,FORCEWAKE_ALL ); + ret =reset (dev); +intel_uncore_forcewake_put (dev_priv,FORCEWAKE_ALL ); + +return ret; }bool intel_has_gpu_reset (struct drm_device *dev)
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] drm/i915: Do graphics device reset under forcewake
Quoted 15 lines · Mika Kuoppala
We have a timed release of a forcewake when using I915_READ/WRITE macros.
wait_for()macro will go to quite long sleep if the first read doesn't satisfy the condition for successful exit. With these two interacting, it is possible that we lose the forcewake during thewait_for()and the subsequent read will reaquire forcewake.Further experiments with skl shows that when we lose forcewake, we lose the reset request we submitted. So reset request register is not power context saved.
Grab forcewakes for all engines before starting the reset/request dance so that all requests stay valid for the duration of reset requisition across all the engines.
Quoted 7 lines
v2: Add comment on power well sleeps. Wrap the reset handling
under forcewake instead of just reset requests (Chris)Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92774
Cc Chris Wilson <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>
-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
Re: [PATCH] drm/i915: Do graphics device reset under forcewake
Quoted 16 lines · Chris Wilson
Quoted 15 lines · Mika Kuoppala
We have a timed release of a forcewake when using I915_READ/WRITE macros.
wait_for()macro will go to quite long sleep if the first read doesn't satisfy the condition for successful exit. With these two interacting, it is possible that we lose the forcewake during thewait_for()and the subsequent read will reaquire forcewake.Further experiments with skl shows that when we lose forcewake, we lose the reset request we submitted. So reset request register is not power context saved.
Grab forcewakes for all engines before starting the reset/request dance so that all requests stay valid for the duration of reset requisition across all the engines.
Quoted 8 lines
Quoted 7 lines
v2: Add comment on power well sleeps. Wrap the reset handling
under forcewake instead of just reset requests (Chris)Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92774
Cc Chris Wilson <[email protected]>Signed-off-by Mika Kuoppala <[email protected]>Reviewed-by Chris Wilson <[email protected]>
Pushed to drm-intel-next-fixes, thanks for the patch and review.
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx