From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH igt 2/2] igt/gem_exec_nop: Measure high-priority throughput over a bg load
Date: Fri, 29 Sep 2017 11:27:04 +0300 [thread overview]
Message-ID: <1506673624.4729.22.camel@linux.intel.com> (raw)
In-Reply-To: <20170928172620.6863-2-chris@chris-wilson.co.uk>
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@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(¶m, 0, sizeof(param));
> + param.context = ctx;
> + param.size = 0;
> + param.param = LOCAL_CONTEXT_PARAM_PRIORITY;
> + param.value = prio;
> +
> + return __gem_context_set_param(fd, ¶m);
> +}
> +
> +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@linux.intel.com>
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-09-29 8:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 17:26 [PATCH igt 1/2] igt/gem_sync: Add a preemption test Chris Wilson
2017-09-28 17:26 ` [PATCH igt 2/2] igt/gem_exec_nop: Measure high-priority throughput over a bg load Chris Wilson
2017-09-29 8:27 ` Joonas Lahtinen [this message]
2017-09-28 17:59 ` ✓ Fi.CI.BAT: success for series starting with [1/2] igt/gem_sync: Add a preemption test Patchwork
2017-09-29 8:20 ` [PATCH igt 1/2] " Joonas Lahtinen
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=1506673624.4729.22.camel@linux.intel.com \
--to=joonas.lahtinen@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 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.