[PATCH 1/2] drm/i915/pmu: Tell lockdep to ignore our dynamic sysfs attributes

Chris Wilson chris at chris-wilson.co.uk
Thu Jan 11 13:59:06 UTC 2018


As we kmalloc our dynamic sysfs attributes they do not have a static
lockclass, so we must tell lockdep to ignore these sysfs.

Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters in sysfs")
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/i915_pmu.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 9139bc8df82b..f089a3da627d 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -716,9 +716,17 @@ static const struct attribute_group *i915_pmu_attr_groups[] = {
 	.name = (__name), \
 }
 
+static void ignore_lockep(struct attribute *attr)
+{
+#if IS_ENABLED(CONFIG_DEBUG_LOCK_ALLOC)
+	attr->ignore_lockdep = true;
+#endif
+}
+
 static struct i915_ext_attribute *
 add_i915_attr(struct i915_ext_attribute *attr, const char *name, u64 config)
 {
+	ignore_lockdep(&attr->attr.attr);
 	attr->attr.attr.name = name;
 	attr->attr.attr.mode = 0444;
 	attr->attr.show = i915_pmu_event_show;
@@ -731,6 +739,7 @@ static struct perf_pmu_events_attr *
 add_pmu_attr(struct perf_pmu_events_attr *attr, const char *name,
 	     const char *str)
 {
+	ignore_lockdep(&attr->attr.attr);
 	attr->attr.attr.name = name;
 	attr->attr.attr.mode = 0444;
 	attr->attr.show = perf_event_sysfs_show;
-- 
2.15.1



More information about the Intel-gfx-trybot mailing list