Commit 5b254c59 authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: Clarify gpu_error.lock locking

i915_capture_error_state can be called from all kinds of contexts, so
needs the full irqsave dance. But the other two places to grab and
release the error state are only called from process context. So
simplify them to the plaine _irq spinlock versions to clarify the
locking semantics.

Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com
Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent f326038a
...@@ -1326,13 +1326,12 @@ void i915_error_state_get(struct drm_device *dev, ...@@ -1326,13 +1326,12 @@ void i915_error_state_get(struct drm_device *dev,
struct i915_error_state_file_priv *error_priv) struct i915_error_state_file_priv *error_priv)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
unsigned long flags;
spin_lock_irqsave(&dev_priv->gpu_error.lock, flags); spin_lock_irq(&dev_priv->gpu_error.lock);
error_priv->error = dev_priv->gpu_error.first_error; error_priv->error = dev_priv->gpu_error.first_error;
if (error_priv->error) if (error_priv->error)
kref_get(&error_priv->error->ref); kref_get(&error_priv->error->ref);
spin_unlock_irqrestore(&dev_priv->gpu_error.lock, flags); spin_unlock_irq(&dev_priv->gpu_error.lock);
} }
...@@ -1346,12 +1345,11 @@ void i915_destroy_error_state(struct drm_device *dev) ...@@ -1346,12 +1345,11 @@ void i915_destroy_error_state(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_error_state *error; struct drm_i915_error_state *error;
unsigned long flags;
spin_lock_irqsave(&dev_priv->gpu_error.lock, flags); spin_lock_irq(&dev_priv->gpu_error.lock);
error = dev_priv->gpu_error.first_error; error = dev_priv->gpu_error.first_error;
dev_priv->gpu_error.first_error = NULL; dev_priv->gpu_error.first_error = NULL;
spin_unlock_irqrestore(&dev_priv->gpu_error.lock, flags); spin_unlock_irq(&dev_priv->gpu_error.lock);
if (error) if (error)
kref_put(&error->ref, i915_error_state_free); kref_put(&error->ref, i915_error_state_free);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment