From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>, dri-devel@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 2/7] drm/i915: Make GEM contexts track DRM clients
Date: Thu, 6 Jan 2022 16:55:31 +0000 [thread overview]
Message-ID: <20220106165536.57208-3-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20220106165536.57208-1-tvrtko.ursulin@linux.intel.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Make GEM contexts keep a reference to i915_drm_client for the whole of
of their lifetime which will come handy in following patches.
v2: Don't bother supporting selftests contexts from debugfs. (Chris)
v3 (Lucas): Finish constructing ctx before adding it to the list
v4 (Ram): Rebase.
v5: Trivial rebase for proto ctx changes.
v6: Rebase after clients no longer track name and pid.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> # v5
Reviewed-by: Aravind Iddamsetty <aravind.iddamsetty@intel.com> # v5
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/gem/i915_gem_context.c | 5 +++++
drivers/gpu/drm/i915/gem/i915_gem_context_types.h | 3 +++
2 files changed, 8 insertions(+)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index ebbac2ea0833..b093d3e3a78c 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -1230,6 +1230,9 @@ static void i915_gem_context_release_work(struct work_struct *work)
if (ctx->pxp_wakeref)
intel_runtime_pm_put(&ctx->i915->runtime_pm, ctx->pxp_wakeref);
+ if (ctx->client)
+ i915_drm_client_put(ctx->client);
+
mutex_destroy(&ctx->engines_mutex);
mutex_destroy(&ctx->lut_mutex);
@@ -1653,6 +1656,8 @@ static void gem_context_register(struct i915_gem_context *ctx,
ctx->file_priv = fpriv;
ctx->pid = get_task_pid(current, PIDTYPE_PID);
+ ctx->client = i915_drm_client_get(fpriv->client);
+
snprintf(ctx->name, sizeof(ctx->name), "%s[%d]",
current->comm, pid_nr(ctx->pid));
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context_types.h b/drivers/gpu/drm/i915/gem/i915_gem_context_types.h
index 282cdb8a5c5a..93d24f189ba9 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context_types.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context_types.h
@@ -293,6 +293,9 @@ struct i915_gem_context {
/** @link: place with &drm_i915_private.context_list */
struct list_head link;
+ /** @client: struct i915_drm_client */
+ struct i915_drm_client *client;
+
/**
* @ref: reference count
*
--
2.32.0
next prev parent reply other threads:[~2022-01-06 16:55 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-06 16:55 [Intel-gfx] [PATCH 0/7] Per client GPU stats Tvrtko Ursulin
2022-01-06 16:55 ` [Intel-gfx] [PATCH 1/7] drm/i915: Explicitly track DRM clients Tvrtko Ursulin
2022-01-06 16:55 ` Tvrtko Ursulin [this message]
2022-01-06 16:55 ` [Intel-gfx] [PATCH 3/7] drm/i915: Track runtime spent in closed and unreachable GEM contexts Tvrtko Ursulin
2022-01-06 16:55 ` [Intel-gfx] [PATCH 4/7] drm/i915: Track all user contexts per client Tvrtko Ursulin
2022-01-06 16:55 ` [Intel-gfx] [PATCH 5/7] drm/i915: Track context current active time Tvrtko Ursulin
2022-01-06 16:55 ` [Intel-gfx] [PATCH 6/7] drm: Document fdinfo format specification Tvrtko Ursulin
2022-01-19 15:08 ` Daniel Vetter
2022-01-20 10:30 ` Tvrtko Ursulin
2022-01-20 16:44 ` Rob Clark
2022-01-21 11:50 ` Tvrtko Ursulin
2022-01-25 10:24 ` Tvrtko Ursulin
2022-01-25 10:36 ` Christian König
2022-02-21 11:14 ` Tvrtko Ursulin
2022-01-06 16:55 ` [Intel-gfx] [PATCH 7/7] drm/i915: Expose client engine utilisation via fdinfo Tvrtko Ursulin
2022-02-19 0:51 ` Umesh Nerlige Ramappa
2022-02-22 12:31 ` Tvrtko Ursulin
2022-01-06 18:15 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Per client GPU stats (rev6) Patchwork
2022-01-06 18:17 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-01-06 18:20 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-01-06 18:39 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-01-07 14:46 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2021-12-03 15:49 [Intel-gfx] [PATCH 0/7] Per client GPU stats Tvrtko Ursulin
2021-12-03 15:49 ` [Intel-gfx] [PATCH 2/7] drm/i915: Make GEM contexts track DRM clients Tvrtko Ursulin
2021-09-22 15:51 [Intel-gfx] [PATCH 0/7] Per client GPU stats Tvrtko Ursulin
2021-09-22 15:51 ` [Intel-gfx] [PATCH 2/7] drm/i915: Make GEM contexts track DRM clients Tvrtko Ursulin
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=20220106165536.57208-3-tvrtko.ursulin@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=chris@chris-wilson.co.uk \
--cc=dri-devel@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