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>
This commit is contained in:
Daniel Vetter
2012-04-27 15:17:39 +02:00
parent e5eb3d63c6
commit 742cbee804
3 changed files with 20 additions and 10 deletions

View File

@@ -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;
}