Skip to contentSkip to conversation

drm/i915: Rename some shorthand lock classes

PATCH In review Chris Wilson 3 participants 5 messages Jan 4, 2018 – Feb 8, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Rename some shorthand lock classes

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.

---
 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           | 3 +++
 drivers/gpu/drm/i915/intel_breadcrumbs.c    | 3 +++
 drivers/gpu/drm/i915/intel_guc_submission.c | 2 ++
 7 files changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +2 -0
index ba9f67c256f4..0276ac53dff1 100644
@@ -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_rename(&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_rename(&obj->mm.get_page.lock, "i915_gem_object->mm.get_page");
 
 	i915_gem_info_add_obj(to_i915(obj->base.dev), obj->base.size);
 }
drivers/gpu/drm/i915/i915_gem_request.c +2 -0
index 72bdc203716f..2b25652517be 100644
@@ -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_rename(&req->lock, "i915_request");
+
 	dma_fence_init(&req->fence,
 		       &i915_fence_ops,
 		       &req->lock,
drivers/gpu/drm/i915/i915_gem_timeline.c +2 -2
index e9fd87604067..82da881e52ae 100644
@@ -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");
 }
 
 /**
drivers/gpu/drm/i915/i915_gem_userptr.c +2 -0
index 382a77a1097e..23b31b588830 100644
@@ -170,6 +170,8 @@ i915_mmu_notifier_create(struct mm_struct *mm)
 		return ERR_PTR(-ENOMEM);
 
 	spin_lock_init(&mn->lock);
+	lockdep_rename(&mn->lock, "i915_mmu_notifier");
+
 	mn->mn.ops = &i915_gem_userptr_notifier;
 	mn->objects = RB_ROOT_CACHED;
 	mn->wq = alloc_workqueue("i915-userptr-release",
drivers/gpu/drm/i915/i915_utils.h +3 -0
index 51dbfe5bb418..18219f1fd98e 100644
@@ -118,6 +118,9 @@ static inline u64 ptr_to_u64(const void *ptr)
 	__idx;								\
 })
 
+#define lockdep_rename(lock, name)					\
+	lockdep_set_class_and_name(lock, (lock)->dep_map.key, name)
+
 #include <linux/list.h>
 
 static inline void __list_del_many(struct list_head *head,
drivers/gpu/drm/i915/intel_breadcrumbs.c +3 -0
index 86acac010bb8..ede7879c25f6 100644
@@ -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_rename(&b->rb_lock, "intel_breadcrumbs->rb");
+
 	spin_lock_init(&b->irq_lock);
+	lockdep_rename(&b->irq_lock, "intel_breadcrumbs->irq");
 
 	timer_setup(&b->fake_irq, intel_breadcrumbs_fake_irq, 0);
 	timer_setup(&b->hangcheck, intel_breadcrumbs_hangcheck, 0);
drivers/gpu/drm/i915/intel_guc_submission.c +2 -0
index 1f3a8786bbdc..e3bfbd71174e 100644
@@ -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_rename(&client->wq_lock, "intel_guc_client->wq");
 
 	ret = ida_simple_get(&guc->stage_ids, 0, GUC_MAX_STAGE_DESCRIPTORS,
 			     GFP_KERNEL);
Signature · 6 lines
2.15.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Quoting Chris Wilson (2018-01-04 21:45:28)

drivers/gpu/drm/i915/i915_utils.h static inline u64 ptr_to_u64(const void *ptr) · line 122

Quoted 2 lines
drivers/gpu/drm/i915/i915_utils.h +2 -0
+#define lockdep_rename(lock, name)                                     \
+       lockdep_set_class_and_name(lock, (lock)->dep_map.key, name)

Maybe lockdep_set_name() for similarity to the others. -Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer Reviewed-by
#2 lore raw

Quoting Chris Wilson (2018-01-04 23:48:45)

Quoted 5 lines

Quoting Chris Wilson (2018-01-04 21:45:28)

drivers/gpu/drm/i915/i915_utils.h static inline u64 ptr_to_u64(const void *ptr) · line 122

Quoted 2 lines
drivers/gpu/drm/i915/i915_utils.h +2 -0
+#define lockdep_rename(lock, name)                                     \
+       lockdep_set_class_and_name(lock, (lock)->dep_map.key, name)

Maybe lockdep_set_name() for similarity to the others.

Yep,

We should attempt to haggle the macro to core. There are less useful macros around there.

Regards, Joonas

Quoted 5 lines

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Quoting Joonas Lahtinen (2018-02-08 14:16:56)

Quoted 5 lines

Quoting Chris Wilson (2018-01-04 23:48:45)

Quoted 4 lines

Quoting Chris Wilson (2018-01-04 21:45:28)

Quoted 2 lines
drivers/gpu/drm/i915/i915_utils.h +2 -0
+#define lockdep_rename(lock, name)                                     \
+       lockdep_set_class_and_name(lock, (lock)->dep_map.key, name)
Quoted 8 lines
Quoted 1 line

Maybe lockdep_set_name() for similarity to the others.

Yep,

We should attempt to haggle the macro to core. There are less useful macros around there.

Yeah, it's in my lockdep pile, i.e. buried deep.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.BAT: success for drm/i915: Rename some shorthand lock classes

In reply to Chris Wilson
== Series Details ==

== Series Details ==

Series: drm/i915: Rename some shorthand lock classes
URL : https://patchwork.freedesktop.org/series/36047/
State : success

== Summary ==

Series 36047v1 drm/i915: Rename some shorthand lock classes
https://patchwork.freedesktop.org/api/1.0/series/36047/revisions/1/mbox/

Test debugfs_test:

        Subgroup read_all_entries:
                pass       -> INCOMPLETE (fi-snb-2520m) fdo#103713
Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                pass       -> FAIL       (fi-gdg-551) fdo#102575
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                pass       -> DMESG-WARN (fi-kbl-r) fdo#104172
        Subgroup suspend-read-crc-pipe-c:
                incomplete -> PASS       (fi-bdw-5557u) fdo#104162
Test kms_psr_sink_crc:
        Subgroup psr_basic:
                dmesg-warn -> PASS       (fi-skl-6700hq) fdo#104260

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#104172 https://bugs.freedesktop.org/show_bug.cgi?id=104172
fdo#104162 https://bugs.freedesktop.org/show_bug.cgi?id=104162
fdo#104260 https://bugs.freedesktop.org/show_bug.cgi?id=104260

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:432s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:422s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:367s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:483s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:275s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:480s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:480s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:464s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:447s
fi-elk-e7500     total:224  pass:168  dwarn:10  dfail:0   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:259s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:508s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:390s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:400s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:411s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:455s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:411s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:466s
fi-kbl-7560u     total:288  pass:268  dwarn:1   dfail:0   fail:0   skip:19  time:496s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:449s
fi-kbl-r         total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:499s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:573s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:430s
fi-skl-6600u     total:288  pass:260  dwarn:1   dfail:0   fail:0   skip:27  time:509s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:531s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:493s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:481s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:429s
fi-snb-2520m     total:3    pass:2    dwarn:0   dfail:0   fail:0   skip:0  
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:394s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:566s
fi-cnl-y         total:218  pass:197  dwarn:0   dfail:0   fail:0   skip:20 
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:467s

8ed3b7257f4b193f702d8c3db3be40494dc6283c drm-tip: 2018y-01m-04d-20h-11m-09s UTC integration manifest 7f18a02accd3 drm/i915: Rename some shorthand lock classes

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7610/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx