Skip to contentSkip to conversation

Per client engine busyness

RFC In review Tvrtko Ursulin 3 participants 25 messages Dec 19, 2019 – Dec 20, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Per client engine busyness

From: Tvrtko Ursulin <[email protected]>

Another re-spin of the per-client engine busyness series. Highlights from this version:

* Now tracks GPU time for clients who exit with GPU work left running.
* No more global toggle - it is now constantly on.

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
	└── enable_stats

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.

I will post the corresponding patch to intel_gpu_top for reference as well.

Tvrtko Ursulin (8):
drm/i915: Switch context id allocation directoy to xarray drm/i915: Reference count struct drm_i915_file_private drm/i915: Expose list of clients in sysfs drm/i915: Update client name on context create drm/i915: Track per-context engine busyness drm/i915: Track all user contexts per client drm/i915: Contexts can use struct pid stored in the client drm/i915: Expose per-engine client busyness

 drivers/gpu/drm/i915/gem/i915_gem_context.c   | 113 ++++++---
 .../gpu/drm/i915/gem/i915_gem_context_types.h |  16 +-
 .../gpu/drm/i915/gem/selftests/mock_context.c |   3 +-
 drivers/gpu/drm/i915/gt/intel_context.c       |  20 ++
 drivers/gpu/drm/i915/gt/intel_context.h       |  11 +
 drivers/gpu/drm/i915/gt/intel_context_types.h |   9 +
 drivers/gpu/drm/i915/gt/intel_engine_cs.c     |  16 +-
 drivers/gpu/drm/i915/gt/intel_lrc.c           |  52 +++-
 drivers/gpu/drm/i915/i915_debugfs.c           |   7 +-
 drivers/gpu/drm/i915/i915_drv.c               |   4 -
 drivers/gpu/drm/i915/i915_drv.h               |  66 ++++-
 drivers/gpu/drm/i915/i915_gem.c               | 236 +++++++++++++++++-
 drivers/gpu/drm/i915/i915_gpu_error.c         |   6 +-
 drivers/gpu/drm/i915/i915_sysfs.c             |   8 +
 14 files changed, 486 insertions(+), 81 deletions(-)
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

RFC 1/8 drm/i915: Switch context id allocation directoy to xarray

From: Tvrtko Ursulin <[email protected]>

Idr internally uses xarray so we can use it directly which simplifies our code by removing the need to do external locking.

---
 drivers/gpu/drm/i915/gem/i915_gem_context.c   | 51 ++++++++-----------
 .../gpu/drm/i915/gem/selftests/mock_context.c |  3 +-
 drivers/gpu/drm/i915/i915_drv.h               |  6 +--
 3 files changed, 25 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +20 -31
index 6618c0c6506c..e5a7c6f02a47 100644
@@ -780,12 +780,6 @@ void i915_gem_driver_release__contexts(struct drm_i915_private *i915)
 	flush_work(&i915->gem.contexts.free_work);
 }
 
-static int context_idr_cleanup(int id, void *p, void *data)
-{
-	context_close(p);
-	return 0;
-}
-
 static int vm_idr_cleanup(int id, void *p, void *data)
 {
 	i915_vm_put(p);
@@ -793,7 +787,8 @@ static int vm_idr_cleanup(int id, void *p, void *data)
 }
 
 static int gem_context_register(struct i915_gem_context *ctx,
-				struct drm_i915_file_private *fpriv)
+				struct drm_i915_file_private *fpriv,
+				u32 *id)
 {
 	struct i915_address_space *vm;
 	int ret;
@@ -811,14 +806,10 @@ static int gem_context_register(struct i915_gem_context *ctx,
 		 current->comm, pid_nr(ctx->pid));
 
 	/* And finally expose ourselves to userspace via the idr */
-	mutex_lock(&fpriv->context_idr_lock);
-	ret = idr_alloc(&fpriv->context_idr, ctx, 0, 0, GFP_KERNEL);
-	mutex_unlock(&fpriv->context_idr_lock);
-	if (ret >= 0)
-		goto out;
+	ret = xa_alloc(&fpriv->context_xa, id, ctx, xa_limit_32b, GFP_KERNEL);
+	if (ret)
+		put_pid(fetch_and_zero(&ctx->pid));
 
-	put_pid(fetch_and_zero(&ctx->pid));
-out:
 	return ret;
 }
 
@@ -828,11 +819,11 @@ int i915_gem_context_open(struct drm_i915_private *i915,
 	struct drm_i915_file_private *file_priv = file->driver_priv;
 	struct i915_gem_context *ctx;
 	int err;
+	u32 id;
 
-	mutex_init(&file_priv->context_idr_lock);
-	mutex_init(&file_priv->vm_idr_lock);
+	xa_init_flags(&file_priv->context_xa, XA_FLAGS_ALLOC);
 
-	idr_init(&file_priv->context_idr);
+	mutex_init(&file_priv->vm_idr_lock);
 	idr_init_base(&file_priv->vm_idr, 1);
 
 	ctx = i915_gem_create_context(i915, 0);
@@ -841,12 +832,12 @@ int i915_gem_context_open(struct drm_i915_private *i915,
 		goto err;
 	}
 
-	err = gem_context_register(ctx, file_priv);
+	err = gem_context_register(ctx, file_priv, &id);
 	if (err < 0)
 		goto err_ctx;
 
+	GEM_BUG_ON(id);
 	GEM_BUG_ON(i915_gem_context_is_kernel(ctx));
-	GEM_BUG_ON(err > 0);
 
 	return 0;
 
@@ -854,9 +845,8 @@ int i915_gem_context_open(struct drm_i915_private *i915,
 	context_close(ctx);
 err:
 	idr_destroy(&file_priv->vm_idr);
-	idr_destroy(&file_priv->context_idr);
+	xa_destroy(&file_priv->context_xa);
 	mutex_destroy(&file_priv->vm_idr_lock);
-	mutex_destroy(&file_priv->context_idr_lock);
 	return err;
 }
 
@@ -864,10 +854,12 @@ void i915_gem_context_close(struct drm_file *file)
 {
 	struct drm_i915_file_private *file_priv = file->driver_priv;
 	struct drm_i915_private *i915 = file_priv->dev_priv;
+	struct i915_gem_context *ctx;
+	unsigned long idx;
 
-	idr_for_each(&file_priv->context_idr, context_idr_cleanup, NULL);
-	idr_destroy(&file_priv->context_idr);
-	mutex_destroy(&file_priv->context_idr_lock);
+	xa_for_each(&file_priv->context_xa, idx, ctx)
+		context_close(ctx);
+	xa_destroy(&file_priv->context_xa);
 
 	idr_for_each(&file_priv->vm_idr, vm_idr_cleanup, NULL);
 	idr_destroy(&file_priv->vm_idr);
@@ -2180,6 +2172,7 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
 	struct drm_i915_gem_context_create_ext *args = data;
 	struct create_ext ext_data;
 	int ret;
+	u32 id;
 
 	if (!DRIVER_CAPS(i915)->has_logical_contexts)
 		return -ENODEV;
@@ -2211,11 +2204,11 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
 			goto err_ctx;
 	}
 
-	ret = gem_context_register(ext_data.ctx, ext_data.fpriv);
+	ret = gem_context_register(ext_data.ctx, ext_data.fpriv, &id);
 	if (ret < 0)
 		goto err_ctx;
 
-	args->ctx_id = ret;
+	args->ctx_id = id;
 	DRM_DEBUG("HW context %d created\n", args->ctx_id);
 
 	return 0;
@@ -2238,11 +2231,7 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
 	if (!args->ctx_id)
 		return -ENOENT;
 
-	if (mutex_lock_interruptible(&file_priv->context_idr_lock))
-		return -EINTR;
-
-	ctx = idr_remove(&file_priv->context_idr, args->ctx_id);
-	mutex_unlock(&file_priv->context_idr_lock);
+	ctx = xa_erase(&file_priv->context_xa, args->ctx_id);
 	if (!ctx)
 		return -ENOENT;
 
drivers/gpu/drm/i915/gem/selftests/mock_context.c +2 -1
index 53e89efb09c0..0bdc26fe9c76 100644
@@ -77,12 +77,13 @@ live_context(struct drm_i915_private *i915, struct file *file)
 {
 	struct i915_gem_context *ctx;
 	int err;
+	u32 id;
 
 	ctx = i915_gem_create_context(i915, 0);
 	if (IS_ERR(ctx))
 		return ctx;
 
-	err = gem_context_register(ctx, to_drm_file(file)->driver_priv);
+	err = gem_context_register(ctx, to_drm_file(file)->driver_priv, &id);
 	if (err < 0)
 		goto err_ctx;
 
drivers/gpu/drm/i915/i915_drv.h +3 -3
index 0781b6326b8c..9226c0515506 100644
@@ -46,6 +46,7 @@
 #include <linux/dma-resv.h>
 #include <linux/shmem_fs.h>
 #include <linux/stackdepot.h>
+#include <linux/xarray.h>
 
 #include <drm/intel-gtt.h>
 #include <drm/drm_legacy.h> /* for struct drm_dma_handle */
@@ -201,8 +202,7 @@ struct drm_i915_file_private {
 		struct list_head request_list;
 	} mm;
 
-	struct idr context_idr;
-	struct mutex context_idr_lock; /* guards context_idr */
+	struct xarray context_xa;
 
 	struct idr vm_idr;
 	struct mutex vm_idr_lock; /* guards vm_idr */
@@ -1892,7 +1892,7 @@ struct dma_buf *i915_gem_prime_export(struct drm_gem_object *gem_obj, int flags)
 static inline struct i915_gem_context *
 __i915_gem_context_lookup_rcu(struct drm_i915_file_private *file_priv, u32 id)
 {
-	return idr_find(&file_priv->context_idr, id);
+	return xa_load(&file_priv->context_xa, id);
 }
 
 static inline struct i915_gem_context *
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/8
#2 lore raw

Re: [Intel-gfx] [RFC 1/8] drm/i915: Switch context id allocation directoy to xarray

Quoting Tvrtko Ursulin (2019-12-19 18:00:12)

Quoted 59 lines

From: Tvrtko Ursulin <[email protected]>

Idr internally uses xarray so we can use it directly which simplifies our code by removing the need to do external locking.

---
 drivers/gpu/drm/i915/gem/i915_gem_context.c   | 51 ++++++++-----------
 .../gpu/drm/i915/gem/selftests/mock_context.c |  3 +-
 drivers/gpu/drm/i915/i915_drv.h               |  6 +--
 3 files changed, 25 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +5 -14
index 6618c0c6506c..e5a7c6f02a47 100644
@@ -780,12 +780,6 @@ void i915_gem_driver_release__contexts(struct drm_i915_private *i915)
        flush_work(&i915->gem.contexts.free_work);
 }
 
-static int context_idr_cleanup(int id, void *p, void *data)
-{
-       context_close(p);
-       return 0;
-}
-
 static int vm_idr_cleanup(int id, void *p, void *data)
 {
        i915_vm_put(p);
@@ -793,7 +787,8 @@ static int vm_idr_cleanup(int id, void *p, void *data)
 }
 
 static int gem_context_register(struct i915_gem_context *ctx,
-                               struct drm_i915_file_private *fpriv)
+                               struct drm_i915_file_private *fpriv,
+                               u32 *id)
 {
        struct i915_address_space *vm;
        int ret;
@@ -811,14 +806,10 @@ static int gem_context_register(struct i915_gem_context *ctx,
                 current->comm, pid_nr(ctx->pid));
 
        /* And finally expose ourselves to userspace via the idr */
-       mutex_lock(&fpriv->context_idr_lock);
-       ret = idr_alloc(&fpriv->context_idr, ctx, 0, 0, GFP_KERNEL);
-       mutex_unlock(&fpriv->context_idr_lock);
-       if (ret >= 0)
-               goto out;
+       ret = xa_alloc(&fpriv->context_xa, id, ctx, xa_limit_32b, GFP_KERNEL);
+       if (ret)
+               put_pid(fetch_and_zero(&ctx->pid));
 
-       put_pid(fetch_and_zero(&ctx->pid));
-out:
        return ret;
 }
 
