Message ID | 20180111140402.3984-1-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 11/01/2018 14:04, Chris Wilson wrote: > As we kmalloc our dynamic sysfs attributes, we have to give them an > external static lock_class_key for them to use with lockdep. > > Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters in sysfs") > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> > --- > drivers/gpu/drm/i915/i915_pmu.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c > index 9139bc8df82b..95ab5e28f5be 100644 > --- a/drivers/gpu/drm/i915/i915_pmu.c > +++ b/drivers/gpu/drm/i915/i915_pmu.c > @@ -719,6 +719,7 @@ static const struct attribute_group *i915_pmu_attr_groups[] = { > static struct i915_ext_attribute * > add_i915_attr(struct i915_ext_attribute *attr, const char *name, u64 config) > { > + sysfs_attr_init(&attr->attr.attr); > attr->attr.attr.name = name; > attr->attr.attr.mode = 0444; > attr->attr.show = i915_pmu_event_show; > @@ -731,6 +732,7 @@ static struct perf_pmu_events_attr * > add_pmu_attr(struct perf_pmu_events_attr *attr, const char *name, > const char *str) > { > + sysfs_attr_init(&attr->attr.attr); > attr->attr.attr.name = name; > attr->attr.attr.mode = 0444; > attr->attr.show = perf_event_sysfs_show; > You beat me to it, after I noticed the report on IRC and started digging, just to find sysfs_attr_init, your fix arrived. Thanks! It looks like a standard way of silencing lockdep for this case, although I am not sure what exactly is the purpose of lock class keys in sysfs attributes, and what this kind of defeat could also imply. I planned to do it another loop, iterating the attr array, but I don't see how it matters. It would be one static key versus the two. :? Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Regards, Tvrtko
Quoting Patchwork (2018-01-11 14:39:43) > == Series Details == > > Series: drm/i915/pmu: Initialise our dynamic sysfs attributes for use with lockdep > URL : https://patchwork.freedesktop.org/series/36337/ > State : success > > == Logs == > > For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7649/issues.html Looks like it did the job. Thanks for double checking, and pushed, -Chris
Quoting Tvrtko Ursulin (2018-01-11 14:12:38) > You beat me to it, after I noticed the report on IRC and started > digging, just to find sysfs_attr_init, your fix arrived. Thanks! > > It looks like a standard way of silencing lockdep for this case, > although I am not sure what exactly is the purpose of lock class keys in > sysfs attributes, and what this kind of defeat could also imply. > > I planned to do it another loop, iterating the attr array, but I don't > see how it matters. It would be one static key versus the two. :? It shouldn't as far as I'm aware. I'm conscious that each static attr has its own lockclass, but dynamic users tend to have a shared lockclass. It shouldn't matter unless we nest the sysfs operations? -Chris
diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c index 9139bc8df82b..95ab5e28f5be 100644 --- a/drivers/gpu/drm/i915/i915_pmu.c +++ b/drivers/gpu/drm/i915/i915_pmu.c @@ -719,6 +719,7 @@ static const struct attribute_group *i915_pmu_attr_groups[] = { static struct i915_ext_attribute * add_i915_attr(struct i915_ext_attribute *attr, const char *name, u64 config) { + sysfs_attr_init(&attr->attr.attr); attr->attr.attr.name = name; attr->attr.attr.mode = 0444; attr->attr.show = i915_pmu_event_show; @@ -731,6 +732,7 @@ static struct perf_pmu_events_attr * add_pmu_attr(struct perf_pmu_events_attr *attr, const char *name, const char *str) { + sysfs_attr_init(&attr->attr.attr); attr->attr.attr.name = name; attr->attr.attr.mode = 0444; attr->attr.show = perf_event_sysfs_show;
As we kmalloc our dynamic sysfs attributes, we have to give them an external static lock_class_key for them to use with lockdep. Fixes: 109ec558370f ("drm/i915/pmu: Only enumerate available counters in sysfs") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- drivers/gpu/drm/i915/i915_pmu.c | 2 ++ 1 file changed, 2 insertions(+)