From: Chris Wilson <chris@chris-wilson.co.uk>
To: Intel-gfx@lists.freedesktop.org,
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: kui.wen@intel.com
Subject: Re: [Intel-gfx] [RFC 6/8] drm/i915: Expose per-engine client busyness
Date: Fri, 10 Jan 2020 13:58:39 +0000 [thread overview]
Message-ID: <157866471921.10140.2303070485485258716@skylake-alporthouse-com> (raw)
In-Reply-To: <20200110133049.2705-7-tvrtko.ursulin@linux.intel.com>
Quoting Tvrtko Ursulin (2020-01-10 13:30:47)
> +static ssize_t
> +show_client_busy(struct device *kdev, struct device_attribute *attr, char *buf)
> +{
> + struct i915_engine_busy_attribute *i915_attr =
> + container_of(attr, typeof(*i915_attr), attr);
> + struct list_head *list = &i915_attr->client->ctx_list;
> + unsigned int engine_class = i915_attr->engine_class;
> + struct i915_gem_context *ctx;
> + u64 total = 0;
> +
> + if (i915_attr->no_busy_stats)
> + return -ENODEV;
> +
> + rcu_read_lock();
> + list_for_each_entry_rcu(ctx, list, client_link)
> + total += sw_busy_add(ctx, engine_class);
> + rcu_read_unlock();
> +
> + return snprintf(buf, PAGE_SIZE, "%llu\n", total);
> +}
> +
> +static const char *uabi_class_names[] = {
> + [I915_ENGINE_CLASS_RENDER] = "0",
> + [I915_ENGINE_CLASS_COPY] = "1",
> + [I915_ENGINE_CLASS_VIDEO] = "2",
> + [I915_ENGINE_CLASS_VIDEO_ENHANCE] = "3",
> +};
Hmm. /sys/class/drm/card0/clients/0/busy/0
Ok. I was worried this was 0/0 and so very bland and liable to clash
later.
> +
> int
> __i915_drm_client_register(struct i915_drm_client *client,
> struct task_struct *task)
> {
> struct i915_drm_clients *clients = client->clients;
> + struct drm_i915_private *i915 =
> + container_of(clients, typeof(*i915), clients);
> + struct intel_engine_cs *engine;
> struct device_attribute *attr;
> - int ret = -ENOMEM;
> + int i, ret = -ENOMEM;
> char idstr[32];
>
> if (!clients->root)
> @@ -77,10 +130,71 @@ __i915_drm_client_register(struct i915_drm_client *client,
> if (ret)
> goto err_attr;
>
> + if (HAS_LOGICAL_RING_CONTEXTS(i915)) {
> + client->busy_root =
> + kobject_create_and_add("busy", client->root);
> + if (!client->busy_root)
> + goto err_attr;
> +
> + for (i = 0; i < ARRAY_SIZE(uabi_class_names); i++) {
> + struct i915_engine_busy_attribute *i915_attr =
> + &client->attr.busy[i];
if (!intel_engine_lookup_user(i915, i, 0))
continue;
i.e. skip if we don't have any engines of that class in the system.
> +
> + 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);
> + if (ret)
> + goto err_busy;
> + }
> +
> + /* Enable busy stats on all engines. */
> + i = 0;
> + for_each_uabi_engine(engine, i915) {
> + ret = intel_enable_engine_stats(engine);
Hmm. We gave it a global bit in
i915->caps.scheduler & I915_SCHEDULER_CAP_ENABLED.
That'll avoid having to do the individual checking and rollback.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-01-10 13:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-10 13:30 [Intel-gfx] [RFC 0/8] Per client engine busyness Tvrtko Ursulin
2020-01-10 13:30 ` [Intel-gfx] [RFC 1/8] drm/i915: Expose list of clients in sysfs Tvrtko Ursulin
2020-01-10 13:36 ` Chris Wilson
2020-01-10 13:30 ` [Intel-gfx] [RFC 2/8] drm/i915: Update client name on context create Tvrtko Ursulin
2020-01-10 13:39 ` Chris Wilson
2020-01-10 13:30 ` [Intel-gfx] [RFC 3/8] drm/i915: Track per-context engine busyness Tvrtko Ursulin
2020-01-10 13:46 ` Chris Wilson
2020-01-10 13:30 ` [Intel-gfx] [RFC 4/8] drm/i915: Track all user contexts per client Tvrtko Ursulin
2020-01-10 13:30 ` [Intel-gfx] [RFC 5/8] drm/i915: Contexts can use struct pid stored in the client Tvrtko Ursulin
2020-01-10 13:42 ` Chris Wilson
2020-01-30 16:11 ` Tvrtko Ursulin
2020-01-10 13:30 ` [Intel-gfx] [RFC 6/8] drm/i915: Expose per-engine client busyness Tvrtko Ursulin
2020-01-10 13:58 ` Chris Wilson [this message]
2020-01-10 14:09 ` Tvrtko Ursulin
2020-01-10 14:12 ` Chris Wilson
2020-01-10 13:30 ` [Intel-gfx] [RFC 7/8] drm/i915: Track hw reported context runtime Tvrtko Ursulin
2020-01-10 14:03 ` Chris Wilson
2020-01-10 13:30 ` [Intel-gfx] [RFC 8/8] drm/i915: Fallback to hw context runtime when sw tracking is not available Tvrtko Ursulin
2020-01-10 16:26 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Per client engine busyness (rev3) Patchwork
2020-01-10 16:51 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-01-14 4:39 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=157866471921.10140.2303070485485258716@skylake-alporthouse-com \
--to=chris@chris-wilson.co.uk \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=kui.wen@intel.com \
--cc=tvrtko.ursulin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.