[Intel-gfx] [RFC 8/8] drm/i915: Expose per-engine client busyness
Chris Wilson
chris at chris-wilson.co.uk
Thu Dec 19 23:16:20 UTC 2019
Quoting Chris Wilson (2019-12-19 21:23:27)
> Quoting Tvrtko Ursulin (2019-12-19 18:00:19)
> > + for (i = 0;
> > + client->busy_root && i < ARRAY_SIZE(uabi_class_names);
> > + i++) {
> > + struct i915_engine_busy_attribute *i915_attr =
> > + &client->attr.busy[i];
> > +
> > + i915_attr->client = client;
> > + i915_attr->engine_class = i;
> > +
> > + attr = &i915_attr->attr;
> > +
> > + sysfs_attr_init(&attr->attr);
> > +
> > + attr->attr.name = uabi_class_names[i];
> > + attr->attr.mode = 0444;
> > + attr->show = show_client_busy;
> > +
> > + ret = sysfs_create_file(client->busy_root,
> > + (struct attribute *)attr);
>
> Do we need to hold a reference from the open file to the
> i915_drm_client?
>
> fd = open("/sys/i915/clients/0/0", O_RDONLY);
>
> v[0] = read_u64(fd);
> sleep(2); rewind(fd);
> v[1] = read_u64(fd);
>
> close(fd);
No. Since the sysfs_show() takes a sprintf snapshot of the value, the
above will simply return the same value over and over again. No new
dereferences into our state.
-Chris
More information about the Intel-gfx
mailing list