diff mbox

[1/2] lib/gt: Omit illegal instruction on hang injection with gen 8+

Message ID 1465391238-32737-1-git-send-email-mika.kuoppala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kuoppala June 8, 2016, 1:07 p.m. UTC
0xffffffff as an illegal command confuses the command execution
on gen9 so that the next BB start will get ignored, causing a runaway
head past the bb end. This delays the hang detection substantially
as hangcheck then observes only a non progressing seqno.

Omit the bad instruction on gen8+ and rely on the chained batch
loop to cause a deterministic hang. Make the chained bb start
to jump straight into bb start, omitting the MI_NOOP or the bad
instruction on subsequent passes. This makes the acthd sampling
to hit more reliably to the same value, as the loop is smaller,
making the head appear to be 'more stuck'.

References: https://bugs.freedesktop.org/show_bug.cgi?id=92715
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 lib/igt_gt.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Chris Wilson June 8, 2016, 1:54 p.m. UTC | #1
On Wed, Jun 08, 2016 at 04:07:17PM +0300, Mika Kuoppala wrote:
> 0xffffffff as an illegal command confuses the command execution
> on gen9 so that the next BB start will get ignored, causing a runaway
> head past the bb end. This delays the hang detection substantially
> as hangcheck then observes only a non progressing seqno.
> 
> Omit the bad instruction on gen8+ and rely on the chained batch
> loop to cause a deterministic hang. Make the chained bb start
> to jump straight into bb start, omitting the MI_NOOP or the bad
> instruction on subsequent passes. This makes the acthd sampling
> to hit more reliably to the same value, as the loop is smaller,
> making the head appear to be 'more stuck'.

You could note that BB(addr | 4) is also illegal. gen2+ requires 8 byte
alignment, ilk requires 64 byte.
 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=92715
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox

Patch

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index 95d74a0cfeae..adb4b95bb913 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -181,16 +181,22 @@  igt_hang_ring_t igt_hang_ctx(int fd,
 	exec.relocs_ptr = (uintptr_t)&reloc;
 
 	memset(b, 0xc5, sizeof(b));
-	b[0] = 0xffffffff;
+
 	len = 2;
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+	if (intel_gen(intel_get_drm_devid(fd)) >= 8) {
+		b[0] = MI_NOOP;
 		len++;
+	} else {
+		b[0] = 0xffffffff;
+	}
+
 	b[1] = MI_BATCH_BUFFER_START | (len - 2);
 	b[1+len] = MI_BATCH_BUFFER_END;
 	b[2+len] = MI_NOOP;
 	gem_write(fd, exec.handle, 0, b, sizeof(b));
 
 	reloc.offset = 8;
+	reloc.delta = 4;
 	reloc.target_handle = exec.handle;
 	reloc.read_domains = I915_GEM_DOMAIN_COMMAND;