diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-04-27 15:17:39 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-05-05 19:46:16 +0200 |
commit | 742cbee8049f434d8ae7908ee56fe4cad3db2658 (patch) | |
tree | 513e556a980b4cd53b08a5cf90815288d9b34c81 /drivers/gpu/drm/i915/i915_debugfs.c | |
parent | e5eb3d63c6182d3f21fbfc836ded748d49d521f9 (diff) |
drm/i915: rework dev->first_error locking
- reduce the irq disabled section, even for a debugfs file this was
way too long.
- always disable irqs when taking the lock.
v2: Thou shalt not mistake locking for reference counting, so:
- reference count the error_state to protect from concurent freeeing.
This will be only really used in the next patch.
Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_debugfs.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 192b27e9046c..72c73de35065 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -698,12 +698,16 @@ static int i915_error_state(struct seq_file *m, void *unused) int i, j, page, offset, elt; spin_lock_irqsave(&dev_priv->error_lock, flags); - if (!dev_priv->first_error) { + error = dev_priv->first_error; + if (error) + kref_get(&error->ref); + spin_unlock_irqrestore(&dev_priv->error_lock, flags); + + if (!error) { seq_printf(m, "no error state collected\n"); - goto out; + return 0; } - error = dev_priv->first_error; seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec, error->time.tv_usec); @@ -786,8 +790,7 @@ static int i915_error_state(struct seq_file *m, void *unused) if (error->display) intel_display_print_error_state(m, dev, error->display); -out: - spin_unlock_irqrestore(&dev_priv->error_lock, flags); + kref_put(&error->ref, i915_error_state_free); return 0; } |