forcewake warning fixes
Subsystems (2)
cover forcewake warning fixes
I'm having some trouble testing these currently. Hopefully someone else can verify them.
Ben Widawsky (2):
drm/i915: more forcewake lock error info
drm/i915: save/resume forcewake lock fixes
drivers/gpu/drm/i915/i915_drv.c | 12 ++++++++---- drivers/gpu/drm/i915/i915_drv.h | 8 +++++--- drivers/gpu/drm/i915/i915_suspend.c | 5 +++++ 3 files changed, 18 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.5.2
PATCH 1/2 drm/i915: more forcewake lock error info
Get some more useful info for debugging backtraces on forcewake problems. Appropriate debug flags will be required for the drm module.
--- drivers/gpu/drm/i915/i915_drv.c | 12 ++++++++---- drivers/gpu/drm/i915/i915_drv.h | 8 +++++--- 2 files changed, 13 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +8 -4
@@ -317,13 +317,15 @@ static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv)* be called at the beginning of the sequence followed by a call to * gen6_gt_force_wake_put() at the end of the sequence. */ -void gen6_gt_force_wake_get (struct drm_i915_private *dev_priv) +int gen6_gt_force_wake_get (struct drm_i915_private *dev_priv) { -WARN_ON (!mutex_is_locked (&dev_priv->dev->struct_mutex)); +int ret =WARN_ON (!mutex_is_locked (&dev_priv->dev->struct_mutex));/* Forcewake is atomic in case we get in here without the lock */ if (atomic_add_return (1 , &dev_priv->forcewake_count) ==1 )__gen6_gt_force_wake_get (dev_priv); + +return ret; }static void __gen6_gt_force_wake_put (struct drm_i915_private *dev_priv)
@@ -335,12 +337,14 @@ static void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv)/* * see gen6_gt_force_wake_get() */ -void gen6_gt_force_wake_put (struct drm_i915_private *dev_priv) +int gen6_gt_force_wake_put (struct drm_i915_private *dev_priv) { -WARN_ON (!mutex_is_locked (&dev_priv->dev->struct_mutex)); +int ret =WARN_ON (!mutex_is_locked (&dev_priv->dev->struct_mutex));if (atomic_dec_and_test (&dev_priv->forcewake_count))__gen6_gt_force_wake_put (dev_priv); + +return ret; }void __gen6_gt_wait_for_fifo (struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/i915_drv.h +5 -3
@@ -1362,8 +1362,8 @@ extern void intel_display_print_error_state(struct seq_file *m,* must be set to prevent GT core from power down and stale values being * returned. */ -void gen6_gt_force_wake_get (struct drm_i915_private *dev_priv); -void gen6_gt_force_wake_put (struct drm_i915_private *dev_priv); +int gen6_gt_force_wake_get (struct drm_i915_private *dev_priv); +int gen6_gt_force_wake_put (struct drm_i915_private *dev_priv);void __gen6_gt_wait_for_fifo (struct drm_i915_private *dev_priv);/* We give fast paths for the really cool registers */
@@ -1376,7 +1376,9 @@ void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv); static inline u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ u##x val = 0; \ if (NEEDS_FORCE_WAKE((dev_priv), (reg))) { \ - gen6_gt_force_wake_get(dev_priv); \ + if (gen6_gt_force_wake_get(dev_priv)) { \ + DRM_DEBUG_DRIVER("unlocked forcewake for 0x%08x\n", reg); \ + } \ val = read##y(dev_priv->regs + reg); \ gen6_gt_force_wake_put(dev_priv); \ } else { \
Signature · 1 line
1.7.5.2
Re: [PATCH 1/2] drm/i915: more forcewake lock error info
Quoted 2 lines · Ben Widawsky
Get some more useful info for debugging backtraces on forcewake problems. Appropriate debug flags will be required for the drm module.
Wouldn't it be neater to pass the reg down to gen6_gt_force_wake_get() so that we only have a single debug message and not an additional one for every inlined read/write?
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 1/2] drm/i915: more forcewake lock error info
Quoted 9 lines · Chris Wilson
Quoted 2 lines · Ben Widawsky
Get some more useful info for debugging backtraces on forcewake problems. Appropriate debug flags will be required for the drm module.
Wouldn't it be neater to pass the reg down to
gen6_gt_force_wake_get()so that we only have a single debug message and not an additional one for every inlined read/write?
-Chris
Urg... having some trouble with my email right now, so you have to deal with my gmail/webmail...
1. Yes, but I was lazy.
2. People call force_wake_get() without actually specifying a register, so I didn't want to enforce people entering bogus info on those calls.
Quoted 8 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
Re: [PATCH 1/2] drm/i915: more forcewake lock error info
Quoted 12 lines · Ben Widawsky
Quoted 9 lines · Chris Wilson
Quoted 2 lines · Ben Widawsky
Get some more useful info for debugging backtraces on forcewake problems. Appropriate debug flags will be required for the drm module.
Wouldn't it be neater to pass the reg down to
gen6_gt_force_wake_get()so that we only have a single debug message and not an additional one for every inlined read/write?
-Chris
Quoted 6 lines
Urg... having some trouble with my email right now, so you have to deal with my gmail/webmail...
1. Yes, but I was lazy.
2. People callforce_wake_get()without actually specifying a register, so I didn't want to enforce people entering bogus info on those calls.
We could always go for the traditional file:line automagic macros... But we already have that from the stacktrace if people are good enough to provide symbols.
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 1/2] drm/i915: more forcewake lock error info
Quoted 16 lines · Chris Wilson
Quoted 15 lines · Ben Widawsky
Quoted 9 lines · Chris Wilson
Quoted 2 lines · Ben Widawsky
Get some more useful info for debugging backtraces on forcewake problems. Appropriate debug flags will be required for the drm module.
Wouldn't it be neater to pass the reg down to
gen6_gt_force_wake_get()so that we only have a single debug message and not an additional one for every inlined read/write?
-ChrisUrg... having some trouble with my email right now, so you have to deal with my gmail/webmail...
Quoted 7 lines
Quoted 3 lines
1. Yes, but I was lazy.
2. People callforce_wake_get()without actually specifying a register, so I didn't want to enforce people entering bogus info on those calls.We could always go for the traditional file:line automagic macros... But we already have that from the stacktrace if people are good enough to provide symbols.
Yeah, I figured this would be easiest as it somewhat removes variance between commits, I can just search for the unprotected register access on the branch du jour (especially with you guys refactoring the code all time time... JBARNES).
I'm fine if the consensus is to throw this one out. Seemed helpful at the time, so I thought I'd post it.
Quoted 1 line
-Chris
Ben
PATCH 2/2 drm/i915: save/resume forcewake lock fixes
In reply to Ben WidawskyThe lock must be held for the saving and restoring of VGA state.
--- drivers/gpu/drm/i915/i915_suspend.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/i915_suspend.c +5 -0
@@ -678,6 +678,7 @@ void i915_save_display(struct drm_device *dev) }/* VGA state */ +mutex_lock (&dev->struct_mutex); dev_priv->saveVGA0 =I915_READ (VGA0 ); dev_priv->saveVGA1 =I915_READ (VGA1 ); dev_priv->saveVGA_PD =I915_READ (VGA_PD );
@@ -687,6 +688,7 @@ void i915_save_display(struct drm_device *dev) dev_priv->saveVGACNTRL =I915_READ (VGACNTRL );i915_save_vga (dev); +mutex_unlock (&dev->struct_mutex); }void i915_restore_display (struct drm_device *dev)
@@ -780,6 +782,8 @@ void i915_restore_display(struct drm_device *dev)I915_WRITE (CPU_VGACNTRL , dev_priv->saveVGACNTRL); else I915_WRITE(VGACNTRL, dev_priv->saveVGACNTRL); + +mutex_lock (&dev->struct_mutex);I915_WRITE (VGA0 , dev_priv->saveVGA0);I915_WRITE (VGA1 , dev_priv->saveVGA1);I915_WRITE (VGA_PD , dev_priv->saveVGA_PD);
@@ -787,6 +791,7 @@ void i915_restore_display(struct drm_device *dev)udelay (150 );i915_restore_vga (dev); +mutex_unlock (&dev->struct_mutex); }int i915_save_state (struct drm_device *dev)
Signature · 1 line
1.7.5.2
Re: [PATCH 2/2] drm/i915: save/resume forcewake lock fixes
Quoted 5 lines · Ben Widawsky
The lock must be held for the saving and restoring of VGA state.
Signed-off-by Ben Widawsky <[email protected]>CC Alexander Zhaunerchyk <[email protected]>CC Andrey Rahmatullin <[email protected]>
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Re: [PATCH 2/2] drm/i915: save/resume forcewake lock fixes
Quoted 1 line · Chris Wilson
Reviewed-by Chris Wilson <[email protected]>
I've added this to drm-intel-fixes
Signature · 1 line
[email protected]
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: save/resume forcewake lock fixes
In reply to Ben WidawskySignature · 1 line
WBR, wRAR
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx