public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH igt 03/10] igt/gem_ctx_switch: Exercise all engines at once
Date: Mon, 31 Jul 2017 10:57:23 +0100	[thread overview]
Message-ID: <25a0a446-c8d1-c00d-4df8-1896a203c0bc@linux.intel.com> (raw)
In-Reply-To: <20170728120808.25824-3-chris@chris-wilson.co.uk>


On 28/07/2017 13:08, Chris Wilson wrote:
> Just a small variant to apply a continuous context-switch load to all
> engines.
> ---
>   tests/gem_ctx_switch.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 80 insertions(+)
> 
> diff --git a/tests/gem_ctx_switch.c b/tests/gem_ctx_switch.c
> index b6ea71cf..df22efec 100644
> --- a/tests/gem_ctx_switch.c
> +++ b/tests/gem_ctx_switch.c
> @@ -140,6 +140,81 @@ static void single(int fd, uint32_t handle,
>   		gem_context_destroy(fd, contexts[n]);
>   }
>   
> +static void all(int fd, uint32_t handle, unsigned flags, int timeout)
> +{
> +	struct drm_i915_gem_execbuffer2 execbuf;
> +	struct drm_i915_gem_exec_object2 obj[2];
> +	unsigned int engine[16], e;

Need to add MAX_ENGINES somewhere in lib/ for maintainability.

> +	const char *name[16];
> +	uint32_t contexts[64];
> +	unsigned int nengine;
> +	int n;
> +
> +	nengine = 0;
> +	for_each_engine(fd, e) {
> +		if (e == 0 || e == I915_EXEC_BSD)
> +			continue;

Engine discrimination! :) Why? BSD1 won't work except on large GTs.

Also, if we cannot agree to drop I915_EXEC_DEFAULT from the 
for_each_engine list, I think we at least need to stop the "e == 0" 
magic which is sprinkled around the tests now. Even though this very 
fact demonstrates having it in a list is most often not what is wanted.

Not sure exactly what to suggest as an alternative. for_each_hw_engine? 
real engine? gt engine?

> +
> +		engine[nengine] = e;
> +		name[nengine] = e__->name;
> +		nengine++;
> +	}
> +	igt_require(nengine);
> +
> +	igt_require(__gem_context_create(fd, &contexts[0]) == 0);

Feels to opaque - should we pencil in adding of 
igt_require_context_support or something?

> +	for (n = 1; n < 64; n++)
> +		contexts[n] = gem_context_create(fd);
> +
> +	memset(obj, 0, sizeof(obj));
> +	obj[1].handle = handle;
> +
> +	memset(&execbuf, 0, sizeof(execbuf));
> +	execbuf.buffers_ptr = to_user_pointer(obj + 1);
> +	execbuf.buffer_count = 1;
> +	execbuf.rsvd1 = contexts[0];
> +	execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
> +	execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
> +	igt_require(__gem_execbuf(fd, &execbuf) == 0);
> +	if (__gem_execbuf(fd, &execbuf)) {

Why the same execbuf two times in a row?

> +		execbuf.flags = 0;
> +		gem_execbuf(fd, &execbuf);
> +	}
> +	gem_sync(fd, handle);

What is the purpose of exercising context[0] before the main loop below?

