Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH igt] lib: Fix MI_BATCH_BUFFER_START for hang injection
@ 2018-03-02 16:13 Chris Wilson
  2018-03-02 17:09 ` [Intel-gfx] " Ville Syrjälä
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Wilson @ 2018-03-02 16:13 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

A couple of bugs inside the hang injector, the worst being that the
presumed_offset of the reloc didn't match the batch; so if the reloc was
skipped (as the presumed_offset matched the reloc offset), the batch
wasn't updated and so we may not have generated a hanging batch at all!
Secondly, the MI_BATCH_BUFFER_START was not correct for all gen.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_gt.c | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/lib/igt_gt.c b/lib/igt_gt.c
index e630550b..799ca1ae 100644
--- a/lib/igt_gt.c
+++ b/lib/igt_gt.c
@@ -276,6 +276,7 @@ igt_hang_t igt_hang_ctx(int fd,
 	uint32_t b[16];
 	unsigned ban;
 	unsigned len;
+	int gen;
 
 	igt_require_hang_ring(fd, ring);
 
@@ -310,12 +311,26 @@ igt_hang_t igt_hang_ctx(int fd,
 
 	memset(b, 0xc5, sizeof(b));
 
-	len = 2;
-	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
+	len = 0;
+	gen = intel_gen(intel_get_drm_devid(fd));
+	if (gen >= 8) {
+		b[len++] = MI_BATCH_BUFFER_START | 1 << 8 | 1;
+		b[len++] = 0;
+		b[len++] = 0;
+	} else if (gen >= 6) {
+		b[len++] = MI_BATCH_BUFFER_START | 1 << 8;
+		b[len++] = 0;
+	} else {
+		b[len++] = MI_BATCH_BUFFER_START | 2 << 6;
+		b[len] = 0;
+		if (gen < 4) {
+			b[len] |= 1;
+			reloc.delta = 1;
+		}
 		len++;
-	b[0] = MI_BATCH_BUFFER_START | (len - 2);
-	b[len] = MI_BATCH_BUFFER_END;
-	b[len+1] = MI_NOOP;
+	}
+	b[len++] = MI_BATCH_BUFFER_END;
+	b[len] = MI_NOOP;
 	gem_write(fd, exec.handle, 0, b, sizeof(b));
 
 	reloc.offset = sizeof(uint32_t);
@@ -364,8 +379,7 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
 	if (arg.handle == 0)
 		return;
 
-	gem_set_domain(fd, arg.handle,
-		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
+	gem_sync(fd, arg.handle);
 	gem_close(fd, arg.handle);
 
 	context_set_ban(fd, arg.ctx, arg.ban);
-- 
2.16.2

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [Intel-gfx] [PATCH igt] lib: Fix MI_BATCH_BUFFER_START for hang injection
  2018-03-02 16:13 [igt-dev] [PATCH igt] lib: Fix MI_BATCH_BUFFER_START for hang injection Chris Wilson
@ 2018-03-02 17:09 ` Ville Syrjälä
  2018-03-02 19:06   ` [igt-dev] " Chris Wilson
  2018-03-02 20:35 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
  2018-03-03  0:08 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2 siblings, 1 reply; 5+ messages in thread
From: Ville Syrjälä @ 2018-03-02 17:09 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, intel-gfx

On Fri, Mar 02, 2018 at 04:13:46PM +0000, Chris Wilson wrote:
> A couple of bugs inside the hang injector, the worst being that the
> presumed_offset of the reloc didn't match the batch; so if the reloc was
> skipped (as the presumed_offset matched the reloc offset), the batch
> wasn't updated and so we may not have generated a hanging batch at all!
> Secondly, the MI_BATCH_BUFFER_START was not correct for all gen.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  lib/igt_gt.c | 28 +++++++++++++++++++++-------
>  1 file changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/igt_gt.c b/lib/igt_gt.c
> index e630550b..799ca1ae 100644
> --- a/lib/igt_gt.c
> +++ b/lib/igt_gt.c
> @@ -276,6 +276,7 @@ igt_hang_t igt_hang_ctx(int fd,
>  	uint32_t b[16];
>  	unsigned ban;
>  	unsigned len;
> +	int gen;
>  
>  	igt_require_hang_ring(fd, ring);
>  
> @@ -310,12 +311,26 @@ igt_hang_t igt_hang_ctx(int fd,
>  
>  	memset(b, 0xc5, sizeof(b));
>  
> -	len = 2;
> -	if (intel_gen(intel_get_drm_devid(fd)) >= 8)
> +	len = 0;
> +	gen = intel_gen(intel_get_drm_devid(fd));
> +	if (gen >= 8) {
> +		b[len++] = MI_BATCH_BUFFER_START | 1 << 8 | 1;
> +		b[len++] = 0;
> +		b[len++] = 0;
> +	} else if (gen >= 6) {
> +		b[len++] = MI_BATCH_BUFFER_START | 1 << 8;
> +		b[len++] = 0;

ppgtt for gen6+

> +	} else {
> +		b[len++] = MI_BATCH_BUFFER_START | 2 << 6;
> +		b[len] = 0;
> +		if (gen < 4) {
> +			b[len] |= 1;
> +			reloc.delta = 1;
> +		}
>  		len++;

gtt secure for gen4/5
gtt non-secure for gen2/3

How does the security thing work on ctg/ilk for chained batches? The spec
is a wee bit unclear. It says the security bit for chained batches is
ignored, but then it also says non-secure batches can't access the gtt.
That was the case for MI_STORE_DWORD if I recall your earlier patch
correctly. So if we don't execute the first batch as secure the chained
MI_BB_START gets nopped out maybe?

Hmm. Now I wonder how the earlier MI_STORE_DWORD thing worked on pre-ctg
with a non-secure batch? Wasn't the hardware supposed to nop those out
entirely? /me confused

Anyways the new code looks at least more correct than the old one so
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> -	b[0] = MI_BATCH_BUFFER_START | (len - 2);
> -	b[len] = MI_BATCH_BUFFER_END;
> -	b[len+1] = MI_NOOP;
> +	}
> +	b[len++] = MI_BATCH_BUFFER_END;
> +	b[len] = MI_NOOP;
>  	gem_write(fd, exec.handle, 0, b, sizeof(b));
>  
>  	reloc.offset = sizeof(uint32_t);
> @@ -364,8 +379,7 @@ void igt_post_hang_ring(int fd, igt_hang_t arg)
>  	if (arg.handle == 0)
>  		return;
>  
> -	gem_set_domain(fd, arg.handle,
> -		       I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
> +	gem_sync(fd, arg.handle);
>  	gem_close(fd, arg.handle);
>  
>  	context_set_ban(fd, arg.ctx, arg.ban);
> -- 
> 2.16.2
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
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

* Re: [igt-dev] [Intel-gfx] [PATCH igt] lib: Fix MI_BATCH_BUFFER_START for hang injection
  2018-03-02 17:09 ` [Intel-gfx] " Ville Syrjälä
