Per client engine busyness
Subsystems (2)
cover Per client engine busyness
From: Tvrtko Ursulin <[email protected]>
Another re-spin of the per-client engine busyness series. Highlights from this version:
* Checkpatch cleanup and bits of review feedback only.
Internally we track time spent on engines for each struct intel_context. This can serve as a building block for several features from the want list:
smarter scheduler decisions, getrusage(2)-like per-GEM-context functionality wanted by some customers, cgroups controller, dynamic SSEU tuning,...
Externally, in sysfs, we expose time spent on GPU per client and per engine class.
Sysfs interface enables us to implement a "top-like" tool for GPU tasks. Or with a "screenshot":
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
intel-gpu-top - 906/ 955 MHz; 0% RC6; 5.30 Watts; 933 irqs/s
IMC reads: 4414 MiB/s
IMC writes: 3805 MiB/s
ENGINE BUSY MI_SEMA MI_WAIT
Render/3D/0 93.46% |████████████████████████████████▋ | 0% 0%
Blitter/0 0.00% | | 0% 0%
Video/0 0.00% | | 0% 0%
VideoEnhance/0 0.00% | | 0% 0%
PID NAME Render/3D Blitter Video VideoEnhance
2733 neverball |██████▌ || || || | 2047 Xorg |███▊ || || || | 2737 glxgears |█▍ || || || | 2128 xfwm4 | || || || | 2047 Xorg | || || || |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Implementation wise we add a a bunch of files in sysfs like:
# cd /sys/class/drm/card0/clients/ # tree . ├── 7 │ ├── busy │ │ ├── 0 │ │ ├── 1 │ │ ├── 2 │ │ └── 3 │ ├── name │ └── pid ├── 8 │ ├── busy │ │ ├── 0 │ │ ├── 1 │ │ ├── 2 │ │ └── 3 │ ├── name │ └── pid └── 9 ├── busy │ ├── 0 │ ├── 1 │ ├── 2 │ └── 3 ├── name └── pid
Files in 'busy' directories are numbered using the engine class ABI values and they contain accumulated nanoseconds each client spent on engines of a respective class.
It is stil a RFC since it misses dedicated test cases to ensure things really work as advertised.
Tvrtko Ursulin (10):
drm/i915: Expose list of clients in sysfs
drm/i915: Update client name on context create drm/i915: Make GEM contexts track DRM clients drm/i915: Use explicit flag to mark unreachable intel_context drm/i915: Track runtime spent in unreachable intel_contexts drm/i915: Track runtime spent in closed GEM contexts drm/i915: Track all user contexts per client drm/i915: Expose per-engine client busyness drm/i915: Track context current active time drm/i915: Prefer software tracked context busyness
drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/gem/i915_gem_context.c | 63 ++- .../gpu/drm/i915/gem/i915_gem_context_types.h | 21 +- .../gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- drivers/gpu/drm/i915/gt/intel_context.c | 18 +- drivers/gpu/drm/i915/gt/intel_context.h | 6 +- drivers/gpu/drm/i915/gt/intel_context_types.h | 25 +- drivers/gpu/drm/i915/gt/intel_lrc.c | 55 ++- drivers/gpu/drm/i915/gt/selftest_lrc.c | 10 +- drivers/gpu/drm/i915/i915_debugfs.c | 29 +- drivers/gpu/drm/i915/i915_drm_client.c | 431 ++++++++++++++++++ drivers/gpu/drm/i915/i915_drm_client.h | 93 ++++ drivers/gpu/drm/i915/i915_drv.c | 3 + drivers/gpu/drm/i915/i915_drv.h | 5 + drivers/gpu/drm/i915/i915_gem.c | 25 +- drivers/gpu/drm/i915/i915_gpu_error.c | 25 +- drivers/gpu/drm/i915/i915_sysfs.c | 8 + 17 files changed, 743 insertions(+), 79 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_drm_client.c create mode 100644 drivers/gpu/drm/i915/i915_drm_client.h
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/10 drm/i915: Expose list of clients in sysfs
From: Tvrtko Ursulin <[email protected]>
Expose a list of clients with open file handles in sysfs.
This will be a basis for a top-like utility showing per-client and per- engine GPU load.
Currently we only expose each client's pid and name under opaque numbered directories in /sys/class/drm/card0/clients/.
For instance:
/sys/class/drm/card0/clients/3/name: Xorg/sys/class/drm/card0/clients/3/pid: 5664
v2:
Chris Wilson:
* Enclose new members into dedicated structs.
* Protect against failed sysfs registration.
v3:
* sysfs_attr_init.
v4:
* Fix for internal clients.
v5:
* Use cyclic ida for client id. (Chris)
* Do not leak pid reference. (Chris)
* Tidy code with some locals.
v6:
* Use xa_alloc_cyclic to simplify locking. (Chris)
* No need to unregister individial sysfs files. (Chris)
* Rebase on top of fpriv kref.
* Track client closed status and reflect in sysfs.
v7:
* Make drm_client more standalone concept.
v8:
* Simplify sysfs show. (Chris)
* Always track name and pid.
v9:
* Fix cyclic id assignment.
v10:
* No need for a mutex around xa_alloc_cyclic.
* Refactor sysfs into own function.
* Unregister sysfs before freeing pid and name.
* Move clients setup into own function.
v11:
* Call clients init directly from driver init. (Chris)
--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/i915_drm_client.c | 179 +++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_drm_client.h | 64 +++++++++ drivers/gpu/drm/i915/i915_drv.c | 3 + drivers/gpu/drm/i915/i915_drv.h | 5 + drivers/gpu/drm/i915/i915_gem.c | 25 +++- drivers/gpu/drm/i915/i915_sysfs.c | 8 ++ 7 files changed, 283 insertions(+), 4 deletions(-) create mode 100644 drivers/gpu/drm/i915/i915_drm_client.c create mode 100644 drivers/gpu/drm/i915/i915_drm_client.h
drivers/gpu/drm/i915/Makefile +2 -1
@@ -36,7 +36,8 @@ subdir-ccflags-y += -I$(srctree)/$(src) # Please keep these build lists sorted! # core driver code -i915-y += i915_drv.o \ +i915-y += i915_drm_client.o \ + i915_drv.o \ i915_irq.o \ i915_getparam.o \ i915_params.o \
drivers/gpu/drm/i915/i915_drm_client.c new file +179 -0
179 lines not on this page · raw message
drivers/gpu/drm/i915/i915_drm_client.h new file +64 -0
64 lines not on this page · raw message
drivers/gpu/drm/i915/i915_drv.c +3 -0
@@ -69,6 +69,7 @@#include "gt/intel_rc6.h" #include "i915_debugfs.h" +#include "i915_drm_client.h" #include "i915_drv.h" #include "i915_ioc32.h" #include "i915_irq.h"
@@ -456,6 +457,8 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)i915_gem_init_early (dev_priv); +i915_drm_clients_init (&dev_priv->clients); +/* This must be called before any calls to HAS_PCH_* */ intel_detect_pch (dev_priv);
drivers/gpu/drm/i915/i915_drv.h +5 -0
@@ -91,6 +91,7 @@#include "intel_wakeref.h" #include "intel_wopcm.h" +#include "i915_drm_client.h" #include "i915_gem.h" #include "i915_gem_gtt.h" #include "i915_gpu_error.h"
@@ -226,6 +227,8 @@ struct drm_i915_file_private {/** ban_score: Accumulated score of all ctx bans and fast hangs. */ atomic_t ban_score;unsigned long hang_timestamp; + +struct i915_drm_client *client; };/* Interface history:
@@ -1198,6 +1201,8 @@ struct drm_i915_private {struct i915_pmu pmu; +struct i915_drm_clients clients; +struct i915_hdcp_comp_master *hdcp_master;bool hdcp_comp_added;
drivers/gpu/drm/i915/i915_gem.c +22 -3
@@ -1231,6 +1231,8 @@ void i915_gem_cleanup_early(struct drm_i915_private *dev_priv)GEM_BUG_ON (!llist_empty (&dev_priv->mm.free_list));GEM_BUG_ON (atomic_read (&dev_priv->mm.free_count));drm_WARN_ON (&dev_priv->drm, dev_priv->mm.shrink_count); +drm_WARN_ON (&dev_priv->drm, !xa_empty (&dev_priv->clients.xarray)); +xa_destroy (&dev_priv->clients.xarray); }int i915_gem_freeze (struct drm_i915_private *dev_priv)
@@ -1285,6 +1287,8 @@ void i915_gem_release(struct drm_device *dev, struct drm_file *file)struct drm_i915_file_private *file_priv = file->driver_priv;struct i915_request *request; +i915_drm_client_close (file_priv->client); +/* Clean up our request list when the client is going away, so that * later retire_requests won't dereference our soon-to-be-gone * file_priv.
@@ -1298,17 +1302,25 @@ void i915_gem_release(struct drm_device *dev, struct drm_file *file)int i915_gem_open (struct drm_i915_private *i915,struct drm_file *file) {struct drm_i915_file_private *file_priv; -int ret; +struct i915_drm_client *client; +int ret = -ENOMEM ;DRM_DEBUG ("\n" ); file_priv =kzalloc (sizeof (*file_priv),GFP_KERNEL );if (!file_priv) -return -ENOMEM ; + goto err_alloc; + + client =i915_drm_client_add (&i915->clients, current); +if (IS_ERR (client)) { + ret =PTR_ERR (client); + goto err_client; + } file->driver_priv = file_priv; file_priv->dev_priv = i915; file_priv->file = file; + file_priv->client = client;spin_lock_init (&file_priv->mm.lock);INIT_LIST_HEAD (&file_priv->mm.request_list);
@@ -1318,8 +1330,15 @@ int i915_gem_open(struct drm_i915_private *i915, struct drm_file *file) ret =i915_gem_context_open (i915, file);if (ret) -kfree (file_priv); + goto err_context; + +return 0 ; +err_context: +i915_drm_client_close (client); +err_client: +kfree (file_priv); +err_alloc:return ret; }
drivers/gpu/drm/i915/i915_sysfs.c +8 -0
@@ -560,6 +560,11 @@ void i915_setup_sysfs(struct drm_i915_private *dev_priv)struct device *kdev = dev_priv->drm.primary->kdev;int ret; + dev_priv->clients.root = +kobject_create_and_add ("clients" , &kdev->kobj); +if (!dev_priv->clients.root) +DRM_ERROR ("Per-client sysfs setup failed\n" ); +#ifdef CONFIG_PM if (HAS_RC6 (dev_priv)) { ret = sysfs_merge_group(&kdev->kobj,
@@ -627,4 +632,7 @@ void i915_teardown_sysfs(struct drm_i915_private *dev_priv)sysfs_unmerge_group (&kdev->kobj, &rc6_attr_group);sysfs_unmerge_group (&kdev->kobj, &rc6p_attr_group);#endif + +if (dev_priv->clients.root) +kobject_put (dev_priv->clients.root); }
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/10 drm/i915: Update client name on context create
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Some clients have the DRM fd passed to them over a socket by the X server.
Grab the real client and pid when they create their first context and update the exposed data for more useful enumeration.
To enable lockless access to client name and pid data from the following patches, we also make these fields rcu protected. In this way asynchronous code paths where both contexts which remain after the client exit, and access to client name and pid as they are getting updated due context creation running in parallel with name/pid queries.
v2:
* Do not leak the pid reference and borrow context idr_lock. (Chris)
v3:
* More avoiding leaks. (Chris)
v4:
* Move update completely to drm client. (Chris)
* Do not lose previous client data on failure to re-register and simplify update to only touch what it needs.
v5:
* Reuse ext_data local. (Chris)
--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 5 + drivers/gpu/drm/i915/i915_drm_client.c | 103 ++++++++++++++++++-- drivers/gpu/drm/i915/i915_drm_client.h | 10 +- 3 files changed, 106 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +5 -0
@@ -74,6 +74,7 @@#include "gt/intel_engine_user.h" #include "gt/intel_ring.h" +#include "i915_drm_client.h" #include "i915_gem_context.h" #include "i915_globals.h" #include "i915_trace.h"
@@ -2357,6 +2358,10 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,return -EIO ; } + ret =i915_drm_client_update (ext_data.fpriv->client, current); +if (ret) +return ret; + ext_data.ctx =i915_gem_create_context (i915, args->flags);if (IS_ERR (ext_data.ctx))return PTR_ERR (ext_data.ctx);
drivers/gpu/drm/i915/i915_drm_client.c +93 -10
144 lines not on this page · raw message
drivers/gpu/drm/i915/i915_drm_client.h +8 -2
@@ -9,6 +9,7 @@#include <linux/device.h> #include <linux/kobject.h> #include <linux/kref.h> +#include <linux/mutex.h> #include <linux/pid.h> #include <linux/rcupdate.h> #include <linux/sched.h>
@@ -26,9 +27,11 @@ struct i915_drm_client {struct rcu_head rcu; +struct mutex update_lock;/* Serializes name and pid updates. */ +unsigned int id; -struct pid *pid; -char *name; +struct pid __rcu *pid; +char __rcu *name;bool closed;struct i915_drm_clients *clients;
@@ -61,4 +64,7 @@ void i915_drm_client_close(struct i915_drm_client *client);struct i915_drm_client *i915_drm_client_add (struct i915_drm_clients *clients,struct task_struct *task); +int i915_drm_client_update (struct i915_drm_client *client, +struct task_struct *task); +#endif /* !__I915_DRM_CLIENT_H__ */
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/10 drm/i915: Make GEM contexts track DRM clients
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
If we make GEM contexts keep a reference to i915_drm_client for the whole of their lifetime, we can consolidate the current task pid and name usage by getting it from the client.
v2:
* Don't bother supporting selftests contexts from debugfs. (Chris)
--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 23 ++++++++++++--- .../gpu/drm/i915/gem/i915_gem_context_types.h | 13 ++------- drivers/gpu/drm/i915/i915_debugfs.c | 29 +++++++------------ drivers/gpu/drm/i915/i915_gpu_error.c | 21 ++++++++------ 4 files changed, 44 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +19 -4
@@ -340,8 +340,13 @@ static struct i915_gem_engines *default_engines(struct i915_gem_context *ctx)static void i915_gem_context_free (struct i915_gem_context *ctx) { +struct i915_drm_client *client = ctx->client; +GEM_BUG_ON (!i915_gem_context_is_closed (ctx)); +if (client) +i915_drm_client_put (client); +spin_lock (&ctx->i915->gem.contexts.lock);list_del (&ctx->link);spin_unlock (&ctx->i915->gem.contexts.lock);
@@ -351,7 +356,6 @@ static void i915_gem_context_free(struct i915_gem_context *ctx)if (ctx->timeline)intel_timeline_put (ctx->timeline); -put_pid (ctx->pid);mutex_destroy (&ctx->mutex);kfree_rcu (ctx, rcu);
@@ -911,6 +915,7 @@ static int gem_context_register(struct i915_gem_context *ctx,struct drm_i915_file_private *fpriv, u32 *id) { + struct i915_drm_client *client;struct i915_address_space *vm;int ret;
@@ -922,15 +927,25 @@ static int gem_context_register(struct i915_gem_context *ctx,WRITE_ONCE (vm->file, fpriv);/* XXX */ mutex_unlock (&ctx->mutex); - ctx->pid =get_task_pid (current,PIDTYPE_PID ); + client =i915_drm_client_get (fpriv->client); + +rcu_read_lock ();snprintf (ctx->name,sizeof (ctx->name),"%s[%d]" , - current->comm,pid_nr (ctx->pid)); +rcu_dereference (client->name), +pid_nr (rcu_dereference (client->pid))); +rcu_read_unlock ();/* And finally expose ourselves to userspace via the idr */ ret =xa_alloc (&fpriv->context_xa, id, ctx, xa_limit_32b,GFP_KERNEL );if (ret) -put_pid (fetch_and_zero (&ctx->pid)); + goto err; + + ctx->client = client; +return 0 ; + +err: +i915_drm_client_put (client);return ret; }
drivers/gpu/drm/i915/gem/i915_gem_context_types.h +3 -10
@@ -96,20 +96,13 @@ struct i915_gem_context {*/ struct i915_address_space __rcu *vm; -/** -* @pid: process id of creator -* -* Note that who created the context may not be the principle user, -* as the context may be shared across a local socket. However, -* that should only affect the default context, all contexts created -* explicitly by the client are expected to be isolated. -*/ -struct pid *pid; -/** link: place with &drm_i915_private.context_list */ struct list_head link;struct llist_node free_link; +/** client: struct i915_drm_client */ +struct i915_drm_client *client; +/** * @ref: reference count *
drivers/gpu/drm/i915/i915_debugfs.c +10 -19
@@ -330,17 +330,15 @@ static void print_context_stats(struct seq_file *m, .vm = rcu_access_pointer(ctx->vm), };struct drm_file *file = ctx->file_priv->file; -struct task_struct *task;char name[80 ];rcu_read_lock (); +idr_for_each (&file->object_idr, per_file_stats, &stats); -rcu_read_unlock (); -rcu_read_lock (); - task =pid_task (ctx->pid ?: file->pid,PIDTYPE_PID );snprintf (name,sizeof (name),"%s" , - task ? task->comm :"<unknown>" ); +rcu_dereference (ctx->client->name)); +rcu_read_unlock ();print_file_stats (m, name, stats);
@@ -1059,20 +1057,13 @@ static int i915_context_status(struct seq_file *m, void *unused)spin_unlock (&i915->gem.contexts.lock);seq_puts (m,"HW context " ); -if (ctx->pid) { -struct task_struct *task; - - task =get_pid_task (ctx->pid,PIDTYPE_PID ); -if (task) { -seq_printf (m,"(%s [%d]) " , - task->comm, task->pid); -put_task_struct (task); - } - }else if (IS_ERR (ctx->file_priv)) { -seq_puts (m,"(deleted) " ); - }else { -seq_puts (m,"(kernel) " ); - } + +rcu_read_lock (); +seq_printf (m,"(%s [%d]) %s" , +rcu_dereference (ctx->client->name), +pid_nr (rcu_dereference (ctx->client->pid)), + ctx->client->closed ?"(closed) " :"" ); +rcu_read_unlock ();seq_putc (m, ctx->remap_slice ?'R' :'r' );seq_putc (m,'\n' );
drivers/gpu/drm/i915/i915_gpu_error.c +12 -9
@@ -1221,7 +1221,8 @@ static void record_request(const struct i915_request *request,rcu_read_lock (); ctx =rcu_dereference (request->context->gem_context);if (ctx) - erq->pid =pid_nr (ctx->pid); + erq->pid =I915_SELFTEST_ONLY (!ctx->client) ? +0 :pid_nr (rcu_dereference (ctx->client->pid));rcu_read_unlock (); }
@@ -1241,23 +1242,25 @@ static bool record_context(struct i915_gem_context_coredump *e, const struct i915_request *rq) {struct i915_gem_context *ctx; -struct task_struct *task;bool simulated;rcu_read_lock (); + ctx =rcu_dereference (rq->context->gem_context);if (ctx && !kref_get_unless_zero (&ctx->ref)) ctx =NULL ; -rcu_read_unlock (); -if (!ctx) +if (!ctx) { +rcu_read_unlock ();return true; + } -rcu_read_lock (); - task =pid_task (ctx->pid,PIDTYPE_PID ); -if (task) { -strcpy (e->comm, task->comm); - e->pid = task->pid; +if (I915_SELFTEST_ONLY (!ctx->client)) { +strcpy (e->comm,"[kernel]" ); + }else { +strcpy (e->comm,rcu_dereference (ctx->client->name)); + e->pid =pid_nr (rcu_dereference (ctx->client->pid)); } +rcu_read_unlock (); e->sched_attr = ctx->sched;
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/10 drm/i915: Use explicit flag to mark unreachable intel_context
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
I need to keep the GEM context around a bit longer so adding an explicit flag for syncing execbuf with closed/abandonded contexts.
v2:
* Use already available context flags. (Chris)
--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 3 ++- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- drivers/gpu/drm/i915/gt/intel_context_types.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +2 -1
@@ -579,7 +579,8 @@ static void engines_idle_release(struct i915_gem_context *ctx,int err =0 ;/* serialises with execbuf */ -RCU_INIT_POINTER (ce->gem_context,NULL ); +set_bit (INTEL_CONTEXT_CLOSED , &ce->flags); +if (!intel_context_pin_if_active (ce))continue ;
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +1 -1
@@ -2316,7 +2316,7 @@ static void eb_request_add(struct i915_execbuffer *eb) prev =__i915_request_commit (rq);/* Check that the context wasn't destroyed before submission */ -if (likely (rcu_access_pointer (eb->context->gem_context))) { +if (likely (!test_bit (INTEL_CONTEXT_CLOSED , &eb->context->flags))) { attr = eb->gem_context->sched;/*
drivers/gpu/drm/i915/gt/intel_context_types.h +1 -0
@@ -66,6 +66,7 @@ struct intel_context {#define CONTEXT_BANNED 4#define CONTEXT_FORCE_SINGLE_SUBMISSION 5#define CONTEXT_NOPREEMPT 6 +#define INTEL_CONTEXT_CLOSED 7u32 *lrc_reg_state;u64 lrc_desc;
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/10 drm/i915: Track runtime spent in unreachable intel_contexts
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
As contexts are abandoned we want to remember how much GPU time they used (per class) so later we can used it for smarter purposes.
--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 13 ++++++++++++- drivers/gpu/drm/i915/gem/i915_gem_context_types.h | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +12 -1
@@ -257,7 +257,19 @@ static void free_engines_rcu(struct rcu_head *rcu) {struct i915_gem_engines *engines = container_of(rcu, struct i915_gem_engines, rcu); +struct i915_gem_context *ctx = engines->ctx; +struct i915_gem_engines_iter it; +struct intel_context *ce; + +/* Transfer accumulated runtime to the parent GEM context. */ +for_each_gem_engine (ce, engines, it) { +unsigned int class = ce->engine->uabi_class; +GEM_BUG_ON (class >=ARRAY_SIZE (ctx->past_runtime)); +atomic64_add (ce->runtime.total, &ctx->past_runtime[class]); + } + +i915_gem_context_put (ctx);i915_sw_fence_fini (&engines->fence);free_engines (engines); }
@@ -278,7 +290,6 @@ engines_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state)list_del (&engines->link);spin_unlock_irqrestore (&ctx->stale.lock, flags); } -i915_gem_context_put (engines->ctx);break ;case FENCE_FREE :
drivers/gpu/drm/i915/gem/i915_gem_context_types.h +5 -0
@@ -177,6 +177,11 @@ struct i915_gem_context {spinlock_t lock; struct list_head engines; } stale; + +/** +* @past_runtime: Accumulation of freed intel_context pphwsp runtimes. +*/ +atomic64_t past_runtime[MAX_ENGINE_CLASS +1 ]; };#endif /* __I915_GEM_CONTEXT_TYPES_H__ */
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/10 drm/i915: Track runtime spent in closed GEM contexts
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
As GEM contexts are closed we want to have the DRM client remember how much GPU time they used (per class) so later we can used it for smarter purposes.
--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 12 +++++++++++- drivers/gpu/drm/i915/i915_drm_client.h | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +11 -1
@@ -355,8 +355,18 @@ static void i915_gem_context_free(struct i915_gem_context *ctx)GEM_BUG_ON (!i915_gem_context_is_closed (ctx)); -if (client) +if (client) { +unsigned int i; + +/* Transfer accumulated runtime to the parent drm client. */ +BUILD_BUG_ON (ARRAY_SIZE (client->past_runtime) != +ARRAY_SIZE (ctx->past_runtime)); +for (i =0 ; i <ARRAY_SIZE (client->past_runtime); i++) +atomic64_add (atomic64_read (&ctx->past_runtime[i]), + &client->past_runtime[i]); +i915_drm_client_put (client); + }spin_lock (&ctx->i915->gem.contexts.lock);list_del (&ctx->link);
drivers/gpu/drm/i915/i915_drm_client.h +7 -0
@@ -15,6 +15,8 @@#include <linux/sched.h> #include <linux/xarray.h> +#include "gt/intel_engine_types.h" +struct i915_drm_clients {struct xarray xarray;u32 next_id;
@@ -41,6 +43,11 @@ struct i915_drm_client {struct device_attribute pid;struct device_attribute name; } attr; + +/** +* @past_runtime: Accumulation of pphwsp runtimes from closed contexts. +*/ +atomic64_t past_runtime[MAX_ENGINE_CLASS +1 ]; };void i915_drm_clients_init (struct i915_drm_clients *clients);
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/10 drm/i915: Expose per-engine client busyness
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Expose per-client and per-engine busyness under the previously added sysfs client root.
The new files are one per-engine instance and located under the 'busy' directory. Each contains a monotonically increasing nano-second resolution times each client's jobs were executing on the GPU.
This enables userspace to create a top-like tool for GPU utilization:
==========================================================================
intel-gpu-top - 935/ 935 MHz; 0% RC6; 14.73 Watts; 1097 irqs/s
IMC reads: 1401 MiB/s
IMC writes: 4 MiB/s
ENGINE BUSY MI_SEMA MI_WAIT
Render/3D/0 63.73% |███████████████████ | 3% 0%
Blitter/0 9.53% |██▊ | 6% 0%
Video/0 39.32% |███████████▊ | 16% 0%
Video/1 15.62% |████▋ | 0% 0%
VideoEnhance/0 0.00% | | 0% 0%
PID NAME RCS BCS VCS VECS
4084 gem_wsim |█████▌ ||█ || || | 4086 gem_wsim |█▌ || ||███ || |
==========================================================================
v2: Use intel_context_engine_get_busy_time.
v3: New directory structure.
v4: Rebase.
v5: sysfs_attr_init.
v6: Small tidy in i915_gem_add_client.
v7: Rebase to be engine class based.
v8:
* Always enable stats.
* Walk all client contexts.
v9:
* Skip unsupported engine classes. (Chris)
* Use scheduler caps. (Chris)
v10:
* Use pphwsp runtime only.
--- drivers/gpu/drm/i915/i915_drm_client.c | 110 ++++++++++++++++++++++++- drivers/gpu/drm/i915/i915_drm_client.h | 11 +++ 2 files changed, 120 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drm_client.c +109 -1
@@ -9,8 +9,13 @@#include <drm/drm_print.h> +#include <uapi/drm/i915_drm.h> +#include "i915_drv.h" #include "i915_drm_client.h" +#include "gem/i915_gem_context.h" +#include "gt/intel_engine_user.h" +#include "i915_drv.h" #include "i915_gem.h" #include "i915_utils.h"
@@ -52,6 +57,104 @@ show_client_pid(struct device *kdev, struct device_attribute *attr, char *buf)return ret; } +static u64 +pphwsp_busy_add (struct i915_gem_context *ctx,unsigned int class) +{ +struct i915_gem_engines *engines =rcu_dereference (ctx->engines); +struct i915_gem_engines_iter it; +struct intel_context *ce; +u64 total =0 ; + +for_each_gem_engine (ce, engines, it) { +if (ce->engine->uabi_class == class) + total += ce->runtime.total; + } + +return total; +} + +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); +unsigned int class = i915_attr->engine_class; +struct i915_drm_client *client = i915_attr->client; +u64 total =atomic64_read (&client->past_runtime[class]); +struct list_head *list = &client->ctx_list; +struct i915_gem_context *ctx; + +rcu_read_lock (); +list_for_each_entry_rcu (ctx, list, client_link) { + total +=atomic64_read (&ctx->past_runtime[class]); + total +=pphwsp_busy_add (ctx, class); + } +rcu_read_unlock (); + + total *=RUNTIME_INFO (i915_attr->i915)->cs_timestamp_period_ns; + +return snprintf (buf,PAGE_SIZE ,"%llu\n" , total); +} + +static const char *const uabi_class_names[] = { + [I915_ENGINE_CLASS_RENDER ] ="0" , + [I915_ENGINE_CLASS_COPY ] ="1" , + [I915_ENGINE_CLASS_VIDEO ] ="2" , + [I915_ENGINE_CLASS_VIDEO_ENHANCE ] ="3" , +}; + +static int +__client_register_sysfs_busy (struct i915_drm_client *client) +{ +struct i915_drm_clients *clients = client->clients; +struct drm_i915_private *i915 = +container_of (clients,typeof (*i915), clients); +unsigned int i; +int ret =0 ; + +if (!HAS_LOGICAL_RING_CONTEXTS (i915)) +return 0 ; + + client->busy_root =kobject_create_and_add ("busy" , client->root); +if (!client->busy_root) +return -ENOMEM ; + +for (i =0 ; i <ARRAY_SIZE (uabi_class_names); i++) { +struct i915_engine_busy_attribute *i915_attr = + &client->attr.busy[i]; +struct device_attribute *attr = &i915_attr->attr; + +if (!intel_engine_lookup_user (i915, i,0 )) +continue ; + + i915_attr->client = client; + i915_attr->i915 = i915; + i915_attr->engine_class = i; + +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; + } + +return 0 ; + +err: +kobject_put (client->busy_root); +return ret; +} + +static void __client_unregister_sysfs_busy (struct i915_drm_client *client) +{ +kobject_put (fetch_and_zero (&client->busy_root)); +} +static int __client_register_sysfs (struct i915_drm_client *client) {
@@ -88,9 +191,12 @@ __client_register_sysfs(struct i915_drm_client *client) ret =sysfs_create_file (client->root, (struct attribute *)attr);if (ret) -break ; + goto out; } + ret =__client_register_sysfs_busy (client); + +out:if (ret)kobject_put (client->root);
@@ -99,6 +205,8 @@ __client_register_sysfs(struct i915_drm_client *client)static void __client_unregister_sysfs (struct i915_drm_client *client) { +__client_unregister_sysfs_busy (client); +kobject_put (fetch_and_zero (&client->root)); }
drivers/gpu/drm/i915/i915_drm_client.h +11 -0
@@ -26,6 +26,15 @@ struct i915_drm_clients {struct kobject *root; }; +struct i915_drm_client ; + +struct i915_engine_busy_attribute { +struct device_attribute attr; +struct drm_i915_private *i915; +struct i915_drm_client *client; +unsigned int engine_class; +}; +struct i915_drm_client {struct kref kref;
@@ -44,9 +53,11 @@ struct i915_drm_client {struct i915_drm_clients *clients;struct kobject *root; +struct kobject *busy_root;struct {struct device_attribute pid;struct device_attribute name; +struct i915_engine_busy_attribute busy[MAX_ENGINE_CLASS +1 ]; } attr;/**
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/10 drm/i915: Track all user contexts per client
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
We soon want to start answering questions like how much GPU time is the context belonging to a client which exited still using.
To enable this we start tracking all context belonging to a client on a separate list.
--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 8 ++++++++ drivers/gpu/drm/i915/gem/i915_gem_context_types.h | 3 +++ drivers/gpu/drm/i915/i915_drm_client.c | 3 +++ drivers/gpu/drm/i915/i915_drm_client.h | 5 +++++ 4 files changed, 19 insertions(+)
drivers/gpu/drm/i915/gem/i915_gem_context.c +8 -0
@@ -358,6 +358,10 @@ static void i915_gem_context_free(struct i915_gem_context *ctx)if (client) {unsigned int i; +spin_lock (&client->ctx_lock); +list_del_rcu (&ctx->client_link); +spin_unlock (&client->ctx_lock); +/* Transfer accumulated runtime to the parent drm client. */ BUILD_BUG_ON (ARRAY_SIZE (client->past_runtime) !=ARRAY_SIZE (ctx->past_runtime));
@@ -964,6 +968,10 @@ static int gem_context_register(struct i915_gem_context *ctx, ctx->client = client; +spin_lock (&client->ctx_lock); +list_add_tail_rcu (&ctx->client_link, &client->ctx_list); +spin_unlock (&client->ctx_lock); +return 0 ; err:
drivers/gpu/drm/i915/gem/i915_gem_context_types.h +3 -0
@@ -103,6 +103,9 @@ struct i915_gem_context {/** client: struct i915_drm_client */ struct i915_drm_client *client; +/** link: &drm_client.context_list */ +struct list_head client_link; +/** * @ref: reference count *
drivers/gpu/drm/i915/i915_drm_client.c +3 -0
@@ -154,6 +154,9 @@ i915_drm_client_add(struct i915_drm_clients *clients, struct task_struct *task)kref_init (&client->kref);mutex_init (&client->update_lock); +spin_lock_init (&client->ctx_lock); +INIT_LIST_HEAD (&client->ctx_list); + client->clients = clients; ret = xa_alloc_cyclic(&clients->xarray, &client->id, client,
drivers/gpu/drm/i915/i915_drm_client.h +5 -0
@@ -9,10 +9,12 @@#include <linux/device.h> #include <linux/kobject.h> #include <linux/kref.h> +#include <linux/list.h> #include <linux/mutex.h> #include <linux/pid.h> #include <linux/rcupdate.h> #include <linux/sched.h> +#include <linux/spinlock.h> #include <linux/xarray.h> #include "gt/intel_engine_types.h"
@@ -36,6 +38,9 @@ struct i915_drm_client {char __rcu *name;bool closed; +spinlock_t ctx_lock;/* For add/remove from ctx_list. */ +struct list_head ctx_list;/* List of contexts belonging to client. */ +struct i915_drm_clients *clients;struct kobject *root;
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/10 drm/i915: Track context current active time
In reply to Tvrtko UrsulinFrom: Tvrtko Ursulin <[email protected]>
Track context active (on hardware) status together with the start timestamp.
This will be used to provide better granularity of context runtime reporting in conjunction with already tracked pphwsp accumulated runtime.
The latter is only updated on context save so does not give us visibility to any currently executing work.
As part of the patch the existing runtime tracking data is moved under the new ce->stats member and updated under the seqlock. This provides the ability to atomically read out accumulated plus active runtime.
--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 3 +- drivers/gpu/drm/i915/gt/intel_context.c | 18 +++++- drivers/gpu/drm/i915/gt/intel_context.h | 6 +- drivers/gpu/drm/i915/gt/intel_context_types.h | 24 +++++--- drivers/gpu/drm/i915/gt/intel_lrc.c | 55 +++++++++++++++---- drivers/gpu/drm/i915/gt/selftest_lrc.c | 10 ++-- drivers/gpu/drm/i915/i915_drm_client.c | 2 +- drivers/gpu/drm/i915/i915_gpu_error.c | 4 +- 8 files changed, 90 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +2 -1
@@ -266,7 +266,8 @@ static void free_engines_rcu(struct rcu_head *rcu)unsigned int class = ce->engine->uabi_class;GEM_BUG_ON (class >=ARRAY_SIZE (ctx->past_runtime)); -atomic64_add (ce->runtime.total, &ctx->past_runtime[class]); +atomic64_add (ce->stats.runtime.total, + &ctx->past_runtime[class]); }i915_gem_context_put (ctx);
drivers/gpu/drm/i915/gt/intel_context.c +17 -1
@@ -288,7 +288,7 @@ intel_context_init(struct intel_context *ce, ce->sseu = engine->sseu; ce->ring =__intel_context_ring_size (SZ_4K ); -ewma_runtime_init (&ce->runtime.avg); +ewma_runtime_init (&ce->stats.runtime.avg); ce->vm =i915_vm_get (engine->gt->vm);
@@ -296,6 +296,7 @@ intel_context_init(struct intel_context *ce,INIT_LIST_HEAD (&ce->signals);mutex_init (&ce->pin_mutex); +seqlock_init (&ce->stats.lock);i915_active_init (&ce->active, __intel_context_active, __intel_context_retire);
@@ -390,6 +391,21 @@ struct i915_request *intel_context_create_request(struct intel_context *ce)return rq; } +ktime_t intel_context_get_active_time (struct intel_context *ce) +{ +struct intel_context_stats *stats = &ce->stats; +unsigned int seq; +ktime_t total =0 ; + +do { + seq =read_seqbegin (&stats->lock); +if (stats->active) + total =ktime_sub (ktime_get (), stats->start); + }while (read_seqretry (&stats->lock, seq)); + +return total; +} +#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST )#include "selftest_context.c" #endif
drivers/gpu/drm/i915/gt/intel_context.h +4 -2
@@ -233,7 +233,7 @@ static inline u64 intel_context_get_total_runtime_ns(struct intel_context *ce)const u32 period =RUNTIME_INFO (ce->engine->i915)->cs_timestamp_period_ns; -return READ_ONCE (ce->runtime.total) * period; +return READ_ONCE (ce->stats.runtime.total) * period; }static inline u64 intel_context_get_avg_runtime_ns (struct intel_context *ce)
@@ -241,7 +241,9 @@ static inline u64 intel_context_get_avg_runtime_ns(struct intel_context *ce)const u32 period =RUNTIME_INFO (ce->engine->i915)->cs_timestamp_period_ns; - return mul_u32_u32(ewma_runtime_read(&ce->runtime.avg), period); + return mul_u32_u32(ewma_runtime_read(&ce->stats.runtime.avg), period); } +ktime_t intel_context_get_active_time (struct intel_context *ce); +#endif /* __INTEL_CONTEXT_H__ */
drivers/gpu/drm/i915/gt/intel_context_types.h +16 -8
@@ -12,6 +12,7 @@#include <linux/list.h> #include <linux/mutex.h> #include <linux/types.h> +#include <linux/seqlock.h> #include "i915_active_types.h" #include "i915_utils.h"
@@ -72,14 +73,21 @@ struct intel_context {u64 lrc_desc;u32 tag;/* cookie passed to HW to track this context on submission */ -/* Time on GPU as tracked by the hw. */ -struct { -struct ewma_runtime avg; -u64 total; -u32 last; - I915_SELFTEST_DECLARE(u32 num_underflow); - I915_SELFTEST_DECLARE(u32 max_underflow); - } runtime; +/** stats: Context GPU engine busyness tracking. */ +struct intel_context_stats { +seqlock_t lock; +bool active; +ktime_t start; + +/* Time on GPU as tracked by the hw. */ +struct { +struct ewma_runtime avg; +u64 total; +u32 last; + I915_SELFTEST_DECLARE(u32 num_underflow); + I915_SELFTEST_DECLARE(u32 max_underflow); + } runtime; + } stats;unsigned int active_count;/* protected by timeline->mutex */
drivers/gpu/drm/i915/gt/intel_lrc.c +43 -12
99 lines not on this page · raw message
drivers/gpu/drm/i915/gt/selftest_lrc.c +5 -5
@@ -5479,8 +5479,8 @@ static int __live_pphwsp_runtime(struct intel_engine_cs *engine)if (IS_ERR (ce))return PTR_ERR (ce); - ce->runtime.num_underflow =0 ; - ce->runtime.max_underflow =0 ; + ce->stats.runtime.num_underflow =0 ; + ce->stats.runtime.max_underflow =0 ; do { unsigned int loop = 1024;
@@ -5518,11 +5518,11 @@ static int __live_pphwsp_runtime(struct intel_engine_cs *engine) intel_context_get_avg_runtime_ns(ce)); err =0 ; -if (ce->runtime.num_underflow) { +if (ce->stats.runtime.num_underflow) {pr_err ("%s: pphwsp underflow %u time(s), max %u cycles!\n" , engine->name, - ce->runtime.num_underflow, - ce->runtime.max_underflow); + ce->stats.runtime.num_underflow, + ce->stats.runtime.max_underflow);GEM_TRACE_DUMP (); err = -EOVERFLOW ; }
drivers/gpu/drm/i915/i915_drm_client.c +1 -1
@@ -67,7 +67,7 @@ pphwsp_busy_add(struct i915_gem_context *ctx, unsigned int class)for_each_gem_engine (ce, engines, it) {if (ce->engine->uabi_class == class) - total += ce->runtime.total; + total += ce->stats.runtime.total; }return total;
drivers/gpu/drm/i915/i915_gpu_error.c +2 -2
@@ -1267,8 +1267,8 @@ static bool record_context(struct i915_gem_context_coredump *e, e->guilty =atomic_read (&ctx->guilty_count); e->active =atomic_read (&ctx->active_count); - e->total_runtime = rq->context->runtime.total; - e->avg_runtime =ewma_runtime_read (&rq->context->runtime.avg); + e->total_runtime = rq->context->stats.runtime.total; + e->avg_runtime =ewma_runtime_read (&rq->context->stats.runtime.avg); simulated =i915_gem_context_no_error_capture (ctx);
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 03/10] drm/i915: Make GEM contexts track DRM clients
In reply to Tvrtko UrsulinQuoting Tvrtko Ursulin (2020-03-18 12:11:32)
Quoted 10 lines
From: Tvrtko Ursulin <[email protected]>
If we make GEM contexts keep a reference to
i915_drm_clientfor the whole of their lifetime, we can consolidate the current task pid and name usage by getting it from the client.v2:
* Don't bother supporting selftests contexts from debugfs. (Chris)Signed-off-by Tvrtko Ursulin <[email protected]>
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 04/10] drm/i915: Use explicit flag to mark unreachable intel_context
In reply to Tvrtko UrsulinQuoting Tvrtko Ursulin (2020-03-18 12:11:33)
Quoted 47 lines
From: Tvrtko Ursulin <[email protected]>
I need to keep the GEM context around a bit longer so adding an explicit flag for syncing execbuf with closed/abandonded contexts.
v2:
* Use already available context flags. (Chris)Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 3 ++- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- drivers/gpu/drm/i915/gt/intel_context_types.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +2
-1@@ -579,7 +579,8 @@ static void engines_idle_release(struct i915_gem_context *ctx,int err =0 ;/* serialises with execbuf */ -RCU_INIT_POINTER (ce->gem_context,NULL ); +set_bit (INTEL_CONTEXT_CLOSED , &ce->flags); +if (!intel_context_pin_if_active (ce))continue ;drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +1
-1@@ -2316,7 +2316,7 @@ static void eb_request_add(struct i915_execbuffer *eb) prev =__i915_request_commit (rq);/* Check that the context wasn't destroyed before submission */ -if (likely (rcu_access_pointer (eb->context->gem_context))) { +if (likely (!test_bit (INTEL_CONTEXT_CLOSED , &eb->context->flags))) { attr = eb->gem_context->sched;/* drivers/gpu/drm/i915/gt/intel_context_types.h +0
-0
drivers/gpu/drm/i915/gt/intel_context_types.h struct intel_context { · line 69
Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_context_types.h +1
-0@@ -66,6 +66,7 @@ struct intel_context {#define CONTEXT_BANNED 4#define CONTEXT_FORCE_SINGLE_SUBMISSION 5#define CONTEXT_NOPREEMPT 6 +#define INTEL_CONTEXT_CLOSED 7
Trying to start a flame war? :)
With this flag, we can start banning contexts after a GPU hang on a closed context _again_. That might justify applying immediately. -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 04/10] drm/i915: Use explicit flag to mark unreachable intel_context
Quoted 42 lines · Chris Wilson
Quoting Tvrtko Ursulin (2020-03-18 12:11:33)
Quoted 41 lines
From: Tvrtko Ursulin <[email protected]>
I need to keep the GEM context around a bit longer so adding an explicit flag for syncing execbuf with closed/abandonded contexts.
v2:
* Use already available context flags. (Chris)Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 3 ++- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 2 +- drivers/gpu/drm/i915/gt/intel_context_types.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +2
-1@@ -579,7 +579,8 @@ static void engines_idle_release(struct i915_gem_context *ctx,int err =0 ;/* serialises with execbuf */ -RCU_INIT_POINTER (ce->gem_context,NULL ); +set_bit (INTEL_CONTEXT_CLOSED , &ce->flags); +if (!intel_context_pin_if_active (ce))continue ;drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +1
-1@@ -2316,7 +2316,7 @@ static void eb_request_add(struct i915_execbuffer *eb) prev =__i915_request_commit (rq);/* Check that the context wasn't destroyed before submission */ -if (likely (rcu_access_pointer (eb->context->gem_context))) { +if (likely (!test_bit (INTEL_CONTEXT_CLOSED , &eb->context->flags))) { attr = eb->gem_context->sched;
Quoted 12 lines
drivers/gpu/drm/i915/gt/intel_context_types.h struct intel_context { · line 69
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c +0
-0/* drivers/gpu/drm/i915/gt/intel_context_types.h +1
-0@@ -66,6 +66,7 @@ struct intel_context {#define CONTEXT_BANNED 4#define CONTEXT_FORCE_SINGLE_SUBMISSION 5#define CONTEXT_NOPREEMPT 6 +#define INTEL_CONTEXT_CLOSED 7Trying to start a flame war? :)
No, but CONTEXT_ namespace is overloaded between here and GEM context. I propose we prefix one of them all with something.
Quoted 4 lines
Reviewed-by Chris Wilson <[email protected]>With this flag, we can start banning contexts after a GPU hang on a closed context _again_. That might justify applying immediately.
Hm okay.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 05/10] drm/i915: Track runtime spent in unreachable intel_contexts
In reply to Tvrtko UrsulinQuoting Tvrtko Ursulin (2020-03-18 12:11:34)
Quoted 19 lines
From: Tvrtko Ursulin <[email protected]>
As contexts are abandoned we want to remember how much GPU time they used (per class) so later we can used it for smarter purposes.
Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 13 ++++++++++++- drivers/gpu/drm/i915/gem/i915_gem_context_types.h | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-0@@ -257,7 +257,19 @@ static void free_engines_rcu(struct rcu_head *rcu) {struct i915_gem_engines *engines = container_of(rcu, struct i915_gem_engines, rcu);
drivers/gpu/drm/i915/gem/i915_gem_context.c static void free_engines_rcu(struct rcu_head *rcu) · line 269
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c +9
-0+struct i915_gem_context *ctx = engines->ctx; +struct i915_gem_engines_iter it; +struct intel_context *ce; + +/* Transfer accumulated runtime to the parent GEM context. */ +for_each_gem_engine (ce, engines, it) { +unsigned int class = ce->engine->uabi_class; +GEM_BUG_ON (class >=ARRAY_SIZE (ctx->past_runtime)); +atomic64_add (ce->runtime.total, &ctx->past_runtime[class]);
Hmm, there's an odd situation where the free_engines_rcu could fire before we do the final schedule_out of the context.
GEM_BUG_ON(intel_context_inflight(ce)) to see if that's being too paranoid.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 06/10] drm/i915: Track runtime spent in closed GEM contexts
In reply to Tvrtko UrsulinQuoting Tvrtko Ursulin (2020-03-18 12:11:35)
Quoted 23 lines
From: Tvrtko Ursulin <[email protected]>
As GEM contexts are closed we want to have the DRM client remember how much GPU time they used (per class) so later we can used it for smarter purposes.
Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 12 +++++++++++- drivers/gpu/drm/i915/i915_drm_client.h | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +2
-1@@ -355,8 +355,18 @@ static void i915_gem_context_free(struct i915_gem_context *ctx)GEM_BUG_ON (!i915_gem_context_is_closed (ctx)); -if (client) +if (client) { +unsigned int i;
drivers/gpu/drm/i915/gem/i915_gem_context.c static void i915_gem_context_free(struct i915_gem_context *ctx) · line 369
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c +9
-0+ +/* Transfer accumulated runtime to the parent drm client. */ +BUILD_BUG_ON (ARRAY_SIZE (client->past_runtime) != +ARRAY_SIZE (ctx->past_runtime)); +for (i =0 ; i <ARRAY_SIZE (client->past_runtime); i++) +atomic64_add (atomic64_read (&ctx->past_runtime[i]), + &client->past_runtime[i]); +i915_drm_client_put (client); + }
Ok, order looks good.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 08/10] drm/i915: Expose per-engine client busyness
In reply to Tvrtko UrsulinQuoting Tvrtko Ursulin (2020-03-18 12:11:37)
Quoted 21 lines
drivers/gpu/drm/i915/i915_drm_client.c +21
-0+static u64 +pphwsp_busy_add (struct i915_gem_context *ctx,unsigned int class) +{ +struct i915_gem_engines *engines =rcu_dereference (ctx->engines); +struct i915_gem_engines_iter it; +struct intel_context *ce; +u64 total =0 ; + +for_each_gem_engine (ce, engines, it) { +if (ce->engine->uabi_class == class) + total += ce->runtime.total; + } + +return total; +} + +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);
drivers/gpu/drm/i915/i915_drm_client.c show_client_pid(struct device *kdev, struct device_attribute *attr, char *buf) · line 90
Quoted 10 lines
drivers/gpu/drm/i915/i915_drm_client.c +10
-0+unsigned int class = i915_attr->engine_class; +struct i915_drm_client *client = i915_attr->client; +u64 total =atomic64_read (&client->past_runtime[class]); +struct list_head *list = &client->ctx_list; +struct i915_gem_context *ctx; + +rcu_read_lock (); +list_for_each_entry_rcu (ctx, list, client_link) { + total +=atomic64_read (&ctx->past_runtime[class]); + total +=pphwsp_busy_add (ctx, class);
Hmm. I would like to have some GEM context agnosticism here. At the moment, all I have to offer is
struct client_runtime {
struct list_head client_link;
atomic64_t past_runtime;
u64 (*cur_runtime)(struct client_runtime *);
};-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 05/10] drm/i915: Track runtime spent in unreachable intel_contexts
In reply to Chris WilsonQuoted 28 lines · Chris Wilson
Quoting Tvrtko Ursulin (2020-03-18 12:11:34)
Quoted 27 lines
From: Tvrtko Ursulin <[email protected]>
As contexts are abandoned we want to remember how much GPU time they used (per class) so later we can used it for smarter purposes.
Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 13 ++++++++++++- drivers/gpu/drm/i915/gem/i915_gem_context_types.h | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +7
-0@@ -257,7 +257,19 @@ static void free_engines_rcu(struct rcu_head *rcu) {struct i915_gem_engines *engines = container_of(rcu, struct i915_gem_engines, rcu); +struct i915_gem_context *ctx = engines->ctx; +struct i915_gem_engines_iter it; +struct intel_context *ce; + +/* Transfer accumulated runtime to the parent GEM context. */ +for_each_gem_engine (ce, engines, it) { +unsigned int class = ce->engine->uabi_class;
Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c static void free_engines_rcu(struct rcu_head *rcu) · line 269
Quoted 2 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c +2
-0+GEM_BUG_ON (class >=ARRAY_SIZE (ctx->past_runtime)); +atomic64_add (ce->runtime.total, &ctx->past_runtime[class]);Hmm, there's an odd situation where the
free_engines_rcucould fire before we do the finalschedule_outof the context.GEM_BUG_ON(intel_context_inflight(ce)) to see if that's being too paranoid.
Deja vu.. have I forgotten to move this into intel_context_free while the purpose of keeping ce->gem_context valid was exactly to enable that.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 08/10] drm/i915: Expose per-engine client busyness
In reply to Chris WilsonQuoted 36 lines · Chris Wilson
Quoting Tvrtko Ursulin (2020-03-18 12:11:37)
Quoted 21 lines
drivers/gpu/drm/i915/i915_drm_client.c +21
-0+static u64 +pphwsp_busy_add (struct i915_gem_context *ctx,unsigned int class) +{ +struct i915_gem_engines *engines =rcu_dereference (ctx->engines); +struct i915_gem_engines_iter it; +struct intel_context *ce; +u64 total =0 ; + +for_each_gem_engine (ce, engines, it) { +if (ce->engine->uabi_class == class) + total += ce->runtime.total; + } + +return total; +} + +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);drivers/gpu/drm/i915/i915_drm_client.c show_client_pid(struct device *kdev, struct device_attribute *attr, char *buf) · line 90
Quoted 10 lines
drivers/gpu/drm/i915/i915_drm_client.c +10
-0+unsigned int class = i915_attr->engine_class; +struct i915_drm_client *client = i915_attr->client; +u64 total =atomic64_read (&client->past_runtime[class]); +struct list_head *list = &client->ctx_list; +struct i915_gem_context *ctx; + +rcu_read_lock (); +list_for_each_entry_rcu (ctx, list, client_link) { + total +=atomic64_read (&ctx->past_runtime[class]); + total +=pphwsp_busy_add (ctx, class);Hmm. I would like to have some GEM context agnosticism here. At the moment, all I have to offer is
Quoted 5 lines
struct client_runtime {
struct list_head client_link;
atomic64_t past_runtime;
u64 (*cur_runtime)(struct client_runtime *);
};What exactly do you mean here? Who keeps a list and of what and what does the vfunc do?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 05/10] drm/i915: Track runtime spent in unreachable intel_contexts
In reply to Tvrtko UrsulinQuoting Tvrtko Ursulin (2020-03-18 14:13:14)
Quoted 36 lines · Chris Wilson
Quoted 34 lines
Quoting Tvrtko Ursulin (2020-03-18 12:11:34)
Quoted 19 lines
From: Tvrtko Ursulin <[email protected]>
As contexts are abandoned we want to remember how much GPU time they used (per class) so later we can used it for smarter purposes.
Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 13 ++++++++++++- drivers/gpu/drm/i915/gem/i915_gem_context_types.h | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-0@@ -257,7 +257,19 @@ static void free_engines_rcu(struct rcu_head *rcu) {struct i915_gem_engines *engines = container_of(rcu, struct i915_gem_engines, rcu);drivers/gpu/drm/i915/gem/i915_gem_context.c static void free_engines_rcu(struct rcu_head *rcu) · line 269
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c +9
-0+struct i915_gem_context *ctx = engines->ctx; +struct i915_gem_engines_iter it; +struct intel_context *ce; + +/* Transfer accumulated runtime to the parent GEM context. */ +for_each_gem_engine (ce, engines, it) { +unsigned int class = ce->engine->uabi_class; +GEM_BUG_ON (class >=ARRAY_SIZE (ctx->past_runtime)); +atomic64_add (ce->runtime.total, &ctx->past_runtime[class]);Hmm, there's an odd situation where the
free_engines_rcucould fire before we do the finalschedule_outof the context.
Quoted 5 lines
Quoted 2 lines
GEM_BUG_ON(intel_context_inflight(ce)) to see if that's being too paranoid.
Deja vu.. have I forgotten to move this into
intel_context_freewhile the purpose of keepingce->gem_contextvalid was exactly to enable that.
I would rather not have it in gt/ if possible. The delay should be nominal at worst.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 08/10] drm/i915: Expose per-engine client busyness
In reply to Tvrtko UrsulinQuoting Tvrtko Ursulin (2020-03-18 14:15:31)
Quoted 38 lines · Chris Wilson
Quoted 36 lines
Quoting Tvrtko Ursulin (2020-03-18 12:11:37)
Quoted 21 lines
drivers/gpu/drm/i915/i915_drm_client.c +21
-0+static u64 +pphwsp_busy_add (struct i915_gem_context *ctx,unsigned int class) +{ +struct i915_gem_engines *engines =rcu_dereference (ctx->engines); +struct i915_gem_engines_iter it; +struct intel_context *ce; +u64 total =0 ; + +for_each_gem_engine (ce, engines, it) { +if (ce->engine->uabi_class == class) + total += ce->runtime.total; + } + +return total; +} + +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);drivers/gpu/drm/i915/i915_drm_client.c show_client_pid(struct device *kdev, struct device_attribute *attr, char *buf) · line 90
Quoted 10 lines
drivers/gpu/drm/i915/i915_drm_client.c +10
-0+unsigned int class = i915_attr->engine_class; +struct i915_drm_client *client = i915_attr->client; +u64 total =atomic64_read (&client->past_runtime[class]); +struct list_head *list = &client->ctx_list; +struct i915_gem_context *ctx; + +rcu_read_lock (); +list_for_each_entry_rcu (ctx, list, client_link) { + total +=atomic64_read (&ctx->past_runtime[class]); + total +=pphwsp_busy_add (ctx, class);Hmm. I would like to have some GEM context agnosticism here. At the moment, all I have to offer is
Quoted 8 lines
Quoted 5 lines
struct client_runtime { struct list_head client_link; atomic64_t past_runtime; u64 (*cur_runtime)(struct client_runtime *); };What exactly do you mean here? Who keeps a list and of what and what does the vfunc do?
This is what you've added to GEM context. Here in i915/i915_drm_client.c we shouldn't have to know about i915/gem/i915_gem_context internals. So the GEM context registers its client_runtime (by coupling that into the list).
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 05/10] drm/i915: Track runtime spent in unreachable intel_contexts
In reply to Chris WilsonQuoted 37 lines · Chris Wilson
Quoting Tvrtko Ursulin (2020-03-18 14:13:14)
Quoted 36 lines · Chris Wilson
Quoted 34 lines
Quoting Tvrtko Ursulin (2020-03-18 12:11:34)
Quoted 19 lines
From: Tvrtko Ursulin <[email protected]>
As contexts are abandoned we want to remember how much GPU time they used (per class) so later we can used it for smarter purposes.
Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 13 ++++++++++++- drivers/gpu/drm/i915/gem/i915_gem_context_types.h | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +0
-0@@ -257,7 +257,19 @@ static void free_engines_rcu(struct rcu_head *rcu) {struct i915_gem_engines *engines = container_of(rcu, struct i915_gem_engines, rcu);drivers/gpu/drm/i915/gem/i915_gem_context.c static void free_engines_rcu(struct rcu_head *rcu) · line 269
Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c +9
-0+struct i915_gem_context *ctx = engines->ctx; +struct i915_gem_engines_iter it; +struct intel_context *ce; + +/* Transfer accumulated runtime to the parent GEM context. */ +for_each_gem_engine (ce, engines, it) { +unsigned int class = ce->engine->uabi_class; +GEM_BUG_ON (class >=ARRAY_SIZE (ctx->past_runtime)); +atomic64_add (ce->runtime.total, &ctx->past_runtime[class]);Hmm, there's an odd situation where the
free_engines_rcucould fire before we do the finalschedule_outof the context.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
GEM_BUG_ON(intel_context_inflight(ce)) to see if that's being too paranoid.
Deja vu.. have I forgotten to move this into
intel_context_freewhile the purpose of keepingce->gem_contextvalid was exactly to enable that.I would rather not have it in gt/ if possible. The delay should be nominal at worst.
But I thought your concern was this can miss the accumulation of the last active period due active tracker triggering the rcu cleanup before last context save. What do you then recommend?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 05/10] drm/i915: Track runtime spent in unreachable intel_contexts
Quoting Tvrtko Ursulin (2020-03-18 14:38:53)
Quoted 45 lines · Chris Wilson
Quoted 43 lines
Quoting Tvrtko Ursulin (2020-03-18 14:13:14)
Quoted 41 lines · Chris Wilson
Quoted 28 lines
Quoting Tvrtko Ursulin (2020-03-18 12:11:34)
Quoted 27 lines
From: Tvrtko Ursulin <[email protected]>
As contexts are abandoned we want to remember how much GPU time they used (per class) so later we can used it for smarter purposes.
Signed-off-by Tvrtko Ursulin <[email protected]>--- drivers/gpu/drm/i915/gem/i915_gem_context.c | 13 ++++++++++++- drivers/gpu/drm/i915/gem/i915_gem_context_types.h | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/gem/i915_gem_context.c +7
-0@@ -257,7 +257,19 @@ static void free_engines_rcu(struct rcu_head *rcu) {struct i915_gem_engines *engines = container_of(rcu, struct i915_gem_engines, rcu); +struct i915_gem_context *ctx = engines->ctx; +struct i915_gem_engines_iter it; +struct intel_context *ce; + +/* Transfer accumulated runtime to the parent GEM context. */ +for_each_gem_engine (ce, engines, it) { +unsigned int class = ce->engine->uabi_class;Quoted 8 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c static void free_engines_rcu(struct rcu_head *rcu) · line 269
Quoted 2 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c +2
-0+GEM_BUG_ON (class >=ARRAY_SIZE (ctx->past_runtime)); +atomic64_add (ce->runtime.total, &ctx->past_runtime[class]);Hmm, there's an odd situation where the
free_engines_rcucould fire before we do the finalschedule_outof the context.GEM_BUG_ON(intel_context_inflight(ce)) to see if that's being too paranoid.
Deja vu.. have I forgotten to move this into
intel_context_freewhile the purpose of keepingce->gem_contextvalid was exactly to enable that.
Quoted 6 lines
Quoted 2 lines
I would rather not have it in gt/ if possible. The delay should be nominal at worst.
But I thought your concern was this can miss the accumulation of the last active period due active tracker triggering the rcu cleanup before last context save. What do you then recommend?
That is the concern, but it's not a huge concern for me :)
I was tempted just to put a busywait here, rather than couple up a notification scheme. Although...
We do have a notification here for the context_retire we could listen to instead of listening to the request idling. If we use
i915_sw_fence_await_active(&engines->fence, &ce->active, I915_ACTIVE_AWAIT_ALL);
instead, then the fence will not fire until the final barrier has executed.
Tada!
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 05/10] drm/i915: Track runtime spent in unreachable intel_contexts
Quoting Chris Wilson (2020-03-18 14:48:05)
Quoted 11 lines
We do have a notification here for the
context_retirewe could listen to instead of listening to the request idling. If we usei915_sw_fence_await_active(&engines->fence, &ce->active, I915_ACTIVE_AWAIT_ALL);instead, then the fence will not fire until the final barrier has executed.
Tada!
It's close. It's still strictly firing on the pulse request signaling, which is currently not guaranteed to be after after the context_out. Although we can arrange that with a sentinel.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 08/10] drm/i915: Expose per-engine client busyness
In reply to Chris WilsonQuoted 45 lines · Chris Wilson
Quoting Tvrtko Ursulin (2020-03-18 14:15:31)
Quoted 44 lines · Chris Wilson
Quoted 41 lines
Quoting Tvrtko Ursulin (2020-03-18 12:11:37)
Quoted 21 lines
drivers/gpu/drm/i915/i915_drm_client.c +21
-0+static u64 +pphwsp_busy_add (struct i915_gem_context *ctx,unsigned int class) +{ +struct i915_gem_engines *engines =rcu_dereference (ctx->engines); +struct i915_gem_engines_iter it; +struct intel_context *ce; +u64 total =0 ; + +for_each_gem_engine (ce, engines, it) { +if (ce->engine->uabi_class == class) + total += ce->runtime.total; + } + +return total; +} + +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);drivers/gpu/drm/i915/i915_drm_client.c show_client_pid(struct device *kdev, struct device_attribute *attr, char *buf) · line 90
Quoted 10 lines
drivers/gpu/drm/i915/i915_drm_client.c +10
-0+unsigned int class = i915_attr->engine_class; +struct i915_drm_client *client = i915_attr->client; +u64 total =atomic64_read (&client->past_runtime[class]); +struct list_head *list = &client->ctx_list; +struct i915_gem_context *ctx; + +rcu_read_lock (); +list_for_each_entry_rcu (ctx, list, client_link) { + total +=atomic64_read (&ctx->past_runtime[class]); + total +=pphwsp_busy_add (ctx, class);Hmm. I would like to have some GEM context agnosticism here. At the moment, all I have to offer is
struct client_runtime { struct list_head client_link; atomic64_t past_runtime; u64 (*cur_runtime)(struct client_runtime *); };
Quoted 7 lines
Quoted 2 lines
What exactly do you mean here? Who keeps a list and of what and what does the vfunc do?
This is what you've added to GEM context. Here in
i915/i915_drm_client.cwe shouldn't have to know about i915/gem/i915_gem_context internals. So the GEM context registers itsclient_runtime(by coupling that into the list).
I've ignored this for now as it was feeling a bit too much for too little benefit and just decided to send out another simple rebase, given that there seems to be some urgency around this work now.
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx