public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request
@ 2017-10-13 20:10 jeff.mcgee
  2017-10-13 20:10 ` [PATCH 2/2] drm/i915: Include current seqno " jeff.mcgee
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jeff.mcgee @ 2017-10-13 20:10 UTC (permalink / raw)
  To: intel-gfx

From: Jeff McGee <jeff.mcgee@intel.com>

We are racing with updates to the timeline. This can cause an inconsistent
snapshot to be dumped, or even worse a NULL pointer dereference.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 0bb6e01121fc..135828fb1904 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -657,33 +657,26 @@ static void print_request(struct seq_file *m,
 static int i915_gem_request_info(struct seq_file *m, void *data)
 {
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
-	struct drm_device *dev = &dev_priv->drm;
 	struct drm_i915_gem_request *req;
 	struct intel_engine_cs *engine;
 	enum intel_engine_id id;
-	int ret, any;
-
-	ret = mutex_lock_interruptible(&dev->struct_mutex);
-	if (ret)
-		return ret;
+	int any = 0;
 
-	any = 0;
 	for_each_engine(engine, dev_priv, id) {
-		int count;
+		int count = 0;
 
-		count = 0;
+		spin_lock_irq(&engine->timeline->lock);
 		list_for_each_entry(req, &engine->timeline->requests, link)
 			count++;
-		if (count == 0)
-			continue;
-
-		seq_printf(m, "%s requests: %d\n", engine->name, count);
-		list_for_each_entry(req, &engine->timeline->requests, link)
-			print_request(m, req, "    ");
 
-		any++;
+		if (count) {
+			seq_printf(m, "%s requests: %d\n", engine->name, count);
+			list_for_each_entry(req, &engine->timeline->requests, link)
+				print_request(m, req, "    ");
+			any++;
+		}
+		spin_unlock_irq(&engine->timeline->lock);
 	}
-	mutex_unlock(&dev->struct_mutex);
 
 	if (any == 0)
 		seq_puts(m, "No requests\n");
-- 
2.14.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drm/i915: Include current seqno in debugfs i915_gem_request
  2017-10-13 20:10 [PATCH 1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request jeff.mcgee
@ 2017-10-13 20:10 ` jeff.mcgee
  2017-10-13 20:22 ` [PATCH 1/2] drm/i915: Properly lock the engine timeline " Chris Wilson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jeff.mcgee @ 2017-10-13 20:10 UTC (permalink / raw)
  To: intel-gfx

From: Jeff McGee <jeff.mcgee@intel.com>

Debugfs i915_gem_request lists the entire queue of requests on the
engine timeline. This will include requests that are complete but not
yet removed from the timeline. So let's include in this snapshot the
current seqno to help separate completed from pending.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 135828fb1904..36d21f3c31ee 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -670,7 +670,9 @@ static int i915_gem_request_info(struct seq_file *m, void *data)
 			count++;
 
 		if (count) {
-			seq_printf(m, "%s requests: %d\n", engine->name, count);
+			seq_printf(m, "%s: requests %d, current seqno %x\n",
+				   engine->name, count,
+				   intel_engine_get_seqno(engine));
 			list_for_each_entry(req, &engine->timeline->requests, link)
 				print_request(m, req, "    ");
 			any++;
-- 
2.14.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request
  2017-10-13 20:10 [PATCH 1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request jeff.mcgee
  2017-10-13 20:10 ` [PATCH 2/2] drm/i915: Include current seqno " jeff.mcgee
@ 2017-10-13 20:22 ` Chris Wilson
  2017-10-13 21:26 ` ✓ Fi.CI.BAT: success for series starting with [1/2] " Patchwork
  2017-10-14  8:49 ` ✓ Fi.CI.IGT: " Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2017-10-13 20:22 UTC (permalink / raw)
  To: jeff.mcgee, intel-gfx

Quoting jeff.mcgee@intel.com (2017-10-13 21:10:32)
> From: Jeff McGee <jeff.mcgee@intel.com>
> 
> We are racing with updates to the timeline. This can cause an inconsistent
> snapshot to be dumped, or even worse a NULL pointer dereference.

So no one's being using this, lets delete it.

If the execution list is useful in anyway, add it to i915_engine_info so
you also have the execution queue.

Patch itself looks fine, but as you can see from the bitrot I haven't
been using for debugging for a few years.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request
  2017-10-13 20:10 [PATCH 1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request jeff.mcgee
  2017-10-13 20:10 ` [PATCH 2/2] drm/i915: Include current seqno " jeff.mcgee
  2017-10-13 20:22 ` [PATCH 1/2] drm/i915: Properly lock the engine timeline " Chris Wilson
@ 2017-10-13 21:26 ` Patchwork
  2017-10-14  8:49 ` ✓ Fi.CI.IGT: " Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-10-13 21:26 UTC (permalink / raw)
  To: jeff.mcgee; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request
URL   : https://patchwork.freedesktop.org/series/31958/
State : success

== Summary ==

Series 31958v1 series starting with [1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request
https://patchwork.freedesktop.org/api/1.0/series/31958/revisions/1/mbox/

Test debugfs_test:
        Subgroup read_all_entries:
                dmesg-warn -> PASS       (fi-kbl-7500u)

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:456s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:470s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:388s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:568s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:284s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:520s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:520s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:534s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:521s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:565s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:436s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:274s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:598s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:443s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:457s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:511s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:479s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:503s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:487s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:592s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:669s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:471s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:660s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:531s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:507s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:476s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:588s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:425s

03d8d3c265cf402013c550833f32247082bfb551 drm-tip: 2017y-10m-13d-20h-44m-07s UTC integration manifest
39c27a4a8bc7 drm/i915: Include current seqno in debugfs i915_gem_request
7863ffed6c6d drm/i915: Properly lock the engine timeline in debugfs i915_gem_request

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6033/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* ✓ Fi.CI.IGT: success for series starting with [1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request
  2017-10-13 20:10 [PATCH 1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request jeff.mcgee
                   ` (2 preceding siblings ...)
  2017-10-13 21:26 ` ✓ Fi.CI.BAT: success for series starting with [1/2] " Patchwork
@ 2017-10-14  8:49 ` Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-10-14  8:49 UTC (permalink / raw)
  To: jeff.mcgee; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request
URL   : https://patchwork.freedesktop.org/series/31958/
State : success

== Summary ==

Test kms_plane:
        Subgroup plane-panning-top-left-pipe-C-planes:
                skip       -> PASS       (shard-hsw)
Test kms_frontbuffer_tracking:
        Subgroup fbc-stridechange:
                skip       -> PASS       (shard-hsw)

shard-hsw        total:2553 pass:1441 dwarn:0   dfail:0   fail:9   skip:1103 time:9609s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6033/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-14  8:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-13 20:10 [PATCH 1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request jeff.mcgee
2017-10-13 20:10 ` [PATCH 2/2] drm/i915: Include current seqno " jeff.mcgee
2017-10-13 20:22 ` [PATCH 1/2] drm/i915: Properly lock the engine timeline " Chris Wilson
2017-10-13 21:26 ` ✓ Fi.CI.BAT: success for series starting with [1/2] " Patchwork
2017-10-14  8:49 ` ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox