From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [CI 1/8] drm/i915/gt: Show the per-engine runtime in sysfs
Date: Sun, 24 Jan 2021 15:31:29 +0000 [thread overview]
Message-ID: <20210124153136.19124-1-chris@chris-wilson.co.uk> (raw)
Since we already report the per-engine runtime via PMU (using sampling
if a direct measure is not available), and in debugfs, also trivially
include the information for each engine under sysfs as a read-only
property. We only present the total milliseconds to hide any misleading
accuracy and to purposely reduce the precision of the global
unprivileged information.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210123153733.18139-1-chris@chris-wilson.co.uk
---
drivers/gpu/drm/i915/gt/sysfs_engines.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/gpu/drm/i915/gt/sysfs_engines.c b/drivers/gpu/drm/i915/gt/sysfs_engines.c
index 967031056202..57ef5383dd4e 100644
--- a/drivers/gpu/drm/i915/gt/sysfs_engines.c
+++ b/drivers/gpu/drm/i915/gt/sysfs_engines.c
@@ -411,6 +411,19 @@ heartbeat_default(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
static struct kobj_attribute heartbeat_interval_def =
__ATTR(heartbeat_interval_ms, 0444, heartbeat_default, NULL);
+static ssize_t
+runtime_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
+{
+ struct intel_engine_cs *engine = kobj_to_engine(kobj);
+ ktime_t dummy;
+
+ return sprintf(buf, "%llu\n",
+ ktime_to_ms(intel_engine_get_busy_time(engine, &dummy)));
+}
+
+static struct kobj_attribute runtime_attr =
+__ATTR(runtime_ms, 0444, runtime_show, NULL);
+
static void kobj_engine_release(struct kobject *kobj)
{
kfree(kobj);
@@ -521,6 +534,10 @@ void intel_engines_add_sysfs(struct drm_i915_private *i915)
sysfs_create_file(kobj, &preempt_timeout_attr.attr))
goto err_engine;
+ if (intel_engine_supports_stats(engine) &&
+ sysfs_create_file(kobj, &runtime_attr.attr))
+ goto err_engine;
+
add_defaults(container_of(kobj, struct kobj_engine, base));
if (0) {
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2021-01-24 15:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-24 15:31 Chris Wilson [this message]
2021-01-24 15:31 ` [Intel-gfx] [CI 2/8] drm/i915: Expose list of clients in sysfs Chris Wilson
2021-01-24 15:31 ` [Intel-gfx] [CI 3/8] drm/i915: Update client name on context create Chris Wilson
2021-01-24 15:31 ` [Intel-gfx] [CI 4/8] drm/i915: Make GEM contexts track DRM clients Chris Wilson
2021-01-24 15:31 ` [Intel-gfx] [CI 5/8] drm/i915: Track runtime spent in closed and unreachable GEM contexts Chris Wilson
2021-01-24 15:31 ` [Intel-gfx] [CI 6/8] drm/i915: Track all user contexts per client Chris Wilson
2021-01-24 15:31 ` [Intel-gfx] [CI 7/8] drm/i915: Track context current active time Chris Wilson
2021-01-24 15:31 ` [Intel-gfx] [CI 8/8] drm/i915: Expose per-engine client busyness Chris Wilson
2021-01-24 15:55 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [CI,1/8] drm/i915/gt: Show the per-engine runtime in sysfs Patchwork
2021-01-24 15:57 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-01-24 16:24 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-01-24 18:34 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2021-01-23 15:37 [Intel-gfx] [CI 1/8] " Chris Wilson
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=20210124153136.19124-1-chris@chris-wilson.co.uk \
--to=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).