Skip to contentSkip to conversation

drm/i915: Properly lock the engine timeline in debugfs i915_gem_request

PATCH In review [email protected] 3 participants 5 messages Oct 13, 2017 – Oct 14, 2017

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

PATCH 1/2 drm/i915: Properly lock the engine timeline in debugfs i915_gem_request

From: Jeff McGee <[email protected]>

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

---
 drivers/gpu/drm/i915/i915_debugfs.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +10 -17
index 0bb6e01121fc..135828fb1904 100644
@@ -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");
Signature · 6 lines
2.14.2

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

PATCH 2/2 drm/i915: Include current seqno in debugfs i915_gem_request

From: Jeff McGee <[email protected]>

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.

---
 drivers/gpu/drm/i915/i915_debugfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_debugfs.c +3 -1
index 135828fb1904..36d21f3c31ee 100644
@@ -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++;
Signature · 6 lines
2.14.2

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

Quoting [email protected] (2017-10-13 21:10:32)

Quoted 4 lines

From: Jeff McGee <[email protected]>

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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request

In reply to [email protected]
== Series Details ==

== 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✓ Fi.CI.IGT: success for series starting with [1/2] drm/i915: Properly lock the engine timeline in debugfs i915_gem_request

In reply to [email protected]
== Series Details ==

== 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx