[Intel-gfx] [PATCH 03/14] drm/i915: Rename some shorthand lock classes
Chris Wilson
chris at chris-wilson.co.uk
Fri Jan 5 12:37:34 UTC 2018
By default, lockdep takes the stringified variable as the name for the
lock class. Quite often, these are constructed from local variables that
are chosen for their brevity resulting in less than distinct class
names. Rename some of the worst offenders encountered in recent reports.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem.c | 2 ++
drivers/gpu/drm/i915/i915_gem_request.c | 2 ++
drivers/gpu/drm/i915/i915_gem_timeline.c | 4 ++--
drivers/gpu/drm/i915/i915_gem_userptr.c | 2 ++
drivers/gpu/drm/i915/i915_utils.h | 7 +++++++
drivers/gpu/drm/i915/intel_breadcrumbs.c | 3 +++
drivers/gpu/drm/i915/intel_guc_submission.c | 2 ++
7 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index ba9f67c256f4..51488da373e1 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4459,6 +4459,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
const struct drm_i915_gem_object_ops *ops)
{
mutex_init(&obj->mm.lock);
+ lockdep_set_name(&obj->mm.lock, "i915_gem_object->mm");
INIT_LIST_HEAD(&obj->vma_list);
INIT_LIST_HEAD(&obj->lut_list);
@@ -4475,6 +4476,7 @@ void i915_gem_object_init(struct drm_i915_gem_object *obj,
obj->mm.madv = I915_MADV_WILLNEED;
INIT_RADIX_TREE(&obj->mm.get_page.radix, GFP_KERNEL | __GFP_NOWARN);
mutex_init(&obj->mm.get_page.lock);
+ lockdep_set_name(&obj->mm.get_page.lock, "i915_gem_object->mm.get_page");
i915_gem_info_add_obj(to_i915(obj->base.dev), obj->base.size);
}
diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c
index 72bdc203716f..86c86a17d558 100644
--- a/drivers/gpu/drm/i915/i915_gem_request.c
+++ b/drivers/gpu/drm/i915/i915_gem_request.c
@@ -707,6 +707,8 @@ i915_gem_request_alloc(struct intel_engine_cs *engine,
GEM_BUG_ON(req->timeline == engine->timeline);
spin_lock_init(&req->lock);
+ lockdep_set_name(&req->lock, "i915_request");
+
dma_fence_init(&req->fence,
&i915_fence_ops,
&req->lock,
diff --git a/drivers/gpu/drm/i915/i915_gem_timeline.c b/drivers/gpu/drm/i915/i915_gem_timeline.c
index e9fd87604067..82da881e52ae 100644
--- a/drivers/gpu/drm/i915/i915_gem_timeline.c
+++ b/drivers/gpu/drm/i915/i915_gem_timeline.c
@@ -90,7 +90,7 @@ int i915_gem_timeline_init(struct drm_i915_private *i915,
static struct lock_class_key class;
return __i915_gem_timeline_init(i915, timeline, name,
- &class, "&timeline->lock");
+ &class, "i915_user_timeline");
}
int i915_gem_timeline_init__global(struct drm_i915_private *i915)
@@ -100,7 +100,7 @@ int i915_gem_timeline_init__global(struct drm_i915_private *i915)
return __i915_gem_timeline_init(i915,
&i915->gt.global_timeline,
"[execution]",
- &class, "&global_timeline->lock");
+ &class, "i915_global_timeline");
}
/**
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index 382a77a1097e..6b08ee481cea 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -170,6 +170,8 @@ i915_mmu_notifier_create(struct mm_struct *mm)
return ERR_PTR(-ENOMEM);
spin_lock_init(&mn->lock);
+ lockdep_set_name(&mn->lock, "i915_mmu_notifier");
+
mn->mn.ops = &i915_gem_userptr_notifier;
mn->objects = RB_ROOT_CACHED;
mn->wq = alloc_workqueue("i915-userptr-release",
diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index 51dbfe5bb418..dc6deba519db 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -118,6 +118,13 @@ static inline u64 ptr_to_u64(const void *ptr)
__idx; \
})
+#ifdef CONFIG_LOCKDEP
+#define lockdep_set_name(lock, name) \
+ lockdep_set_class_and_name(lock, (lock)->dep_map.key, name)
+#else
+#define lockdep_set_name(lock, name) do {} while (0)
+#endif
+
#include <linux/list.h>
static inline void __list_del_many(struct list_head *head,
diff --git a/drivers/gpu/drm/i915/intel_breadcrumbs.c b/drivers/gpu/drm/i915/intel_breadcrumbs.c
index 86acac010bb8..3b8fff28a7b0 100644
--- a/drivers/gpu/drm/i915/intel_breadcrumbs.c
+++ b/drivers/gpu/drm/i915/intel_breadcrumbs.c
@@ -843,7 +843,10 @@ int intel_engine_init_breadcrumbs(struct intel_engine_cs *engine)
struct task_struct *tsk;
spin_lock_init(&b->rb_lock);
+ lockdep_set_name(&b->rb_lock, "intel_breadcrumbs->rb");
+
spin_lock_init(&b->irq_lock);
+ lockdep_set_name(&b->irq_lock, "intel_breadcrumbs->irq");
timer_setup(&b->fake_irq, intel_breadcrumbs_fake_irq, 0);
timer_setup(&b->hangcheck, intel_breadcrumbs_hangcheck, 0);
diff --git a/drivers/gpu/drm/i915/intel_guc_submission.c b/drivers/gpu/drm/i915/intel_guc_submission.c
index 1f3a8786bbdc..566dc571a81b 100644
--- a/drivers/gpu/drm/i915/intel_guc_submission.c
+++ b/drivers/gpu/drm/i915/intel_guc_submission.c
@@ -888,7 +888,9 @@ guc_client_alloc(struct drm_i915_private *dev_priv,
client->engines = engines;
client->priority = priority;
client->doorbell_id = GUC_DOORBELL_INVALID;
+
spin_lock_init(&client->wq_lock);
+ lockdep_set_name(&client->wq_lock, "intel_guc_client->wq");
ret = ida_simple_get(&guc->stage_ids, 0, GUC_MAX_STAGE_DESCRIPTORS,
GFP_KERNEL);
--
2.15.1
More information about the Intel-gfx
mailing list