All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH igt 3/9] igt/drv_hangman: Inject a true hang
Date: Wed, 16 Dec 2015 10:02:27 +0100	[thread overview]
Message-ID: <20151216090227.GH30437@phenom.ffwll.local> (raw)
In-Reply-To: <1449950575-21012-3-git-send-email-chris@chris-wilson.co.uk>

On Sat, Dec 12, 2015 at 08:02:49PM +0000, Chris Wilson wrote:
> Wean drv_hangman off the atrocious stop_rings and use a real GPU hang
> instead.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Doesn't this kill pre-gen6? Or at least anything where we don't have
proper hang recovery ... Lack of that is why I've done the original
stop_rings fun.
-Daniel

> ---
>  tests/drv_hangman.c | 66 ++++++++++++-----------------------------------------
>  1 file changed, 14 insertions(+), 52 deletions(-)
> 
> diff --git a/tests/drv_hangman.c b/tests/drv_hangman.c
> index cd63b97..866d9dc 100644
> --- a/tests/drv_hangman.c
> +++ b/tests/drv_hangman.c
> @@ -147,59 +147,21 @@ static void assert_error_state_collected(void)
>  	assert_dfs_entry_not("i915_error_state", "no error state collected");
>  }
>  
> -#define MAGIC_NUMBER 0x10001
> -const uint32_t batch[] = { MI_NOOP,
> -			   MI_BATCH_BUFFER_END,
> -			   MAGIC_NUMBER,
> -			   MAGIC_NUMBER };
> +const uint32_t *batch;
>  
> -static uint64_t submit_batch(int fd, unsigned ring_id, bool stop_ring)
> +static uint64_t submit_hang(int fd, unsigned ring_id)
>  {
> -	struct drm_i915_gem_execbuffer2 execbuf;
> -	struct drm_i915_gem_exec_object2 exec;
> -	uint64_t presumed_offset;
> -
> -	gem_require_ring(fd, ring_id);
> -
> -	exec.handle = gem_create(fd, 4096);
> -	gem_write(fd, exec.handle, 0, batch, sizeof(batch));
> -	exec.relocation_count = 0;
> -	exec.relocs_ptr = 0;
> -	exec.alignment = 0;
> -	exec.offset = 0;
> -	exec.flags = 0;
> -	exec.rsvd1 = 0;
> -	exec.rsvd2 = 0;
> -
> -	execbuf.buffers_ptr = (uintptr_t)&exec;
> -	execbuf.buffer_count = 1;
> -	execbuf.batch_start_offset = 0;
> -	execbuf.batch_len = sizeof(batch);
> -	execbuf.cliprects_ptr = 0;
> -	execbuf.num_cliprects = 0;
> -	execbuf.DR1 = 0;
> -	execbuf.DR4 = 0;
> -	execbuf.flags = ring_id;
> -	i915_execbuffer2_set_context_id(execbuf, 0);
> -	execbuf.rsvd2 = 0;
> -
> -	gem_execbuf(fd, &execbuf);
> -	gem_sync(fd, exec.handle);
> -	presumed_offset = exec.offset;
> -
> -	if (stop_ring) {
> -		igt_set_stop_rings(igt_to_stop_ring_flag(ring_id));
> -
> -		gem_execbuf(fd, &execbuf);
> -		gem_sync(fd, exec.handle);
> -
> -		igt_assert(igt_get_stop_rings() == STOP_RING_NONE);
> -		igt_assert(presumed_offset == exec.offset);
> -	}
> +	uint64_t offset;
> +	igt_hang_ring_t hang;
> +
> +	hang = igt_hang_ctx(fd, 0, ring_id, HANG_ALLOW_CAPTURE, &offset);
> +
> +	batch = gem_mmap__cpu(fd, hang.handle, 0, 4096, PROT_READ);
> +	gem_set_domain(fd, hang.handle, I915_GEM_DOMAIN_CPU, 0);
>  
> -	gem_close(fd, exec.handle);
> +	igt_post_hang_ring(fd, hang);
>  
> -	return exec.offset;
> +	return offset;
>  }
>  
>  static void clear_error_state(void)
> @@ -222,7 +184,7 @@ static void test_error_state_basic(void)
>  	clear_error_state();
>  	assert_error_state_clear();
>  
> -	submit_batch(fd, I915_EXEC_RENDER, true);
> +	submit_hang(fd, I915_EXEC_RENDER);
>  	close(fd);
>  
>  	assert_error_state_collected();
> @@ -276,7 +238,7 @@ static void check_error_state(const int gen,
>  			if (!uses_cmd_parser)
>  				igt_assert(gtt_offset == expected_offset);
>  
> -			for (i = 0; i < sizeof(batch) / 4; i++) {
> +			for (i = 0; i < 1024; i++) {
>  				igt_assert(getline(&line, &line_size, file) > 0);
>  				snprintf(expected_line, sizeof(expected_line), "%08x :  %08x",
>  					 4*i, batch[i]);
> @@ -381,7 +343,7 @@ static void test_error_state_capture(unsigned ring_id,
>  	gen = intel_gen(intel_get_drm_devid(fd));
>  	cmd_parser = uses_cmd_parser(fd, gen);
>  
> -	offset = submit_batch(fd, ring_id, true);
> +	offset = submit_hang(fd, ring_id);
>  	close(fd);
>  
>  	check_error_state(gen, cmd_parser, ring_name, offset);
> -- 
> 2.6.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-12-16  9:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-12 20:02 [PATCH igt 1/9] lib: Always double check igt_require_hang_ring() on use Chris Wilson
2015-12-12 20:02 ` [PATCH igt 2/9] lib: Expand igt_hang_ring() to select target context and various options Chris Wilson
2015-12-12 20:02 ` [PATCH igt 3/9] igt/drv_hangman: Inject a true hang Chris Wilson
2015-12-16  9:02   ` Daniel Vetter [this message]
2015-12-16 10:37     ` Chris Wilson
2015-12-16 13:12       ` Ville Syrjälä
2015-12-16 13:51         ` Chris Wilson
2015-12-16 14:03           ` Chris Wilson
2015-12-12 20:02 ` [PATCH igt 4/9] igt/gem_ctx_exec: Convert from stop-rings to a real GPU hang/reset Chris Wilson
2015-12-12 20:02 ` [PATCH igt 5/9] igt/gem_reset_stats: Convert from stop-rings to real hang injection Chris Wilson
2015-12-12 20:02 ` [PATCH igt 6/9] igt/kms_pipe_crc_basic: Replace stop_rings with igt_hang_ring Chris Wilson
2015-12-12 20:02 ` [PATCH igt 7/9] igt/kms_flip: Convert over to real hang injection Chris Wilson
2015-12-12 20:02 ` [PATCH igt 8/9] igt/gem_workarounds: Convert to real GPU " Chris Wilson
2015-12-12 20:02 ` [PATCH igt 9/9] igt/pm_rps: Trigger a real GPU reset Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151216090227.GH30437@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.