@ 2018-03-02 19:06   ` Chris Wilson
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2018-03-02 19:06 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: igt-dev, intel-gfx

Quoting Ville Syrjälä (2018-03-02 17:09:29)
> On Fri, Mar 02, 2018 at 04:13:46PM +0000, Chris Wilson wrote:
> > A couple of bugs inside the hang injector, the worst being that the
> > presumed_offset of the reloc didn't match the batch; so if the reloc was
> > skipped (as the presumed_offset matched the reloc offset), the batch
> > wasn't updated and so we may not have generated a hanging batch at all!
> > Secondly, the MI_BATCH_BUFFER_START was not correct for all gen.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > ---
> >  lib/igt_gt.c | 28 +++++++++++++++++++++-------
> >  1 file changed, 21 insertions(+), 7 deletions(-)
> > 
> > diff --git a/lib/igt_gt.c b/lib/igt_gt.c
> > index e630550b..799ca1ae 100644
> > --- a/lib/igt_gt.c
> > +++ b/lib/igt_gt.c
> > @@ -276,6 +276,7 @@ igt_hang_t igt_hang_ctx(int fd,
> >       uint32_t b[16];
> >       unsigned ban;
> >       unsigned len;
> > +     int gen;
> >  
> >       igt_require_hang_ring(fd, ring);
> >  
> > @@ -310,12 +311,26 @@ igt_hang_t igt_hang_ctx(int fd,
> >  
> >       memset(b, 0xc5, sizeof(b));
> >  
> > -     len = 2;
> > -     if (intel_gen(intel_get_drm_devid(fd)) >= 8)
> > +     len = 0;
> > +     gen = intel_gen(intel_get_drm_devid(fd));
> > +     if (gen >= 8) {
> > +             b[len++] = MI_BATCH_BUFFER_START | 1 << 8 | 1;
> > +             b[len++] = 0;
> > +             b[len++] = 0;
> > +     } else if (gen >= 6) {
> > +             b[len++] = MI_BATCH_BUFFER_START | 1 << 8;
> > +             b[len++] = 0;
> 
> ppgtt for gen6+
> 
> > +     } else {
> > +             b[len++] = MI_BATCH_BUFFER_START | 2 << 6;
> > +             b[len] = 0;
> > +             if (gen < 4) {
> > +                     b[len] |= 1;
> > +                     reloc.delta = 1;
> > +             }
> >               len++;
> 
> gtt secure for gen4/5
> gtt non-secure for gen2/3
> 
> How does the security thing work on ctg/ilk for chained batches? The spec
> is a wee bit unclear. It says the security bit for chained batches is
> ignored, but then it also says non-secure batches can't access the gtt.
> That was the case for MI_STORE_DWORD if I recall your earlier patch
> correctly. So if we don't execute the first batch as secure the chained
> MI_BB_START gets nopped out maybe?

Yes, as soon as we lose the privilege bit (usually when the kernel does
the first MI_BB to us), we can regain privilege in this batch chain. How
this works with the ppgtt is a mystery, but it also functions
differently if it's not enabled.
 
> Hmm. Now I wonder how the earlier MI_STORE_DWORD thing worked on pre-ctg
> with a non-secure batch? Wasn't the hardware supposed to nop those out
> entirely? /me confused

Aiui, before ctg/ilk they remained unprivileged ops.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.BAT: success for lib: Fix MI_BATCH_BUFFER_START for hang injection
  2018-03-02 16:13 [igt-dev] [PATCH igt] lib: Fix MI_BATCH_BUFFER_START for hang injection Chris Wilson
  2018-03-02 17:09 ` [Intel-gfx] " Ville Syrjälä