> +	execbuf.buffers_ptr = to_user_pointer(obj);
> +	execbuf.buffer_count = 2;
> +
> +	igt_fork(child, nengine) {
> +		struct timespec start, now;
> +		unsigned int count = 0;
> +
> +		obj[0].handle = gem_create(fd, 4096);
> +		execbuf.flags |= engine[child];
> +		gem_execbuf(fd, &execbuf);
> +		gem_sync(fd, obj[0].handle);
> +
> +		clock_gettime(CLOCK_MONOTONIC, &start);
> +		do {
> +			for (int loop = 0; loop < 64; loop++) {
> +				execbuf.rsvd1 = contexts[loop % 64];
> +				gem_execbuf(fd, &execbuf);
> +			}
> +			count += 64;
> +			clock_gettime(CLOCK_MONOTONIC, &now);
> +		} while (elapsed(&start, &now) < timeout);
> +		gem_sync(fd, obj[0].handle);
> +		clock_gettime(CLOCK_MONOTONIC, &now);
> +		gem_close(fd, obj[0].handle);
> +
> +		igt_info("[%d] %s: %'u cycles: %.3fus%s\n",
> +			 child, name[child], count, elapsed(&start, &now)*1e6 / count,
> +			 flags & INTERRUPTIBLE ? " (interruptible)" : "");
> +	}
> +	igt_waitchildren();
> +
> +	for (n = 0; n < 64; n++)
> +		gem_context_destroy(fd, contexts[n]);
> +}
> +
>   igt_main
>   {
>   	const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
> @@ -177,6 +252,11 @@ igt_main
>   			single(fd, light, e, INTERRUPTIBLE, ncpus, 150);
>   	}
>   
> +	igt_subtest("basic-all")
> +		all(fd, light, 0, 20);
> +	igt_subtest("basic-all-heavy")
> +		all(fd, heavy, 0, 20);
> +
>   	igt_fixture {
>   		igt_stop_hang_detector();
>   		gem_close(fd, heavy);
> 

Regards,

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

  reply	other threads:[~2017-07-31  9:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-28 12:07 [PATCH igt 01/10] tests/prime_rw: Add basic tests for reading/writing to a dmabuf Chris Wilson
2017-07-28 12:08 ` [PATCH igt 02/10] igt/gem_mmap_gtt: Simulate gdb inspecting a GTT mmap using ptrace() Chris Wilson
2017-07-31  9:41   ` Tvrtko Ursulin
2017-07-31 10:17     ` Chris Wilson
2017-07-31 10:39       ` Tvrtko Ursulin
2017-07-28 12:08 ` [PATCH igt 03/10] igt/gem_ctx_switch: Exercise all engines at once Chris Wilson
2017-07-31  9:57   ` Tvrtko Ursulin [this message]
2017-07-28 12:08 ` [PATCH igt 04/10] igt/gem_exec_schedule: Exercise reordering with many priority levels Chris Wilson
2017-07-31 14:35   ` Tvrtko Ursulin
2017-07-31 15:21     ` Chris Wilson
2017-07-31 15:27   ` Michał Winiarski
2017-07-28 12:08 ` [PATCH igt 05/10] igt/drv_hangman: Skip if resets are disallowed Chris Wilson
2017-07-28 13:53   ` Michał Winiarski
2017-07-28 13:59     ` Chris Wilson
2017-07-28 14:01     ` Chris Wilson
2017-07-28 12:08 ` [PATCH igt 06/10] igt/gem_ringfill: Prime execbuf before measuring ring size Chris Wilson
2017-07-31  9:09   ` Michał Winiarski
2017-07-28 12:08 ` [PATCH igt 07/10] igt/gem_exec_suspend: Try to suspend with a pending GPU hang Chris Wilson
2017-07-31  8:58   ` Michał Winiarski
2017-07-31  9:02     ` Chris Wilson
2017-07-28 12:08 ` [PATCH igt 08/10] igt/gem_exec_fence: Exercise merging fences Chris Wilson
2017-07-31  8:26   ` Michał Winiarski
2017-07-31  9:19     ` Chris Wilson
2017-07-28 12:08 ` [PATCH igt 09/10] igt/gem_userptr_blits: Errors from gup are permanent Chris Wilson
2017-07-28 12:33   ` Michał Winiarski
2017-07-28 12:08 ` [PATCH igt 10/10] igt/gem_eio: i915.reset is no longer a boolean Chris Wilson
2017-07-28 13:36   ` Michał Winiarski
2017-07-28 13:50     ` Chris Wilson
2017-07-28 15:56       ` Michał Winiarski
2017-07-31  9:26 ` [PATCH igt 01/10] tests/prime_rw: Add basic tests for reading/writing to a dmabuf Tvrtko Ursulin

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=25a0a446-c8d1-c00d-4df8-1896a203c0bc@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox