[Intel-gfx] [PATCH igt 2/2] igt/gem_exec_nop: Measure high-priority throughput over a bg load

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Fri Sep 29 08:27:04 UTC 2017


On Thu, 2017-09-28 at 18:26 +0100, Chris Wilson wrote:
> Measure how many high priority batches we can execute whilst running a
> bg spinner.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

<SNIP>

> @@ -582,6 +592,79 @@ static void fence_signal(int fd, uint32_t handle,
>  	igt_info("Signal %s: %'lu cycles (%'lu signals): %.3fus\n",
>  		 ring_name, count, signal, elapsed(&start, &now) * 1e6 / count);
>  }
> +static int __ctx_set_priority(int fd, uint32_t ctx, int prio)
> +{
> +	struct local_i915_gem_context_param param;
> +
> +	memset(&param, 0, sizeof(param));
> +	param.context = ctx;
> +	param.size = 0;
> +	param.param = LOCAL_CONTEXT_PARAM_PRIORITY;
> +	param.value = prio;
> +
> +	return __gem_context_set_param(fd, &param);
> +}
> +
> +static void ctx_set_priority(int fd, uint32_t ctx, int prio)
> +{
> +	igt_assert_eq(__ctx_set_priority(fd, ctx, prio), 0);
> +}
> +

I smell a lib/ function for this and the defines.

Maybe throw the commit message as a comment here.

> +static void preempt(int fd, uint32_t handle,
> +		   unsigned ring_id, const char *ring_name)
> +{
> +	struct drm_i915_gem_execbuffer2 execbuf;
> +	struct drm_i915_gem_exec_object2 obj;
> +	struct timespec start, now;
> +	unsigned long count;
> +	uint32_t ctx[2];
> +
> +	gem_require_ring(fd, ring_id);
> +
> +	ctx[0] = gem_context_create(fd);
> +	ctx_set_priority(fd, ctx[0], MIN_PRIO);
> +
> +	ctx[1] = gem_context_create(fd);
> +	ctx_set_priority(fd, ctx[1], MAX_PRIO);
> +
> +	memset(&obj, 0, sizeof(obj));
> +	obj.handle = handle;
> +
> +	memset(&execbuf, 0, sizeof(execbuf));
> +	execbuf.buffers_ptr = to_user_pointer(&obj);
> +	execbuf.buffer_count = 1;
> +	execbuf.flags = ring_id;
> +	execbuf.flags |= LOCAL_I915_EXEC_HANDLE_LUT;
> +	execbuf.flags |= LOCAL_I915_EXEC_NO_RELOC;
> +	if (__gem_execbuf(fd, &execbuf)) {
> +		execbuf.flags = ring_id;
> +		gem_execbuf(fd, &execbuf);
> +	}
> +	execbuf.rsvd1 = ctx[1];
> +	intel_detect_and_clear_missed_interrupts(fd);
> +
> +	count = 0;
> +	clock_gettime(CLOCK_MONOTONIC, &start);
> +	do {
> +		igt_spin_t *spin =
> +			__igt_spin_batch_new(fd, ctx[0], ring_id, 0);
> +
> +		for (int loop = 0; loop < 1024; loop++)
> +			gem_execbuf(fd, &execbuf);
> +
> +		igt_spin_batch_free(fd, spin);
> +
> +		count += 1024;

"count += loop" would make so much sense.

Would be an interesting statistic to know how many times the the
spinner got to ELSP.

> +static unsigned int has_scheduler(int fd)
> +{
> +	drm_i915_getparam_t gp;
> +	unsigned int caps = 0;
> +
> +	gp.param = LOCAL_PARAM_HAS_SCHEDULER;
> +	gp.value = (int *)∩︀
> +	drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
> +
> +	if (!caps)
> +		return 0;
> +
> +	igt_info("Has kernel scheduler\n");
> +	if (caps & HAS_PRIORITY)
> +		igt_info(" - With priority sorting\n");
> +	if (caps & HAS_PREEMPTION)
> +		igt_info(" - With preemption enabled\n");
> +
> +	return caps;
> +}

lib/ material again

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list