@ 2018-03-02 20:35 ` Patchwork
  2018-03-03  0:08 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-03-02 20:35 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: lib: Fix MI_BATCH_BUFFER_START for hang injection
URL   : https://patchwork.freedesktop.org/series/39292/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
bddfb8dd3c1767f13d2af578d5c3d897fddf0dcd igt/gem_ctx_switch: Exercise all engines at once

with latest DRM-Tip kernel build CI_DRM_3867
4f4e4dd52a30 drm-tip: 2018y-03m-02d-16h-28m-21s UTC integration manifest

No testlist changes.

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:418s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:430s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:373s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:485s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:279s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:479s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:487s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:468s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:460s
fi-cfl-8700k     total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:391s
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:559s
fi-cfl-u         total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:503s
fi-elk-e7500     total:288  pass:229  dwarn:0   dfail:0   fail:0   skip:59  time:409s
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:288s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:508s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:394s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:416s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:447s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:410s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:450s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:492s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:449s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:494s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:587s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:425s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:502s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:517s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:488s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:473s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:411s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:428s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:526s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:400s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1048/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.IGT: success for lib: Fix MI_BATCH_BUFFER_START for hang injection
  2018-03-02 16:13 [igt-dev] [PATCH igt] lib: Fix MI_BATCH_BUFFER_START for hang injection Chris Wilson
  2018-03-02 17:09 ` [Intel-gfx] " Ville Syrjälä
  2018-03-02 20:35 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
@ 2018-03-03  0:08 ` Patchwork
  2 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2018-03-03  0:08 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: lib: Fix MI_BATCH_BUFFER_START for hang injection
URL   : https://patchwork.freedesktop.org/series/39292/
State : success

== Summary ==

---- Possible new issues:

Test pm_rc6_residency:
        Subgroup rc6-accuracy:
                skip       -> PASS       (shard-snb)

---- Known issues:

Test kms_chv_cursor_fail:
        Subgroup pipe-b-256x256-bottom-edge:
                dmesg-warn -> PASS       (shard-snb) fdo#105185 +1
Test kms_fbcon_fbt:
        Subgroup fbc-suspend:
                incomplete -> PASS       (shard-hsw) fdo#105087
Test kms_flip:
        Subgroup 2x-flip-vs-expired-vblank-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#102887
Test kms_frontbuffer_tracking:
        Subgroup fbc-suspend:
                pass       -> INCOMPLETE (shard-hsw) fdo#103540
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-a:
                pass       -> INCOMPLETE (shard-snb) fdo#103375
Test kms_rotation_crc:
        Subgroup primary-rotation-180:
                pass       -> FAIL       (shard-snb) fdo#103925 +1

fdo#105185 https://bugs.freedesktop.org/show_bug.cgi?id=105185
fdo#105087 https://bugs.freedesktop.org/show_bug.cgi?id=105087
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925

shard-apl        total:3463 pass:1821 dwarn:1   dfail:0   fail:7   skip:1632 time:11902s
shard-hsw        total:3407 pass:1742 dwarn:1   dfail:0   fail:2   skip:1660 time:11514s
shard-snb        total:3372 pass:1322 dwarn:2   dfail:0   fail:3   skip:2044 time:6805s
Blacklisted hosts:
shard-kbl        total:3349 pass:1878 dwarn:1   dfail:0   fail:7   skip:1461 time:8856s

== Logs ==

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

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

end of thread, other threads:[~2018-03-03  0:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-02 16:13 [igt-dev] [PATCH igt] lib: Fix MI_BATCH_BUFFER_START for hang injection Chris Wilson
2018-03-02 17:09 ` [Intel-gfx] " Ville Syrjälä
2018-03-02 19:06   ` [igt-dev] " Chris Wilson
2018-03-02 20:35 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-03-03  0:08 ` [igt-dev] ✓ 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