@@ -828,11 +819,11 @@ int i915_gem_context_open(struct drm_i915_private *i915,
        struct drm_i915_file_private *file_priv = file->driver_priv;

drivers/gpu/drm/i915/gem/i915_gem_context.c int i915_gem_context_open(struct drm_i915_private *i915, · line 826

Quoted 10 lines
drivers/gpu/drm/i915/gem/i915_gem_context.c +3 -3
        struct i915_gem_context *ctx;
        int err;
+       u32 id;
 
-       mutex_init(&file_priv->context_idr_lock);
-       mutex_init(&file_priv->vm_idr_lock);
+       xa_init_flags(&file_priv->context_xa, XA_FLAGS_ALLOC);
 
-       idr_init(&file_priv->context_idr);
+       mutex_init(&file_priv->vm_idr_lock);

I had a double take here, thinking "why is he removing vm_idr..."

-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

RFC 2/8 drm/i915: Reference count struct drm_i915_file_private

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

In the following patches we will develope a need to peek into the client owned data from any potential leftover contexts.

To facilitate this add reference counting to file_priv.

---
 drivers/gpu/drm/i915/gem/i915_gem_context.c |  2 +-
 drivers/gpu/drm/i915/i915_drv.c             |  4 ----
 drivers/gpu/drm/i915/i915_drv.h             |  4 +++-
 drivers/gpu/drm/i915/i915_gem.c             | 14 +++++++++++++-
 4 files changed, 17 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +1 -1
index e5a7c6f02a47..b482b2e5f31f 100644
@@ -853,7 +853,7 @@ int i915_gem_context_open(struct drm_i915_private *i915,
 void i915_gem_context_close(struct drm_file *file)
 {
 	struct drm_i915_file_private *file_priv = file->driver_priv;
-	struct drm_i915_private *i915 = file_priv->dev_priv;
+	struct drm_i915_private *i915 = file_priv->i915;
 	struct i915_gem_context *ctx;
 	unsigned long idx;
 
drivers/gpu/drm/i915/i915_drv.c +0 -4
index 8b08cfe30151..0c9c93418068 100644
@@ -1633,13 +1633,9 @@ static void i915_driver_lastclose(struct drm_device *dev)
 
 static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
 {
-	struct drm_i915_file_private *file_priv = file->driver_priv;
-
 	i915_gem_context_close(file);
 	i915_gem_release(dev, file);
 
-	kfree_rcu(file_priv, rcu);
-
 	/* Catch up with all the deferred frees from "this" client */
 	i915_gem_flush_free_objects(to_i915(dev));
 }
drivers/gpu/drm/i915/i915_drv.h +3 -1
index 9226c0515506..6f13f0c619e9 100644
@@ -190,13 +190,15 @@ struct i915_mm_struct;
 struct i915_mmu_object;
 
 struct drm_i915_file_private {
-	struct drm_i915_private *dev_priv;
+	struct kref kref;
 
 	union {
 		struct drm_file *file;
 		struct rcu_head rcu;
 	};
 
+	struct drm_i915_private *i915;
+
 	struct {
 		spinlock_t lock;
 		struct list_head request_list;
drivers/gpu/drm/i915/i915_gem.c +13 -1
index f19c678ebefc..a52fdae95f58 100644
@@ -1518,6 +1518,14 @@ int i915_gem_freeze_late(struct drm_i915_private *i915)
 	return 0;
 }
 
+static void gem_release(struct kref *kref)
+{
+	struct drm_i915_file_private *fpriv =
+		container_of(kref, typeof(*fpriv), kref);
+
+	kfree_rcu(fpriv, rcu);
+}
+
 void i915_gem_release(struct drm_device *dev, struct drm_file *file)
 {
 	struct drm_i915_file_private *file_priv = file->driver_priv;
@@ -1531,6 +1539,8 @@ void i915_gem_release(struct drm_device *dev, struct drm_file *file)
 	list_for_each_entry(request, &file_priv->mm.request_list, client_link)
 		request->file_priv = NULL;
 	spin_unlock(&file_priv->mm.lock);
+
+	kref_put(&file_priv->kref, gem_release);
 }
 
 int i915_gem_open(struct drm_i915_private *i915, struct drm_file *file)
@@ -1544,8 +1554,10 @@ int i915_gem_open(struct drm_i915_private *i915, struct drm_file *file)
 	if (!file_priv)
 		return -ENOMEM;
 
+	kref_init(&file_priv->kref);
+
 	file->driver_priv = file_priv;
-	file_priv->dev_priv = i915;
+	file_priv->i915 = i915;
 	file_priv->file = file;
 
 	spin_lock_init(&file_priv->mm.lock);
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 2/8
#4 lore raw

Re: [Intel-gfx] [RFC 2/8] drm/i915: Reference count struct drm_i915_file_private

Quoting Tvrtko Ursulin (2019-12-19 18:00:13)

Quoted 33 lines

From: Tvrtko Ursulin <[email protected]>

In the following patches we will develope a need to peek into the client owned data from any potential leftover contexts.

To facilitate this add reference counting to file_priv.

---
 drivers/gpu/drm/i915/gem/i915_gem_context.c |  2 +-
 drivers/gpu/drm/i915/i915_drv.c             |  4 ----
 drivers/gpu/drm/i915/i915_drv.h             |  4 +++-
 drivers/gpu/drm/i915/i915_gem.c             | 14 +++++++++++++-
 4 files changed, 17 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +1 -1
index e5a7c6f02a47..b482b2e5f31f 100644
@@ -853,7 +853,7 @@ int i915_gem_context_open(struct drm_i915_private *i915,
 void i915_gem_context_close(struct drm_file *file)
 {
        struct drm_i915_file_private *file_priv = file->driver_priv;
-       struct drm_i915_private *i915 = file_priv->dev_priv;
+       struct drm_i915_private *i915 = file_priv->i915;
        struct i915_gem_context *ctx;
        unsigned long idx;
 
drivers/gpu/drm/i915/i915_drv.c +0 -0
index 8b08cfe30151..0c9c93418068 100644

drivers/gpu/drm/i915/i915_drv.c static void i915_driver_lastclose(struct drm_device *dev) · line 1641

Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.c +0 -3
@@ -1633,13 +1633,9 @@ static void i915_driver_lastclose(struct drm_device *dev)
 
 static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
 {
-       struct drm_i915_file_private *file_priv = file->driver_priv;
-
        i915_gem_context_close(file);
        i915_gem_release(dev, file);
 
-       kfree_rcu(file_priv, rcu);

As you are moving the kfree_rcu() into the i915_gem_release (via a put), I think it also makes sense to move the call for i915_gem_context_close on this file. Possibly renaming it to i915_gem_file_close() and s/drm_i915_file_private/i915_gem_file/ or i915_gem_client (with corresponding name changes) in the process.

For the basic mechanics of this patch though,

(Though I still suggest a bit of playing with i915_gem_context_close, i915_gem_release to tie them together to the notion of the file better.) -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: [Intel-gfx] [RFC 2/8] drm/i915: Reference count struct drm_i915_file_private

Quoted 50 lines · Chris Wilson

Quoting Tvrtko Ursulin (2019-12-19 18:00:13)

Quoted 33 lines

From: Tvrtko Ursulin <[email protected]>

In the following patches we will develope a need to peek into the client owned data from any potential leftover contexts.

To facilitate this add reference counting to file_priv.

---
  drivers/gpu/drm/i915/gem/i915_gem_context.c |  2 +-
  drivers/gpu/drm/i915/i915_drv.c             |  4 ----
  drivers/gpu/drm/i915/i915_drv.h             |  4 +++-
  drivers/gpu/drm/i915/i915_gem.c             | 14 +++++++++++++-
  4 files changed, 17 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +1 -1
index e5a7c6f02a47..b482b2e5f31f 100644
@@ -853,7 +853,7 @@ int i915_gem_context_open(struct drm_i915_private *i915,
  void i915_gem_context_close(struct drm_file *file)
  {
         struct drm_i915_file_private *file_priv = file->driver_priv;
-       struct drm_i915_private *i915 = file_priv->dev_priv;
+       struct drm_i915_private *i915 = file_priv->i915;
         struct i915_gem_context *ctx;
         unsigned long idx;
 
drivers/gpu/drm/i915/i915_drv.c +0 -0
index 8b08cfe30151..0c9c93418068 100644

drivers/gpu/drm/i915/i915_drv.c static void i915_driver_lastclose(struct drm_device *dev) · line 1641

Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.c +0 -3
@@ -1633,13 +1633,9 @@ static void i915_driver_lastclose(struct drm_device *dev)
 
  static void i915_driver_postclose(struct drm_device *dev, struct drm_file *file)
  {
-       struct drm_i915_file_private *file_priv = file->driver_priv;
-
         i915_gem_context_close(file);
         i915_gem_release(dev, file);
 
-       kfree_rcu(file_priv, rcu);

As you are moving the kfree_rcu() into the i915_gem_release (via a put), I think it also makes sense to move the call for i915_gem_context_close on this file. Possibly renaming it to i915_gem_file_close() and s/drm_i915_file_private/i915_gem_file/ or i915_gem_client (with corresponding name changes) in the process.

Quoted 5 lines

For the basic mechanics of this patch though,

(Though I still suggest a bit of playing with i915_gem_context_close, i915_gem_release to tie them together to the notion of the file better.)

Yes, agreed in principle.

But a) I prefer the release name to match with the fops mindset and b) I prefer to leave drm_i915_file_private alone as the top level driver private container.

What I am not completely happy with, or say undecided, is whether to move the kref into i915_drm_client. I had it like that at one point, thinking to only have a smallest needed structure pinned in memory, but then I simplified in favour of fewer allocations. Now I think I'd like to move the kref into i915_drm_client again. Any opinion here?

In a later patch, when I add the i915_gem_client_get/put helpers they are already named like that. Hm okay, I also have a naming confusion between struct i915_drm_client and i915_gem_client_get/put(). :)

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

RFC 3/8 drm/i915: Expose list of clients in sysfs

In reply to Tvrtko Ursulin

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.

---
 drivers/gpu/drm/i915/i915_drv.h   |  20 +++++
 drivers/gpu/drm/i915/i915_gem.c   | 133 ++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_sysfs.c |   8 ++
 3 files changed, 155 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +20 -0
index 6f13f0c619e9..e1d8361aafd7 100644
@@ -188,6 +188,7 @@ struct i915_hotplug {
 struct drm_i915_private;
 struct i915_mm_struct;
 struct i915_mmu_object;
+struct i915_drm_clients;
 
 struct drm_i915_file_private {
 	struct kref kref;
@@ -226,6 +227,19 @@ 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 {
+		unsigned int id;
+		struct pid *pid;
+		char *name;
+		bool closed;
+
+		struct kobject *root;
+		struct {
+			struct device_attribute pid;
+			struct device_attribute name;
+		} attr;
+	} client;
 };
 
 /* Interface history:
@@ -1280,6 +1294,12 @@ struct drm_i915_private {
 
 	struct i915_pmu pmu;
 
+	struct i915_drm_clients {
+		struct xarray xarray;
+
+		struct kobject *root;
+	} clients;
+
 	struct i915_hdcp_comp_master *hdcp_master;
 	bool hdcp_comp_added;
 
drivers/gpu/drm/i915/i915_gem.c +127 -6

188 lines not on this page · raw message

drivers/gpu/drm/i915/i915_sysfs.c +8 -0
index ad2b1b833d7b..3ab50e29fddf 100644
@@ -559,6 +559,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,
@@ -619,4 +624,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
#7 lore raw

Re: [Intel-gfx] [RFC 3/8] drm/i915: Expose list of clients in sysfs

Quoting Tvrtko Ursulin (2019-12-19 18:00:14)

Quoted 57 lines

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.

---
 drivers/gpu/drm/i915/i915_drv.h   |  20 +++++
 drivers/gpu/drm/i915/i915_gem.c   | 133 ++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/i915_sysfs.c |   8 ++
 3 files changed, 155 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 6f13f0c619e9..e1d8361aafd7 100644
@@ -188,6 +188,7 @@ struct i915_hotplug {
 struct drm_i915_private;
 struct i915_mm_struct;
 struct i915_mmu_object;
+struct i915_drm_clients;
 
 struct drm_i915_file_private {
        struct kref kref;

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_file_private { · line 231

Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -226,6 +227,19 @@ 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 {

I agree with the distinction here between drm_client and gem_client. (This concept will be required beyond GEM.)

Quoted 15 lines
drivers/gpu/drm/i915/i915_drv.h +11 -0
+               unsigned int id;
+               struct pid *pid;
+               char *name;
+               bool closed;
+
+               struct kobject *root;
+               struct {
+                       struct device_attribute pid;
+                       struct device_attribute name;
+               } attr;
+       } client;
 };
 
 /* Interface history:

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 1301

Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +5 -0
@@ -1280,6 +1294,12 @@ struct drm_i915_private {
 
        struct i915_pmu pmu;
 
+       struct i915_drm_clients {
+               struct xarray xarray;
+
+               struct kobject *root;
+       } clients;

You might as well pull this out into i915_drm_client.[ch] Actually make that into a please. :)
-Chris
_______________________________________________
Intel-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

Re: [Intel-gfx] [RFC 3/8] drm/i915: Expose list of clients in sysfs

Quoted 55 lines · Chris Wilson

Quoting Tvrtko Ursulin (2019-12-19 18:00:14)

Quoted 54 lines

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.

---
  drivers/gpu/drm/i915/i915_drv.h   |  20 +++++
  drivers/gpu/drm/i915/i915_gem.c   | 133 ++++++++++++++++++++++++++++--
  drivers/gpu/drm/i915/i915_sysfs.c |   8 ++
  3 files changed, 155 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 6f13f0c619e9..e1d8361aafd7 100644
@@ -188,6 +188,7 @@ struct i915_hotplug {
  struct drm_i915_private;
  struct i915_mm_struct;
  struct i915_mmu_object;
+struct i915_drm_clients;
 
Quoted 11 lines

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_file_private { · line 231

Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +2 -0
  struct drm_i915_file_private {
         struct kref kref;
@@ -226,6 +227,19 @@ 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 {

I agree with the distinction here between drm_client and gem_client. (This concept will be required beyond GEM.)

So you think I should keep the i915_drm_client naming for these bits throughout?

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/i915/i915_drv.h +11 -0
+               unsigned int id;
+               struct pid *pid;
+               char *name;
+               bool closed;
+
+               struct kobject *root;
+               struct {
+                       struct device_attribute pid;
+                       struct device_attribute name;
+               } attr;
+       } client;
  };
 
  /* Interface history:
@@ -1280,6 +1294,12 @@ struct drm_i915_private {
 
         struct i915_pmu pmu;
 
Quoted 8 lines

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 1301

Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.h +5 -0
+       struct i915_drm_clients {
+               struct xarray xarray;
+
+               struct kobject *root;
+       } clients;

You might as well pull this out into i915_drm_client.[ch] Actually make that into a please. :)

Np. Maybe next year though. :)

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [Intel-gfx] [RFC 3/8] drm/i915: Expose list of clients in sysfs

Quoting Tvrtko Ursulin (2019-12-20 07:56:25)

Quoted 69 lines · Chris Wilson
Quoted 55 lines

Quoting Tvrtko Ursulin (2019-12-19 18:00:14)

Quoted 54 lines

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.

---
  drivers/gpu/drm/i915/i915_drv.h   |  20 +++++
  drivers/gpu/drm/i915/i915_gem.c   | 133 ++++++++++++++++++++++++++++--
  drivers/gpu/drm/i915/i915_sysfs.c |   8 ++
  3 files changed, 155 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 6f13f0c619e9..e1d8361aafd7 100644
@@ -188,6 +188,7 @@ struct i915_hotplug {
  struct drm_i915_private;
  struct i915_mm_struct;
  struct i915_mmu_object;
+struct i915_drm_clients;
 
Quoted 11 lines

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_file_private { · line 231

Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +2 -0
  struct drm_i915_file_private {
         struct kref kref;
@@ -226,6 +227,19 @@ 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 {

I agree with the distinction here between drm_client and gem_client. (This concept will be required beyond GEM.)

Quoted 2 lines

So you think I should keep the i915_drm_client naming for these bits throughout?

Yes -- with a bit of handwaving for an abstract interface to iterate over the contexts. I do like the concept of having a sysfs/client interface that GEM context plugs into, that is not exclusive to GEM contexts. i.e. the focus should be on the information we need to present via sysfs, and get those concepts embedded into the sysfs ABI.

So I liked the direction of having a standalone i915_drm_client for the sysfs interface. [Who knows the end of GEM may be nigh!] -Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#10 lore raw

RFC 4/8 drm/i915: Update client name on context create

In reply to Tvrtko Ursulin

From: 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.

v2:
* Do not leak the pid reference and borrow context idr_lock. (Chris)

v3:
* More avoiding leaks. (Chris)

---
 drivers/gpu/drm/i915/gem/i915_gem_context.c | 36 ++++++++++++++++++---
 drivers/gpu/drm/i915/i915_drv.h             |  6 ++++
 drivers/gpu/drm/i915/i915_gem.c             |  4 +--
 3 files changed, 39 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +31 -5
index b482b2e5f31f..dc3a7856ae22 100644
@@ -2170,7 +2170,10 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
 {
 	struct drm_i915_private *i915 = to_i915(dev);
 	struct drm_i915_gem_context_create_ext *args = data;
+	struct drm_i915_file_private *file_priv = file->driver_priv;
+	struct i915_drm_client *client = &file_priv->client;
 	struct create_ext ext_data;
+	struct pid *pid;
 	int ret;
 	u32 id;
 
@@ -2184,16 +2187,36 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
 	if (ret)
 		return ret;
 
-	ext_data.fpriv = file->driver_priv;
+	pid = get_task_pid(current, PIDTYPE_PID);
+
+	ext_data.fpriv = file_priv;
 	if (client_is_banned(ext_data.fpriv)) {
 		DRM_DEBUG("client %s[%d] banned from creating ctx\n",
-			  current->comm, task_pid_nr(current));
-		return -EIO;
+			  current->comm, pid_nr(pid));
+		ret = -EIO;
+		goto err_pid;
+	}
+
+	/*
+	 * Borrow struct_mutex to protect the client remove-add cycle.
+	 */
+	ret = mutex_lock_interruptible(&dev->struct_mutex);
+	if (ret)
+		goto err_pid;
+	if (client->pid != pid) {
+		__i915_gem_unregister_client(client);
+		ret = __i915_gem_register_client(&i915->clients, client,
+						 current);
 	}
+	mutex_unlock(&dev->struct_mutex);
+	if (ret)
+		goto err_pid;
 
 	ext_data.ctx = i915_gem_create_context(i915, args->flags);
-	if (IS_ERR(ext_data.ctx))
-		return PTR_ERR(ext_data.ctx);
+	if (IS_ERR(ext_data.ctx)) {
+		ret = PTR_ERR(ext_data.ctx);
+		goto err_pid;
+	}
 
 	if (args->flags & I915_CONTEXT_CREATE_FLAGS_USE_EXTENSIONS) {
 		ret = i915_user_extensions(u64_to_user_ptr(args->extensions),
@@ -2215,6 +2238,9 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
 
 err_ctx:
 	context_close(ext_data.ctx);
+err_pid:
+	put_pid(pid);
+
 	return ret;
 }
 
drivers/gpu/drm/i915/i915_drv.h +6 -0
index e1d8361aafd7..514d7d630fce 100644
@@ -1900,6 +1900,12 @@ void i915_gem_suspend(struct drm_i915_private *dev_priv);
 void i915_gem_suspend_late(struct drm_i915_private *dev_priv);
 void i915_gem_resume(struct drm_i915_private *dev_priv);
 
+int
+__i915_gem_register_client(struct i915_drm_clients *clients,
+			   struct i915_drm_client *client,
+			   struct task_struct *task);
+void __i915_gem_unregister_client(struct i915_drm_client *client);
+
 int i915_gem_open(struct drm_i915_private *i915, struct drm_file *file);
 void i915_gem_release(struct drm_device *dev, struct drm_file *file);
 
drivers/gpu/drm/i915/i915_gem.c +2 -2
index f2d285388b8c..f953d4e20e33 100644
@@ -1546,7 +1546,7 @@ show_client_pid(struct device *kdev, struct device_attribute *attr, char *buf)
 		return snprintf(buf, PAGE_SIZE, "-");
 }
 
-static int
+int
 __i915_gem_register_client(struct i915_drm_clients *clients,
 			   struct i915_drm_client *client,
 			   struct task_struct *task)
@@ -1599,7 +1599,7 @@ __i915_gem_register_client(struct i915_drm_clients *clients,
 	return ret;
 }
 
-static void __i915_gem_unregister_client(struct i915_drm_client *client)
+void __i915_gem_unregister_client(struct i915_drm_client *client)
 {
 	struct drm_i915_file_private *fpriv =
 		container_of(client, typeof(*fpriv), client);
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

RFC 5/8 drm/i915: Track per-context engine busyness

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Some customers want to know how much of the GPU time are their clients using in order to make dynamic load balancing decisions.

With the hooks already in place which track the overall engine busyness, we can extend that slightly to split that time between contexts.

v2: Fix accounting for tail updates.
v3: Rebase.
v4: Mark currently running contexts as active on stats enable.
v5: Include some headers to fix the build.
v6: Added fine grained lock.
v7: Convert to seqlock. (Chris Wilson)
v8: Rebase and tidy with helpers.
v9: Refactor.
v10: Move recording start to promotion. (Chris)

---
 drivers/gpu/drm/i915/gt/intel_context.c       | 20 +++++++
 drivers/gpu/drm/i915/gt/intel_context.h       | 11 ++++
 drivers/gpu/drm/i915/gt/intel_context_types.h |  9 ++++
 drivers/gpu/drm/i915/gt/intel_engine_cs.c     | 16 +++++-
 drivers/gpu/drm/i915/gt/intel_lrc.c           | 52 ++++++++++++++++---
 5 files changed, 100 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +20 -0
index b1e346d2d35f..b211b48d6cae 100644
@@ -243,6 +243,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);
@@ -337,6 +338,25 @@ struct i915_request *intel_context_create_request(struct intel_context *ce)
 	return rq;
 }
 
+ktime_t intel_context_get_busy_time(struct intel_context *ce)
+{
+	unsigned int seq;
+	ktime_t total;
+
+	do {
+		seq = read_seqbegin(&ce->stats.lock);
+
+		total = ce->stats.total;
+
+		if (ce->stats.active)
+			total = ktime_add(total,
+					  ktime_sub(ktime_get(),
+						    ce->stats.start));
+	} while (read_seqretry(&ce->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 +11 -0
index b39eb1fcfbca..3a15cf32f0a3 100644
@@ -160,4 +160,15 @@ static inline struct intel_ring *__intel_context_ring_size(u64 sz)
 	return u64_to_ptr(struct intel_ring, sz);
 }
 
+static inline void
+__intel_context_stats_start(struct intel_context_stats *stats, ktime_t now)
+{
+	if (!stats->active) {
+		stats->start = now;
+		stats->active = true;
+	}
+}
+
+ktime_t intel_context_get_busy_time(struct intel_context *ce);
+
 #endif /* __INTEL_CONTEXT_H__ */
drivers/gpu/drm/i915/gt/intel_context_types.h +9 -0
index d1204cc899a3..12cbad0798cb 100644
@@ -11,6 +11,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"
@@ -76,6 +77,14 @@ struct intel_context {
 
 	/** sseu: Control eu/slice partitioning */
 	struct intel_sseu sseu;
+
+	/** stats: Context GPU engine busyness tracking. */
+	struct intel_context_stats {
+		seqlock_t lock;
+		bool active;
+		ktime_t start;
+		ktime_t total;
+	} stats;
 };
 
 #endif /* __INTEL_CONTEXT_TYPES__ */
drivers/gpu/drm/i915/gt/intel_engine_cs.c +14 -2
index 3d1d48bf90cf..ac08781c8b24 100644
@@ -1577,8 +1577,20 @@ int intel_enable_engine_stats(struct intel_engine_cs *engine)
 
 		engine->stats.enabled_at = ktime_get();
 
-		/* XXX submission method oblivious? */
-		for (port = execlists->active; (rq = *port); port++)
+		/*
+		 * Mark currently running context as active.
+		 * XXX submission method oblivious?
+		 */
+
+		rq = NULL;
+		port = execlists->active;
+		if (port)
+			rq = *port;
+		if (rq)
+			__intel_context_stats_start(&rq->hw_context->stats,
+						    engine->stats.enabled_at);
+
+		for (; (rq = *port); port++)
 			engine->stats.active++;
 
 		for (port = execlists->pending; (rq = *port); port++) {
drivers/gpu/drm/i915/gt/intel_lrc.c +46 -6

100 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

Re: [Intel-gfx] [RFC 5/8] drm/i915: Track per-context engine busyness

Quoting Tvrtko Ursulin (2019-12-19 18:00:16)

Quoted 214 lines

From: Tvrtko Ursulin <[email protected]>

Some customers want to know how much of the GPU time are their clients using in order to make dynamic load balancing decisions.

With the hooks already in place which track the overall engine busyness, we can extend that slightly to split that time between contexts.

v2: Fix accounting for tail updates.
v3: Rebase.
v4: Mark currently running contexts as active on stats enable.
v5: Include some headers to fix the build.
v6: Added fine grained lock.
v7: Convert to seqlock. (Chris Wilson)
v8: Rebase and tidy with helpers.
v9: Refactor.
v10: Move recording start to promotion. (Chris)

---
 drivers/gpu/drm/i915/gt/intel_context.c       | 20 +++++++
 drivers/gpu/drm/i915/gt/intel_context.h       | 11 ++++
 drivers/gpu/drm/i915/gt/intel_context_types.h |  9 ++++
 drivers/gpu/drm/i915/gt/intel_engine_cs.c     | 16 +++++-
 drivers/gpu/drm/i915/gt/intel_lrc.c           | 52 ++++++++++++++++---
 5 files changed, 100 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +20 -0
index b1e346d2d35f..b211b48d6cae 100644
@@ -243,6 +243,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);
@@ -337,6 +338,25 @@ struct i915_request *intel_context_create_request(struct intel_context *ce)
        return rq;
 }
 
+ktime_t intel_context_get_busy_time(struct intel_context *ce)
+{
+       unsigned int seq;
+       ktime_t total;
+
+       do {
+               seq = read_seqbegin(&ce->stats.lock);
+
+               total = ce->stats.total;
+
+               if (ce->stats.active)
+                       total = ktime_add(total,
+                                         ktime_sub(ktime_get(),
+                                                   ce->stats.start));
+       } while (read_seqretry(&ce->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 +11 -0
index b39eb1fcfbca..3a15cf32f0a3 100644
@@ -160,4 +160,15 @@ static inline struct intel_ring *__intel_context_ring_size(u64 sz)
        return u64_to_ptr(struct intel_ring, sz);
 }
 
+static inline void
+__intel_context_stats_start(struct intel_context_stats *stats, ktime_t now)
+{
+       if (!stats->active) {
+               stats->start = now;
+               stats->active = true;
+       }
+}
+
+ktime_t intel_context_get_busy_time(struct intel_context *ce);
+
 #endif /* __INTEL_CONTEXT_H__ */
drivers/gpu/drm/i915/gt/intel_context_types.h +9 -0
index d1204cc899a3..12cbad0798cb 100644
@@ -11,6 +11,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"
@@ -76,6 +77,14 @@ struct intel_context {
 
        /** sseu: Control eu/slice partitioning */
        struct intel_sseu sseu;
+
+       /** stats: Context GPU engine busyness tracking. */
+       struct intel_context_stats {
+               seqlock_t lock;
+               bool active;
+               ktime_t start;
+               ktime_t total;
+       } stats;
 };
 
 #endif /* __INTEL_CONTEXT_TYPES__ */
drivers/gpu/drm/i915/gt/intel_engine_cs.c +14 -2
index 3d1d48bf90cf..ac08781c8b24 100644
@@ -1577,8 +1577,20 @@ int intel_enable_engine_stats(struct intel_engine_cs *engine)
 
                engine->stats.enabled_at = ktime_get();
 
-               /* XXX submission method oblivious? */
-               for (port = execlists->active; (rq = *port); port++)
+               /*
+                * Mark currently running context as active.
+                * XXX submission method oblivious?
+                */
+
+               rq = NULL;
+               port = execlists->active;
+               if (port)
+                       rq = *port;
+               if (rq)
+                       __intel_context_stats_start(&rq->hw_context->stats,
+                                                   engine->stats.enabled_at);
+
+               for (; (rq = *port); port++)
                        engine->stats.active++;
 
                for (port = execlists->pending; (rq = *port); port++) {
drivers/gpu/drm/i915/gt/intel_lrc.c +31 -1
index 4db54fd6a2fe..b186f06e508d 100644
@@ -940,6 +940,7 @@ static void intel_engine_context_in(struct intel_engine_cs *engine)
        if (engine->stats.enabled > 0) {
                if (engine->stats.active++ == 0)
                        engine->stats.start = ktime_get();
+
                GEM_BUG_ON(engine->stats.active == 0);
        }
 
@@ -1088,6 +1089,32 @@ static void reset_active(struct i915_request *rq,
        ce->lrc_desc |= CTX_DESC_FORCE_RESTORE;
 }
 
+static void
+intel_context_stats_start(struct intel_context_stats *stats)
+{
+       unsigned long flags;
+
+       write_seqlock_irqsave(&stats->lock, flags);
+       __intel_context_stats_start(stats, ktime_get());
+       write_sequnlock_irqrestore(&stats->lock, flags);
+}
+
+static void
+intel_context_stats_stop(struct intel_context_stats *stats)
+{
+       unsigned long flags;
+
+       if (!READ_ONCE(stats->active))
+               return;
+
+       write_seqlock_irqsave(&stats->lock, flags);
+       GEM_BUG_ON(!READ_ONCE(stats->active));
+       stats->total = ktime_add(stats->total,
+                                ktime_sub(ktime_get(), stats->start));
+       stats->active = false;
+       write_sequnlock_irqrestore(&stats->lock, flags);
+}
+
 static inline struct intel_engine_cs *
 __execlists_schedule_in(struct i915_request *rq)
 {
@@ -1155,7 +1182,7 @@ static inline void
 __execlists_schedule_out(struct i915_request *rq,
                         struct intel_engine_cs * const engine)
 {
-       struct intel_context * const ce = rq->hw_context;
+       struct intel_context *ce = rq->hw_context;
 
        /*
         * NB process_csb() is not under the engine->active.lock and hence
@@ -1172,6 +1199,7 @@ __execlists_schedule_out(struct i915_request *rq,
                intel_engine_add_retire(engine, ce->timeline);
 
        intel_engine_context_out(engine);
+       intel_context_stats_stop(&ce->stats);
        execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_OUT);
        intel_gt_pm_put_async(engine->gt);
 
@@ -2174,9 +2202,11 @@ static void process_csb(struct intel_engine_cs *engine)
                        promote = gen8_csb_parse(execlists, buf + 2 * head);
                if (promote) {
                        struct i915_request * const *old = execlists->active;
+                       struct i915_request *rq;
 
                        /* Point active to the new ELSP; prevent overwriting */
                        WRITE_ONCE(execlists->active, execlists->pending);
+
                        set_timeslice(engine);
 
                        if (!inject_preempt_hang(execlists))

drivers/gpu/drm/i915/gt/intel_lrc.c static void process_csb(struct intel_engine_cs *engine) · line 2232

Quoted 7 lines
drivers/gpu/drm/i915/gt/intel_lrc.c +4 -0
@@ -2196,8 +2226,16 @@ static void process_csb(struct intel_engine_cs *engine)
                                          sizeof(*execlists->pending)));
 
                        WRITE_ONCE(execlists->pending[0], NULL);
+
+                       rq = *execlists->active;
+                       if (rq)
+                               intel_context_stats_start(&rq->hw_context->stats);

Code duplication :) Both branches are doing

rq = *execlists->active;
if (rq)

	intel_context_stats_start(&rq->hw_context->stats);

as their final setp, just move it to after the if.

Cost of maintaining stats was unnoticeable in profiles and did not affect wsim, so lgtm.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

Re: [Intel-gfx] [RFC 5/8] drm/i915: Track per-context engine busyness

Quoted 225 lines · Chris Wilson

Quoting Tvrtko Ursulin (2019-12-19 18:00:16)

Quoted 214 lines

From: Tvrtko Ursulin <[email protected]>

Some customers want to know how much of the GPU time are their clients using in order to make dynamic load balancing decisions.

With the hooks already in place which track the overall engine busyness, we can extend that slightly to split that time between contexts.

v2: Fix accounting for tail updates.
v3: Rebase.
v4: Mark currently running contexts as active on stats enable.
v5: Include some headers to fix the build.
v6: Added fine grained lock.
v7: Convert to seqlock. (Chris Wilson)
v8: Rebase and tidy with helpers.
v9: Refactor.
v10: Move recording start to promotion. (Chris)

---
  drivers/gpu/drm/i915/gt/intel_context.c       | 20 +++++++
  drivers/gpu/drm/i915/gt/intel_context.h       | 11 ++++
  drivers/gpu/drm/i915/gt/intel_context_types.h |  9 ++++
  drivers/gpu/drm/i915/gt/intel_engine_cs.c     | 16 +++++-
  drivers/gpu/drm/i915/gt/intel_lrc.c           | 52 ++++++++++++++++---
  5 files changed, 100 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +20 -0
index b1e346d2d35f..b211b48d6cae 100644
@@ -243,6 +243,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);
@@ -337,6 +338,25 @@ struct i915_request *intel_context_create_request(struct intel_context *ce)
         return rq;
  }
 
+ktime_t intel_context_get_busy_time(struct intel_context *ce)
+{
+       unsigned int seq;
+       ktime_t total;
+
+       do {
+               seq = read_seqbegin(&ce->stats.lock);
+
+               total = ce->stats.total;
+
+               if (ce->stats.active)
+                       total = ktime_add(total,
+                                         ktime_sub(ktime_get(),
+                                                   ce->stats.start));
+       } while (read_seqretry(&ce->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 +11 -0
index b39eb1fcfbca..3a15cf32f0a3 100644
@@ -160,4 +160,15 @@ static inline struct intel_ring *__intel_context_ring_size(u64 sz)
         return u64_to_ptr(struct intel_ring, sz);
  }
 
+static inline void
+__intel_context_stats_start(struct intel_context_stats *stats, ktime_t now)
+{
+       if (!stats->active) {
+               stats->start = now;
+               stats->active = true;
+       }
+}
+
+ktime_t intel_context_get_busy_time(struct intel_context *ce);
+
  #endif /* __INTEL_CONTEXT_H__ */
drivers/gpu/drm/i915/gt/intel_context_types.h +9 -0
index d1204cc899a3..12cbad0798cb 100644
@@ -11,6 +11,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"
@@ -76,6 +77,14 @@ struct intel_context {
 
         /** sseu: Control eu/slice partitioning */
         struct intel_sseu sseu;
+
+       /** stats: Context GPU engine busyness tracking. */
+       struct intel_context_stats {
+               seqlock_t lock;
+               bool active;
+               ktime_t start;
+               ktime_t total;
+       } stats;
  };
 
  #endif /* __INTEL_CONTEXT_TYPES__ */
drivers/gpu/drm/i915/gt/intel_engine_cs.c +14 -2
index 3d1d48bf90cf..ac08781c8b24 100644
@@ -1577,8 +1577,20 @@ int intel_enable_engine_stats(struct intel_engine_cs *engine)
 
                 engine->stats.enabled_at = ktime_get();
 
-               /* XXX submission method oblivious? */
-               for (port = execlists->active; (rq = *port); port++)
+               /*
+                * Mark currently running context as active.
+                * XXX submission method oblivious?
+                */
+
+               rq = NULL;
+               port = execlists->active;
+               if (port)
+                       rq = *port;
+               if (rq)
+                       __intel_context_stats_start(&rq->hw_context->stats,
+                                                   engine->stats.enabled_at);
+
+               for (; (rq = *port); port++)
                         engine->stats.active++;
 
                 for (port = execlists->pending; (rq = *port); port++) {
drivers/gpu/drm/i915/gt/intel_lrc.c +31 -1
index 4db54fd6a2fe..b186f06e508d 100644
@@ -940,6 +940,7 @@ static void intel_engine_context_in(struct intel_engine_cs *engine)
         if (engine->stats.enabled > 0) {
                 if (engine->stats.active++ == 0)
                         engine->stats.start = ktime_get();
+
                 GEM_BUG_ON(engine->stats.active == 0);
         }
 
@@ -1088,6 +1089,32 @@ static void reset_active(struct i915_request *rq,
         ce->lrc_desc |= CTX_DESC_FORCE_RESTORE;
  }
 
+static void
+intel_context_stats_start(struct intel_context_stats *stats)
+{
+       unsigned long flags;
+
+       write_seqlock_irqsave(&stats->lock, flags);
+       __intel_context_stats_start(stats, ktime_get());
+       write_sequnlock_irqrestore(&stats->lock, flags);
+}
+
+static void
+intel_context_stats_stop(struct intel_context_stats *stats)
+{
+       unsigned long flags;
+
+       if (!READ_ONCE(stats->active))
+               return;
+
+       write_seqlock_irqsave(&stats->lock, flags);
+       GEM_BUG_ON(!READ_ONCE(stats->active));
+       stats->total = ktime_add(stats->total,
+                                ktime_sub(ktime_get(), stats->start));
+       stats->active = false;
+       write_sequnlock_irqrestore(&stats->lock, flags);
+}
+
  static inline struct intel_engine_cs *
  __execlists_schedule_in(struct i915_request *rq)
  {
@@ -1155,7 +1182,7 @@ static inline void
  __execlists_schedule_out(struct i915_request *rq,
                          struct intel_engine_cs * const engine)
  {
-       struct intel_context * const ce = rq->hw_context;
+       struct intel_context *ce = rq->hw_context;
 
         /*
          * NB process_csb() is not under the engine->active.lock and hence
@@ -1172,6 +1199,7 @@ __execlists_schedule_out(struct i915_request *rq,
                 intel_engine_add_retire(engine, ce->timeline);
 
         intel_engine_context_out(engine);
+       intel_context_stats_stop(&ce->stats);
         execlists_context_status_change(rq, INTEL_CONTEXT_SCHEDULE_OUT);
         intel_gt_pm_put_async(engine->gt);
 
@@ -2174,9 +2202,11 @@ static void process_csb(struct intel_engine_cs *engine)
                         promote = gen8_csb_parse(execlists, buf + 2 * head);
                 if (promote) {
                         struct i915_request * const *old = execlists->active;
+                       struct i915_request *rq;
 
                         /* Point active to the new ELSP; prevent overwriting */
                         WRITE_ONCE(execlists->active, execlists->pending);
+
                         set_timeslice(engine);
 
                         if (!inject_preempt_hang(execlists))

drivers/gpu/drm/i915/gt/intel_lrc.c static void process_csb(struct intel_engine_cs *engine) · line 2232

Quoted 7 lines
drivers/gpu/drm/i915/gt/intel_lrc.c +4 -0
@@ -2196,8 +2226,16 @@ static void process_csb(struct intel_engine_cs *engine)
                                           sizeof(*execlists->pending)));
 
                         WRITE_ONCE(execlists->pending[0], NULL);
+
+                       rq = *execlists->active;
+                       if (rq)
+                               intel_context_stats_start(&rq->hw_context->stats);

Code duplication :) Both branches are doing

Quoted 5 lines

rq = *execlists->active;
if (rq)

	intel_context_stats_start(&rq->hw_context->stats);

as their final setp, just move it to after the if.

True, thanks!

Quoted 2 lines

Cost of maintaining stats was unnoticeable in profiles and did not affect wsim, so lgtm.

Yes I did not stand out to me either.

I tried the opposite test as well, running intel_gpu_top with a 100Hz update rate and that also wasn't that bad.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#14 lore raw

RFC 6/8 drm/i915: Track all user contexts per client

In reply to Tvrtko Ursulin

From: 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, plus we make contexts take a reference on their clients file_priv.

---
 drivers/gpu/drm/i915/gem/i915_gem_context.c   | 23 ++++++++++++++++++-
 .../gpu/drm/i915/gem/i915_gem_context_types.h |  6 +++++
 drivers/gpu/drm/i915/i915_drv.h               | 21 +++++++++++++++++
 drivers/gpu/drm/i915/i915_gem.c               |  6 +++--
 4 files changed, 53 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +22 -1
index dc3a7856ae22..6586edcf4ffb 100644
@@ -266,8 +266,18 @@ 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) {
+		spin_lock(&client->ctx_lock);
+		list_del_rcu(&ctx->client_link);
+		spin_unlock(&client->ctx_lock);
+
+		i915_gem_client_put(client);
+	}
+
 	spin_lock(&ctx->i915->gem.contexts.lock);
 	list_del(&ctx->link);
 	spin_unlock(&ctx->i915->gem.contexts.lock);
@@ -790,6 +800,7 @@ static int gem_context_register(struct i915_gem_context *ctx,
 				struct drm_i915_file_private *fpriv,
 				u32 *id)
 {
+	struct i915_drm_client *client = &fpriv->client;
 	struct i915_address_space *vm;
 	int ret;
 
@@ -807,9 +818,19 @@ static int gem_context_register(struct i915_gem_context *ctx,
 
 	/* And finally expose ourselves to userspace via the idr */
 	ret = xa_alloc(&fpriv->context_xa, id, ctx, xa_limit_32b, GFP_KERNEL);
-	if (ret)
+	if (ret) {
 		put_pid(fetch_and_zero(&ctx->pid));
+		goto out;
+	}
+
+	ctx->client = client;
+	i915_gem_client_get(client);
 
+	spin_lock(&client->ctx_lock);
+	list_add_tail_rcu(&ctx->client_link, &client->ctx_list);
+	spin_unlock(&client->ctx_lock);
+
+out:
 	return ret;
 }
 
drivers/gpu/drm/i915/gem/i915_gem_context_types.h +6 -0
index 69df5459c350..090ef10fdc5d 100644
@@ -104,6 +104,12 @@ struct i915_gem_context {
 	struct list_head link;
 	struct llist_node free_link;
 
+	/** client: struct i915_drm_client */
+	struct i915_drm_client *client;
+
+	/** link: &fpriv.context_list */
+	struct list_head client_link;
+
 	/**
 	 * @ref: reference count
 	 *
drivers/gpu/drm/i915/i915_drv.h +21 -0
index 514d7d630fce..8ffd638a071f 100644
@@ -234,6 +234,9 @@ struct drm_i915_file_private {
 		char *name;
 		bool closed;
 
+		spinlock_t ctx_lock;
+		struct list_head ctx_list;
+
 		struct kobject *root;
 		struct {
 			struct device_attribute pid;
@@ -1909,6 +1912,24 @@ void __i915_gem_unregister_client(struct i915_drm_client *client);
 int i915_gem_open(struct drm_i915_private *i915, struct drm_file *file);
 void i915_gem_release(struct drm_device *dev, struct drm_file *file);
 
+static inline void i915_gem_client_get(struct i915_drm_client *client)
+{
+	struct drm_i915_file_private *fpriv =
+		container_of(client, typeof(*fpriv), client);
+
+	kref_get(&fpriv->kref);
+}
+
+void __i915_gem_release(struct kref *kref);
+
+static inline void i915_gem_client_put(struct i915_drm_client *client)
+{
+	struct drm_i915_file_private *fpriv =
+		container_of(client, typeof(*fpriv), client);
+
+	kref_put(&fpriv->kref, __i915_gem_release);
+}
+
 int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj,
 				    enum i915_cache_level cache_level);
 
drivers/gpu/drm/i915/i915_gem.c +4 -2
index f953d4e20e33..564e21902dff 100644
@@ -1612,7 +1612,7 @@ void __i915_gem_unregister_client(struct i915_drm_client *client)
 	kfree(fetch_and_zero(&client->name));
 }
 
-static void gem_release(struct kref *kref)
+void __i915_gem_release(struct kref *kref)
 {
 	struct drm_i915_file_private *fpriv =
 		container_of(kref, typeof(*fpriv), kref);
@@ -1639,7 +1639,7 @@ void i915_gem_release(struct drm_device *dev, struct drm_file *file)
 
 	GEM_BUG_ON(client->closed);
 	client->closed = true;
-	kref_put(&file_priv->kref, gem_release);
+	i915_gem_client_put(client);
 }
 
 int i915_gem_open(struct drm_i915_private *i915, struct drm_file *file)
@@ -1667,6 +1667,8 @@ int i915_gem_open(struct drm_i915_private *i915, struct drm_file *file)
 		goto err_add;
 
 	kref_init(&file_priv->kref);
+	spin_lock_init(&client->ctx_lock);
+	INIT_LIST_HEAD(&client->ctx_list);
 
 	file->driver_priv = file_priv;
 	file_priv->i915 = i915;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

RFC 7/8 drm/i915: Contexts can use struct pid stored in the client

In reply to Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Now that contexts keep their parent client reference counted, we can remove separate struct pid reference owned by contexts in favour of the one already held by the client.

---
 drivers/gpu/drm/i915/gem/i915_gem_context.c       | 13 ++++---------
 drivers/gpu/drm/i915/gem/i915_gem_context_types.h | 10 ----------
 drivers/gpu/drm/i915/i915_debugfs.c               |  7 ++++---
 drivers/gpu/drm/i915/i915_gpu_error.c             |  6 +++---
 4 files changed, 11 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_context.c +4 -9
index 6586edcf4ffb..1c4d4640bafd 100644
@@ -288,7 +288,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);
@@ -812,16 +811,13 @@ 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);
 	snprintf(ctx->name, sizeof(ctx->name), "%s[%d]",
-		 current->comm, pid_nr(ctx->pid));
+		 current->comm, pid_nr(client->pid));
 
 	/* 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 out;
-	}
+	if (ret)
+		return ret;
 
 	ctx->client = client;
 	i915_gem_client_get(client);
@@ -830,8 +826,7 @@ static int gem_context_register(struct i915_gem_context *ctx,
 	list_add_tail_rcu(&ctx->client_link, &client->ctx_list);
 	spin_unlock(&client->ctx_lock);
 
-out:
-	return ret;
+	return 0;
 }
 
 int i915_gem_context_open(struct drm_i915_private *i915,
drivers/gpu/drm/i915/gem/i915_gem_context_types.h +0 -10
index 090ef10fdc5d..770b10ea28fb 100644
@@ -90,16 +90,6 @@ 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;
drivers/gpu/drm/i915/i915_debugfs.c +4 -3
index d28468eaed57..ec863be938e8 100644
@@ -347,7 +347,8 @@ static void print_context_stats(struct seq_file *m,
 			rcu_read_unlock();
 
 			rcu_read_lock();
-			task = pid_task(ctx->pid ?: file->pid, PIDTYPE_PID);
+			task = pid_task(ctx->client->pid ?: file->pid,
+					PIDTYPE_PID);
 			snprintf(name, sizeof(name), "%s",
 				 task ? task->comm : "<unknown>");
 			rcu_read_unlock();
@@ -1489,10 +1490,10 @@ 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) {
+		if (ctx->client->pid) {
 			struct task_struct *task;
 
-			task = get_pid_task(ctx->pid, PIDTYPE_PID);
+			task = get_pid_task(ctx->client->pid, PIDTYPE_PID);
 			if (task) {
 				seq_printf(m, "(%s [%d]) ",
 					   task->comm, task->pid);
drivers/gpu/drm/i915/i915_gpu_error.c +3 -3
index 8374d50c0770..3ba169339fa2 100644
@@ -1231,7 +1231,7 @@ static void record_request(const struct i915_request *request,
 	erq->start = i915_ggtt_offset(request->ring->vma);
 	erq->head = request->head;
 	erq->tail = request->tail;
-	erq->pid = ctx->pid ? pid_nr(ctx->pid) : 0;
+	erq->pid = ctx->client->pid ? pid_nr(ctx->client->pid) : 0;
 }
 
 static void engine_record_requests(struct intel_engine_cs *engine,
@@ -1300,11 +1300,11 @@ static bool record_context(struct drm_i915_error_context *e,
 {
 	const struct i915_gem_context *ctx = rq->gem_context;
 
-	if (ctx->pid) {
+	if (ctx->client->pid) {
 		struct task_struct *task;
 
 		rcu_read_lock();
-		task = pid_task(ctx->pid, PIDTYPE_PID);
+		task = pid_task(ctx->client->pid, PIDTYPE_PID);
 		if (task) {
 			strcpy(e->comm, task->comm);
 			e->pid = task->pid;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

Re: [Intel-gfx] [RFC 7/8] drm/i915: Contexts can use struct pid stored in the client

Quoting Tvrtko Ursulin (2019-12-19 18:00:18)

Quoted 5 lines

From: Tvrtko Ursulin <[email protected]>

Now that contexts keep their parent client reference counted, we can remove separate struct pid reference owned by contexts in favour of the one already held by the client.

Ok. I do like the client abstraction, and I think we want to develop it further.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#17 lore raw

Re: [Intel-gfx] [RFC 7/8] drm/i915: Contexts can use struct pid stored in the client

Quoted 9 lines · Chris Wilson

Quoting Tvrtko Ursulin (2019-12-19 18:00:18)

Quoted 5 lines

From: Tvrtko Ursulin <[email protected]>

Now that contexts keep their parent client reference counted, we can remove separate struct pid reference owned by contexts in favour of the one already held by the client.

Ok. I do like the client abstraction, and I think we want to develop it further.

Okay, we'll have to see what you have in mind for a gem vs drm client and so on then.

Regards,

Tvrtko

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw

RFC 8/8 drm/i915: Expose per-engine client busyness

In reply to Tvrtko Ursulin

From: 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.

---
 drivers/gpu/drm/i915/i915_drv.h |  9 ++++
 drivers/gpu/drm/i915/i915_gem.c | 89 ++++++++++++++++++++++++++++++++-
 2 files changed, 97 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +9 -0
index 8ffd638a071f..8cba3cfb5910 100644
@@ -189,6 +189,13 @@ struct drm_i915_private;
 struct i915_mm_struct;
 struct i915_mmu_object;
 struct i915_drm_clients;
+struct i915_drm_client;
+
+struct i915_engine_busy_attribute {
+	struct device_attribute attr;
+	struct i915_drm_client *client;
+	unsigned int engine_class;
+};
 
 struct drm_i915_file_private {
 	struct kref kref;
@@ -238,9 +245,11 @@ struct drm_i915_file_private {
 		struct list_head ctx_list;
 
 		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];
 		} attr;
 	} client;
 };
drivers/gpu/drm/i915/i915_gem.c +88 -1

121 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

Re: [Intel-gfx] [RFC 8/8] drm/i915: Expose per-engine client busyness

Quoting Tvrtko Ursulin (2019-12-19 18:00:19)

Quoted 39 lines

From: 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.

Quoted 1 line

Other than splitting it out into i915_drm_client.c (et al). It worksforme.

However, it's about as useful as top, but without any means to kill/stop/reprioritise clients :(

To give me actionable data, do we not need more of a perf interface where events are sent for client start/stop so that observers can record the context utilisation within their sample periods? I'm thinking of the "perf stat wsim..." use case where it gives me a breakdown of each workload.
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#20 lore raw

Re: [Intel-gfx] [RFC 8/8] drm/i915: Expose per-engine client busyness

Quoted 40 lines · Chris Wilson

Quoting Tvrtko Ursulin (2019-12-19 18:00:19)

Quoted 39 lines

From: 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.

Quoted 7 lines
Quoted 1 line

Other than splitting it out into i915_drm_client.c (et al). It worksforme.

However, it's about as useful as top, but without any means to kill/stop/reprioritise clients :(

Killing a client is a job for kill(2), no? Since there is pid already, it is just a matter of adding some code to intel_gpu_top.

Unless we also want to cover killing work belonging to exited clients. Would probably be nice for feature completeness. For that we probably want an ioctl. But it would be a first one to allow direct action on unrelated clients, even if under CAP_SYS_ADMIN for instance.

Quoted 5 lines

To give me actionable data, do we not need more of a perf interface where events are sent for client start/stop so that observers can record the context utilisation within their sample periods? I'm thinking of the "perf stat wsim..." use case where it gives me a breakdown of each workload.

It is doable I think. I had a prototype at the time when I initially started playing with this. In short, what is required is a separate PMU "node", and keeping a map of pid to client. Then I was able to query GPU time for each pid as profiled by perf. I should have a sketch in a branch somewhere.

But IIRC I wasn't sure it was a good replacement for this sysfs interface when just thinking about intel_gpu_top. Details escape me now.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#21 lore raw

Re: [Intel-gfx] [RFC 8/8] drm/i915: Expose per-engine client busyness

In reply to Tvrtko Ursulin

Quoting Tvrtko Ursulin (2019-12-19 18:00:19)

Quoted 9 lines
drivers/gpu/drm/i915/i915_gem.c +9 -0
+       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;
+

drivers/gpu/drm/i915/i915_gem.c __i915_gem_register_client(struct i915_drm_clients *clients, · line 1658

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +10 -0
+               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);

I was thinking whether or not poll("/sys/i915/clients") would return events for new clients and so whether or not we could do something like

if (poll("/sys/i915/clients", timeout) > 0) {
	for_each_new_client:
		client = open("/sys/i915/client/$id");
}

for_each_client:

	printf("%s: {rcs:%llu, ...}", client->name, read_u64(client->rcs));

Might be a bit heavy on the fds :)
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#22 lore raw

Re: [Intel-gfx] [RFC 8/8] drm/i915: Expose per-engine client busyness

Quoting Chris Wilson (2019-12-19 21:23:27)

Quoted 24 lines

Quoting Tvrtko Ursulin (2019-12-19 18:00:19)

Quoted 9 lines
drivers/gpu/drm/i915/i915_gem.c +9 -0
+       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;
+

drivers/gpu/drm/i915/i915_gem.c __i915_gem_register_client(struct i915_drm_clients *clients, · line 1658

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem.c +10 -0
+               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?

Quoted 7 lines
        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
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#23 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Per client engine busyness (rev2)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: Per client engine busyness (rev2)
URL : https://patchwork.freedesktop.org/series/70977/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
c0a00684578c drm/i915: Switch context id allocation directoy to xarray
884f76e9c8c3 drm/i915: Reference count struct drm_i915_file_private
-:6: WARNING:TYPO_SPELLING: 'develope' may be misspelled - perhaps 'develop'?
#6: 
In the following patches we will develope a need to peek into the client

total: 0 errors, 1 warnings, 0 checks, 70 lines checked 8b12b7cce4b8 drm/i915: Expose list of clients in sysfs a81f7132f3ac drm/i915: Update client name on context create de1d52278f7f drm/i915: Track per-context engine busyness 86c433d16fd4 drm/i915: Track all user contexts per client -:92: CHECK:UNCOMMENTED_DEFINITION: spinlock_t definition without comment #92: FILE: drivers/gpu/drm/i915/i915_drv.h:237:
+ spinlock_t ctx_lock;

total: 0 errors, 0 warnings, 1 checks, 114 lines checked
c17f2c454f61 drm/i915: Contexts can use struct pid stored in the client
c6adb62d2587 drm/i915: Expose per-engine client busyness
-:25: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #25:
Render/3D/0 63.73% |███████████████████ | 3% 0%

-:119: WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const #119: FILE: drivers/gpu/drm/i915/i915_gem.c:1582:
+static const char *uabi_class_names[] = {

-:144: WARNING:LEADING_SPACE: please, no spaces at the start of a line #144: FILE: drivers/gpu/drm/i915/i915_gem.c:1633:
+ if (i915->caps.scheduler & I915_SCHEDULER_CAP_ENGINE_BUSY_STATS) {$

-:144: WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (7, 16) #144: FILE: drivers/gpu/drm/i915/i915_gem.c:1633:
+ if (i915->caps.scheduler & I915_SCHEDULER_CAP_ENGINE_BUSY_STATS) {
+ client->busy_root =

total: 0 errors, 4 warnings, 0 checks, 145 lines checked

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#24 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for Per client engine busyness (rev2)

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: Per client engine busyness (rev2)
URL : https://patchwork.freedesktop.org/series/70977/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7608 -> Patchwork_15846
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_15846 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_15846, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_15846:

### IGT changes ###

#### Possible regressions ####

* igt@debugfs_test@read_all_entries:
- fi-ivb-3770: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-ivb-3770/igt@debugfs_test@read_all_entries.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-ivb-3770/igt@debugfs_test@read_all_entries.html
- fi-kbl-7500u: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-kbl-7500u/igt@debugfs_test@read_all_entries.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-kbl-7500u/igt@debugfs_test@read_all_entries.html
- fi-snb-2520m: [PASS][5] -> [INCOMPLETE][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-snb-2520m/igt@debugfs_test@read_all_entries.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-snb-2520m/igt@debugfs_test@read_all_entries.html
- fi-skl-lmem: [PASS][7] -> [INCOMPLETE][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-skl-lmem/igt@debugfs_test@read_all_entries.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-skl-lmem/igt@debugfs_test@read_all_entries.html
- fi-kbl-guc: [PASS][9] -> [INCOMPLETE][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-kbl-guc/igt@debugfs_test@read_all_entries.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-kbl-guc/igt@debugfs_test@read_all_entries.html
- fi-bsw-kefka: [PASS][11] -> [INCOMPLETE][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-bsw-kefka/igt@debugfs_test@read_all_entries.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-bsw-kefka/igt@debugfs_test@read_all_entries.html
- fi-blb-e6850: [PASS][13] -> [INCOMPLETE][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-blb-e6850/igt@debugfs_test@read_all_entries.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-blb-e6850/igt@debugfs_test@read_all_entries.html
- fi-bwr-2160: [PASS][15] -> [INCOMPLETE][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-bwr-2160/igt@debugfs_test@read_all_entries.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-bwr-2160/igt@debugfs_test@read_all_entries.html
- fi-bdw-5557u: [PASS][17] -> [INCOMPLETE][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-bdw-5557u/igt@debugfs_test@read_all_entries.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-bdw-5557u/igt@debugfs_test@read_all_entries.html
- fi-kbl-r: [PASS][19] -> [INCOMPLETE][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-kbl-r/igt@debugfs_test@read_all_entries.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-kbl-r/igt@debugfs_test@read_all_entries.html
- fi-skl-guc: [PASS][21] -> [INCOMPLETE][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-skl-guc/igt@debugfs_test@read_all_entries.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-skl-guc/igt@debugfs_test@read_all_entries.html
- fi-kbl-8809g: [PASS][23] -> [INCOMPLETE][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-kbl-8809g/igt@debugfs_test@read_all_entries.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-kbl-8809g/igt@debugfs_test@read_all_entries.html
- fi-bsw-nick: [PASS][25] -> [INCOMPLETE][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-bsw-nick/igt@debugfs_test@read_all_entries.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-bsw-nick/igt@debugfs_test@read_all_entries.html
- fi-skl-6600u: [PASS][27] -> [INCOMPLETE][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-skl-6600u/igt@debugfs_test@read_all_entries.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-skl-6600u/igt@debugfs_test@read_all_entries.html
- fi-cfl-8700k: [PASS][29] -> [INCOMPLETE][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-cfl-8700k/igt@debugfs_test@read_all_entries.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-cfl-8700k/igt@debugfs_test@read_all_entries.html
- fi-bsw-n3050: [PASS][31] -> [INCOMPLETE][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-bsw-n3050/igt@debugfs_test@read_all_entries.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-bsw-n3050/igt@debugfs_test@read_all_entries.html
- fi-skl-6700k2: [PASS][33] -> [INCOMPLETE][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-skl-6700k2/igt@debugfs_test@read_all_entries.html
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-skl-6700k2/igt@debugfs_test@read_all_entries.html
- fi-kbl-soraka: [PASS][35] -> [INCOMPLETE][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-kbl-soraka/igt@debugfs_test@read_all_entries.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-kbl-soraka/igt@debugfs_test@read_all_entries.html
- fi-cfl-guc: [PASS][37] -> [INCOMPLETE][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-cfl-guc/igt@debugfs_test@read_all_entries.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-cfl-guc/igt@debugfs_test@read_all_entries.html

* igt@runner@aborted:
- fi-ilk-650: NOTRUN -> [FAIL][39]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-ilk-650/igt@[email protected]
- fi-pnv-d510: NOTRUN -> [FAIL][40]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-pnv-d510/igt@[email protected]
- fi-hsw-peppy: NOTRUN -> [FAIL][41]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-hsw-peppy/igt@[email protected]
- fi-gdg-551: NOTRUN -> [FAIL][42]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-gdg-551/igt@[email protected]
- fi-snb-2520m: NOTRUN -> [FAIL][43]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-snb-2520m/igt@[email protected]
- fi-kbl-soraka: NOTRUN -> [FAIL][44]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-kbl-soraka/igt@[email protected]
- fi-hsw-4770: NOTRUN -> [FAIL][45]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-hsw-4770/igt@[email protected]
- fi-kbl-7500u: NOTRUN -> [FAIL][46]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-kbl-7500u/igt@[email protected]
- fi-ivb-3770: NOTRUN -> [FAIL][47]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-ivb-3770/igt@[email protected]
- fi-bxt-dsi: NOTRUN -> [FAIL][48]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-bxt-dsi/igt@[email protected]
- fi-blb-e6850: NOTRUN -> [FAIL][49]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-blb-e6850/igt@[email protected]
- fi-kbl-x1275: NOTRUN -> [FAIL][50]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-kbl-x1275/igt@[email protected]
- fi-cfl-8700k: NOTRUN -> [FAIL][51]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-cfl-8700k/igt@[email protected]
- fi-hsw-4770r: NOTRUN -> [FAIL][52]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-hsw-4770r/igt@[email protected]
- fi-kbl-r: NOTRUN -> [FAIL][53]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-kbl-r/igt@[email protected]
- fi-byt-n2820: NOTRUN -> [FAIL][54]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-byt-n2820/igt@[email protected]
- fi-snb-2600: NOTRUN -> [FAIL][55]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-snb-2600/igt@[email protected]
- fi-elk-e7500: NOTRUN -> [FAIL][56]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-elk-e7500/igt@[email protected]

#### Warnings ####

* igt@debugfs_test@read_all_entries:
- fi-kbl-x1275: [DMESG-WARN][57] ([i915#62] / [i915#92]) -> [INCOMPLETE][58]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-kbl-x1275/igt@debugfs_test@read_all_entries.html
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-kbl-x1275/igt@debugfs_test@read_all_entries.html

* igt@runner@aborted:
- fi-byt-j1900: [FAIL][59] ([i915#816]) -> [FAIL][60]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-byt-j1900/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-byt-j1900/igt@[email protected]
- fi-kbl-8809g: [FAIL][61] ([i915#858]) -> [FAIL][62]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-kbl-8809g/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-kbl-8809g/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_15846 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@debugfs_test@read_all_entries:
- fi-cml-s: [PASS][63] -> [INCOMPLETE][64] ([i915#283])
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-cml-s/igt@debugfs_test@read_all_entries.html
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-cml-s/igt@debugfs_test@read_all_entries.html
- fi-glk-dsi: [PASS][65] -> [INCOMPLETE][66] ([i915#58] / [k.org#198133])
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-glk-dsi/igt@debugfs_test@read_all_entries.html
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-glk-dsi/igt@debugfs_test@read_all_entries.html
- fi-hsw-peppy: [PASS][67] -> [INCOMPLETE][68] ([i915#435])
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-hsw-peppy/igt@debugfs_test@read_all_entries.html
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-hsw-peppy/igt@debugfs_test@read_all_entries.html
- fi-icl-u3: [PASS][69] -> [INCOMPLETE][70] ([i915#140])
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-icl-u3/igt@debugfs_test@read_all_entries.html
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-icl-u3/igt@debugfs_test@read_all_entries.html
- fi-gdg-551: [PASS][71] -> [INCOMPLETE][72] ([i915#172])
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-gdg-551/igt@debugfs_test@read_all_entries.html
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-gdg-551/igt@debugfs_test@read_all_entries.html
- fi-icl-u2: [PASS][73] -> [INCOMPLETE][74] ([i915#140])
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-icl-u2/igt@debugfs_test@read_all_entries.html
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-icl-u2/igt@debugfs_test@read_all_entries.html
- fi-pnv-d510: [PASS][75] -> [INCOMPLETE][76] ([i915#299])
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-pnv-d510/igt@debugfs_test@read_all_entries.html
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-pnv-d510/igt@debugfs_test@read_all_entries.html
- fi-ilk-650: [PASS][77] -> [INCOMPLETE][78] ([i915#435])
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-ilk-650/igt@debugfs_test@read_all_entries.html
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-ilk-650/igt@debugfs_test@read_all_entries.html
- fi-byt-n2820: [PASS][79] -> [INCOMPLETE][80] ([i915#45])
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-byt-n2820/igt@debugfs_test@read_all_entries.html
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-byt-n2820/igt@debugfs_test@read_all_entries.html
- fi-elk-e7500: [PASS][81] -> [INCOMPLETE][82] ([i915#66])
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-elk-e7500/igt@debugfs_test@read_all_entries.html
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-elk-e7500/igt@debugfs_test@read_all_entries.html
- fi-snb-2600: [PASS][83] -> [INCOMPLETE][84] ([i915#82])
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-snb-2600/igt@debugfs_test@read_all_entries.html
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-snb-2600/igt@debugfs_test@read_all_entries.html
- fi-hsw-4770r: [PASS][85] -> [INCOMPLETE][86] ([i915#435])
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-hsw-4770r/igt@debugfs_test@read_all_entries.html
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-hsw-4770r/igt@debugfs_test@read_all_entries.html
- fi-apl-guc: [PASS][87] -> [INCOMPLETE][88] ([fdo#103927])
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-apl-guc/igt@debugfs_test@read_all_entries.html
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-apl-guc/igt@debugfs_test@read_all_entries.html
- fi-icl-y: [PASS][89] -> [INCOMPLETE][90] ([i915#140])
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-icl-y/igt@debugfs_test@read_all_entries.html
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-icl-y/igt@debugfs_test@read_all_entries.html
- fi-byt-j1900: [PASS][91] -> [INCOMPLETE][92] ([i915#45])
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-byt-j1900/igt@debugfs_test@read_all_entries.html
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-byt-j1900/igt@debugfs_test@read_all_entries.html
- fi-bxt-dsi: [PASS][93] -> [INCOMPLETE][94] ([fdo#103927])
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-bxt-dsi/igt@debugfs_test@read_all_entries.html
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-bxt-dsi/igt@debugfs_test@read_all_entries.html
- fi-icl-dsi: [PASS][95] -> [INCOMPLETE][96] ([i915#140])
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-icl-dsi/igt@debugfs_test@read_all_entries.html
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-icl-dsi/igt@debugfs_test@read_all_entries.html
- fi-cml-u2: [PASS][97] -> [INCOMPLETE][98] ([i915#283])
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-cml-u2/igt@debugfs_test@read_all_entries.html
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-cml-u2/igt@debugfs_test@read_all_entries.html
- fi-hsw-4770: [PASS][99] -> [INCOMPLETE][100] ([i915#435])
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-hsw-4770/igt@debugfs_test@read_all_entries.html
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-hsw-4770/igt@debugfs_test@read_all_entries.html
- fi-icl-guc: [PASS][101] -> [INCOMPLETE][102] ([i915#140])
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-icl-guc/igt@debugfs_test@read_all_entries.html
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-icl-guc/igt@debugfs_test@read_all_entries.html

#### Warnings ####

* igt@runner@aborted:
- fi-icl-guc: [FAIL][103] ([fdo#110943] / [fdo#111093]) -> [FAIL][104] ([fdo#111093] / [i915#338])
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-icl-guc/igt@[email protected]
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-icl-guc/igt@[email protected]
- fi-cml-s: [FAIL][105] ([fdo#111764] / [i915#577]) -> [FAIL][106] ([fdo#111893] / [i915#577])
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7608/fi-cml-s/igt@[email protected]
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/fi-cml-s/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#110943]: https://bugs.freedesktop.org/show_bug.cgi?id=110943
[fdo#111093]: https://bugs.freedesktop.org/show_bug.cgi?id=111093
[fdo#111764]: https://bugs.freedesktop.org/show_bug.cgi?id=111764
[fdo#111893]: https://bugs.freedesktop.org/show_bug.cgi?id=111893
[i915#140]: https://gitlab.freedesktop.org/drm/intel/issues/140
[i915#172]: https://gitlab.freedesktop.org/drm/intel/issues/172
[i915#283]: https://gitlab.freedesktop.org/drm/intel/issues/283
[i915#299]: https://gitlab.freedesktop.org/drm/intel/issues/299
[i915#338]: https://gitlab.freedesktop.org/drm/intel/issues/338
[i915#435]: https://gitlab.freedesktop.org/drm/intel/issues/435
[i915#45]: https://gitlab.freedesktop.org/drm/intel/issues/45
[i915#577]: https://gitlab.freedesktop.org/drm/intel/issues/577
[i915#58]: https://gitlab.freedesktop.org/drm/intel/issues/58
[i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
[i915#66]: https://gitlab.freedesktop.org/drm/intel/issues/66
[i915#816]: https://gitlab.freedesktop.org/drm/intel/issues/816
[i915#82]: https://gitlab.freedesktop.org/drm/intel/issues/82
[i915#858]: https://gitlab.freedesktop.org/drm/intel/issues/858
[i915#92]: https://gitlab.freedesktop.org/drm/intel/issues/92
[k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133

Participating hosts (51 -> 44)
------------------------------

Additional (1): fi-tgl-y
Missing (8): fi-ilk-m540 fi-hsw-4200u fi-skl-6770hq fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_7608 -> Patchwork_15846

CI-20190529: 20190529
CI_DRM_7608: f21c4c7ff253121180f4399271e55b81f06a3989 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5351: e7fdcef72d1d6b3bb9f3003bbc37571959e6e8bb @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_15846: c6adb62d258766c022a8f3773a005191c8fc9a08 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

c6adb62d2587 drm/i915: Expose per-engine client busyness c17f2c454f61 drm/i915: Contexts can use struct pid stored in the client 86c433d16fd4 drm/i915: Track all user contexts per client de1d52278f7f drm/i915: Track per-context engine busyness a81f7132f3ac drm/i915: Update client name on context create 8b12b7cce4b8 drm/i915: Expose list of clients in sysfs 884f76e9c8c3 drm/i915: Reference count struct drm_i915_file_private c0a00684578c drm/i915: Switch context id allocation directoy to xarray

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_15846/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx