All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Tvrtko Ursulin <tursulin@ursulin.net>, igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v2] tests/perf_pmu: Improve accuracy by waiting on spinner to start
Date: Thu, 15 Mar 2018 16:01:47 +0000	[thread overview]
Message-ID: <152112970795.25315.3159070975692005147@mail.alporthouse.com> (raw)
In-Reply-To: <20180315154600.13728-1-tvrtko.ursulin@linux.intel.com>

Quoting Tvrtko Ursulin (2018-03-15 15:46:00)
>  static void
> -__submit_spin_batch(int gem_fd,
> -                   struct drm_i915_gem_exec_object2 *obj,
> +__submit_spin_batch(int gem_fd, igt_spin_t *spin,
>                     const struct intel_execution_engine2 *e)
>  {
> -       struct drm_i915_gem_execbuffer2 eb = {
> -               .buffer_count = 1,
> -               .buffers_ptr = to_user_pointer(obj),
> -               .flags = e2ring(gem_fd, e),
> -       };
> +       struct drm_i915_gem_execbuffer2 eb = spin->execbuf;
> +
> +       eb.flags &= ~(0x3f | I915_EXEC_BSD_MASK);
> +       eb.flags |= e2ring(gem_fd, e);

I'm dubious about keeping spin->execbuf for precisely this reason.
Almost all the time I want to specify a different execution, and not use
the same context, random fences, etc.

However, it does give a convenient way to get buffers_count and
buffers_ptr, but that is all that is valid (imo) or at least should be
judiciously copied from rather than wholesale.

eb = {
	.buffers_ptr = spin->execbuf.buffers_ptr,
	.buffer_count = spin->execbuf.buffer_count,
	.flags = e2ring(gem_fd, e) | I915_EXEC_NORELOC,
};

> @@ -1545,24 +1575,30 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
>  
>                         igt_nsec_elapsed(&test_start);
>                         do {
> -                               unsigned int target_idle_us, t_busy;
> +                               unsigned int target_idle_us;
> +                               struct timespec start = { };
> +                               unsigned long prep_delay_ns;
>  
>                                 /* Restart the spinbatch. */
> +                               igt_nsec_elapsed(&start);
>                                 __rearm_spin_batch(spin);
> -                               __submit_spin_batch(gem_fd, &obj, e);
> +                               __submit_spin_batch(gem_fd, spin, e);
>  
> -                               /*
> -                                * Note that the submission may be delayed to a
> -                                * tasklet (ksoftirqd) which cannot run until we
> -                                * sleep as we hog the cpu (we are RT).
> -                                */
> +                                /* Wait for batch to start executing. */
> +                               __spin_wait(gem_fd, spin);
> +                               prep_delay_ns = igt_nsec_elapsed(&start);
>  
> -                               t_busy = measured_usleep(busy_us);
> +                               /* PWM busy sleep. */
> +                               memset(&start, 0, sizeof(start));
> +                               igt_nsec_elapsed(&start);

Can just keep using start, it's already has the current time from
calculating prep_delay_ns.

> +                               measured_usleep(busy_us);
>                                 igt_spin_batch_end(spin);
> -                               gem_sync(gem_fd, obj.handle);
> +                               gem_sync(gem_fd, spin->handle);
>  
> -                               total_busy_ns += t_busy;
> +                               total_busy_ns += igt_nsec_elapsed(&start);
> +                               total_idle_ns += prep_delay_ns;

Ok.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Tvrtko Ursulin <tursulin@ursulin.net>, igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t v2] tests/perf_pmu: Improve accuracy by waiting on spinner to start
Date: Thu, 15 Mar 2018 16:01:47 +0000	[thread overview]
Message-ID: <152112970795.25315.3159070975692005147@mail.alporthouse.com> (raw)
In-Reply-To: <20180315154600.13728-1-tvrtko.ursulin@linux.intel.com>

Quoting Tvrtko Ursulin (2018-03-15 15:46:00)
>  static void
> -__submit_spin_batch(int gem_fd,
> -                   struct drm_i915_gem_exec_object2 *obj,
> +__submit_spin_batch(int gem_fd, igt_spin_t *spin,
>                     const struct intel_execution_engine2 *e)
>  {
> -       struct drm_i915_gem_execbuffer2 eb = {
> -               .buffer_count = 1,
> -               .buffers_ptr = to_user_pointer(obj),
> -               .flags = e2ring(gem_fd, e),
> -       };
> +       struct drm_i915_gem_execbuffer2 eb = spin->execbuf;
> +
> +       eb.flags &= ~(0x3f | I915_EXEC_BSD_MASK);
> +       eb.flags |= e2ring(gem_fd, e);

I'm dubious about keeping spin->execbuf for precisely this reason.
Almost all the time I want to specify a different execution, and not use
the same context, random fences, etc.

However, it does give a convenient way to get buffers_count and
buffers_ptr, but that is all that is valid (imo) or at least should be
judiciously copied from rather than wholesale.

eb = {
	.buffers_ptr = spin->execbuf.buffers_ptr,
	.buffer_count = spin->execbuf.buffer_count,
	.flags = e2ring(gem_fd, e) | I915_EXEC_NORELOC,
};

> @@ -1545,24 +1575,30 @@ accuracy(int gem_fd, const struct intel_execution_engine2 *e,
>  
>                         igt_nsec_elapsed(&test_start);
>                         do {
> -                               unsigned int target_idle_us, t_busy;
> +                               unsigned int target_idle_us;
> +                               struct timespec start = { };
> +                               unsigned long prep_delay_ns;
>  
>                                 /* Restart the spinbatch. */
> +                               igt_nsec_elapsed(&start);
>                                 __rearm_spin_batch(spin);
> -                               __submit_spin_batch(gem_fd, &obj, e);
> +                               __submit_spin_batch(gem_fd, spin, e);
>  
> -                               /*
> -                                * Note that the submission may be delayed to a
> -                                * tasklet (ksoftirqd) which cannot run until we
> -                                * sleep as we hog the cpu (we are RT).
> -                                */
> +                                /* Wait for batch to start executing. */
> +                               __spin_wait(gem_fd, spin);
> +                               prep_delay_ns = igt_nsec_elapsed(&start);
>  
> -                               t_busy = measured_usleep(busy_us);
> +                               /* PWM busy sleep. */
> +                               memset(&start, 0, sizeof(start));
> +                               igt_nsec_elapsed(&start);

Can just keep using start, it's already has the current time from
calculating prep_delay_ns.

> +                               measured_usleep(busy_us);
>                                 igt_spin_batch_end(spin);
> -                               gem_sync(gem_fd, obj.handle);
> +                               gem_sync(gem_fd, spin->handle);
>  
> -                               total_busy_ns += t_busy;
> +                               total_busy_ns += igt_nsec_elapsed(&start);
> +                               total_idle_ns += prep_delay_ns;

Ok.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-03-15 16:01 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-15 12:56 [PATCH i-g-t] tests/perf_pmu: Improve accuracy by waiting on spinner to start Tvrtko Ursulin
2018-03-15 12:56 ` [igt-dev] " Tvrtko Ursulin
2018-03-15 13:14 ` Chris Wilson
2018-03-15 13:14   ` Chris Wilson
2018-03-15 13:36   ` Tvrtko Ursulin
2018-03-15 13:36     ` Tvrtko Ursulin
2018-03-15 13:45     ` Chris Wilson
2018-03-15 13:45       ` [Intel-gfx] " Chris Wilson
2018-03-15 14:37       ` Tvrtko Ursulin
2018-03-15 14:37         ` Tvrtko Ursulin
2018-03-15 14:46         ` Chris Wilson
2018-03-15 14:46           ` Chris Wilson
2018-03-15 14:53           ` Tvrtko Ursulin
2018-03-15 14:53             ` [Intel-gfx] " Tvrtko Ursulin
2018-03-15 14:58             ` Chris Wilson
2018-03-15 14:58               ` Chris Wilson
2018-03-15 14:03 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-03-15 15:46 ` [PATCH i-g-t v2] " Tvrtko Ursulin
2018-03-15 15:46   ` [Intel-gfx] " Tvrtko Ursulin
2018-03-15 16:01   ` Chris Wilson [this message]
2018-03-15 16:01     ` [igt-dev] " Chris Wilson
2018-03-16  7:36     ` [PATCH i-g-t v3] " Tvrtko Ursulin
2018-03-16  7:36       ` [igt-dev] " Tvrtko Ursulin
2018-03-16 10:17       ` [PATCH i-g-t v4] " Tvrtko Ursulin
2018-03-16 10:17         ` [igt-dev] " Tvrtko Ursulin
2018-03-16 12:18         ` [PATCH i-g-t v5] " Tvrtko Ursulin
2018-03-16 12:18           ` [igt-dev] " Tvrtko Ursulin
2018-03-16 13:31           ` [PATCH i-g-t v6] " Tvrtko Ursulin
2018-03-16 13:31             ` [Intel-gfx] " Tvrtko Ursulin
2018-03-19 13:56             ` [PATCH i-g-t v7] " Tvrtko Ursulin
2018-03-19 13:56               ` [Intel-gfx] " Tvrtko Ursulin
2018-03-19 14:02               ` Chris Wilson
2018-03-19 14:02                 ` [igt-dev] [Intel-gfx] " Chris Wilson
2018-03-19 15:29               ` Chris Wilson
2018-03-19 15:29                 ` [igt-dev] [Intel-gfx] " Chris Wilson
2018-03-19 15:33                 ` Chris Wilson
2018-03-19 15:33                   ` [igt-dev] [Intel-gfx] " Chris Wilson
2018-03-19 16:59                   ` [PATCH i-g-t v8] " Tvrtko Ursulin
2018-03-19 16:59                     ` [igt-dev] " Tvrtko Ursulin
2018-03-20 13:51                     ` [PATCH i-g-t v9] " Tvrtko Ursulin
2018-03-20 13:51                       ` [igt-dev] " Tvrtko Ursulin
2018-03-15 16:35 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork
2018-03-15 16:49 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/perf_pmu: Improve accuracy by waiting on spinner to start (rev2) Patchwork
2018-03-16  8:02 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/perf_pmu: Improve accuracy by waiting on spinner to start (rev3) Patchwork
2018-03-16  8:52 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-03-16 11:20 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/perf_pmu: Improve accuracy by waiting on spinner to start (rev4) Patchwork
2018-03-16 12:27 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-03-16 14:30 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/perf_pmu: Improve accuracy by waiting on spinner to start (rev6) Patchwork
2018-03-19 10:24 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-03-19 21:12 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/perf_pmu: Improve accuracy by waiting on spinner to start (rev9) Patchwork
2018-03-20  0:26 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-03-20 17:12 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/perf_pmu: Improve accuracy by waiting on spinner to start (rev10) Patchwork
2018-03-20 20:31 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=152112970795.25315.3159070975692005147@mail.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tursulin@ursulin.net \
    /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.