Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	igt-dev@lists.freedesktop.org
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 6/9] tests/perf_pmu: PMU enable race test
Date: Mon, 5 Feb 2018 10:07:02 +0000	[thread overview]
Message-ID: <77724920-b34e-a10e-509e-32640dfb6b5a@linux.intel.com> (raw)
In-Reply-To: <151760476672.15322.10668358533953843463@mail.alporthouse.com>


On 02/02/2018 20:52, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-02-02 18:37:51)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> Test that the PMU can be safely enabled in face of interrupt-heavy load on
>> an engine.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>>   tests/perf_pmu.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 52 insertions(+)
>>
>> diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
>> index 27f32b8a1602..de0a1c7d936c 100644
>> --- a/tests/perf_pmu.c
>> +++ b/tests/perf_pmu.c
>> @@ -1221,6 +1221,51 @@ test_rc6(int gem_fd)
>>          assert_within_epsilon(busy - prev, 0.0, tolerance);
>>   }
>>   
>> +static void
>> +test_enable_race(int gem_fd, const struct intel_execution_engine2 *e)
>> +{
>> +       uint64_t config = I915_PMU_ENGINE_BUSY(e->class, e->instance);
>> +       struct igt_helper_process engine_load = { };
>> +       const uint32_t bbend = MI_BATCH_BUFFER_END;
>> +       struct drm_i915_gem_exec_object2 obj = { };
>> +       struct drm_i915_gem_execbuffer2 eb = { };
>> +       int fd;
>> +
>> +       igt_require(intel_gen(intel_get_drm_devid(gem_fd)) >= 8);
> 
> 	igt_require(gem_has_execlists(gem_fd));
> 
> may be clearer, it's still a proxy for has_stats. :|

Better, yes.

> 
>> +       igt_require(gem_has_engine(gem_fd, e->class, e->instance));
>> +
>> +       obj.handle = gem_create(gem_fd, 4096);
>> +       gem_write(gem_fd, obj.handle, 0, &bbend, sizeof(bbend));
>> +
>> +       eb.buffer_count = 1;
>> +       eb.buffers_ptr = to_user_pointer(&obj);
>> +       eb.flags = e2ring(gem_fd, e);
>> +
>> +       /*
>> +        * Defeat the busy stats delayed disable, we need to guarantee we are
>> +        * the first user.
>> +        */
> 
> gem_quiescent_gpu(); as well?

Can do.

>> +       sleep(2);
>> +
>> +       /* Apply interrupt-heavy load on the engine. */
> 
> s/load/nop load/ ?
> 
>> +       igt_fork_helper(&engine_load) {
>> +               for (;;)
>> +                       gem_execbuf(gem_fd, &eb);
>> +       }
>> +
>> +       /* Wait a bit to allow engine load to start. */
>> +       usleep(500e3);
> 
> .5s, I guess we aren't too concerned with paring it down to the
> minimum here as we've already spent 2s for idling.
> 
>> +
>> +       /* Enable the PMU. */
>> +       fd = open_pmu(config);
> 
> fd = -1;
> igt_until_timeout(1) {
> 	close(fd);
> 	fd = open_pmu(config);
> }
> 
> It's a race, so don't expect it to happen first time?

Definitely don't, but the delayed disable currently makes it hard to 
test (slow).

> 
>> +       /* Cleanup. */
>> +       igt_stop_helper(&engine_load);
>> +       close(fd);
> 
> Another race, right? Wrap it all in a 10x loop? Or separate out the
> close race to another lop.

Don't think so, disable is done from the delayed worker already.

> 
>> +       gem_close(gem_fd, obj.handle);
>> +       gem_quiescent_gpu(gem_fd);
>> +}
> 
> The gist of the test looks fine, so please consider exercising the race
> more than once and with that have a
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

I can wrap it in a 10x loop but until the PMU is fixed that means 10x 
longer runtime as well which I wanted to avoid, and instead count on 
execution in numbers across the shards.

Regards,

Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2018-02-05 10:07 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02 18:37 [igt-dev] [PATCH v2 i-g-t 0/9] perf_pmu reliability improvements Tvrtko Ursulin
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 1/9] tests/perf_pmu: Tighten busy measurement Tvrtko Ursulin
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 2/9] tests/perf_pmu: More busy measurement tightening Tvrtko Ursulin
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 3/9] tests/perf_pmu: Use measured sleep in all time based tests Tvrtko Ursulin
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 4/9] tests/perf_pmu: Convert to flags Tvrtko Ursulin
2018-02-02 20:39   ` Chris Wilson
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 5/9] tests/perf_pmu: Add trailing edge idle test variants Tvrtko Ursulin
2018-02-02 20:45   ` Chris Wilson
2018-02-05 10:32     ` Tvrtko Ursulin
2018-02-05 11:36     ` [igt-dev] [PATCH i-g-t v2 " Tvrtko Ursulin
2018-02-05 14:08       ` Chris Wilson
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 6/9] tests/perf_pmu: PMU enable race test Tvrtko Ursulin
2018-02-02 20:52   ` Chris Wilson
2018-02-05 10:07     ` Tvrtko Ursulin [this message]
2018-02-05 10:16       ` Chris Wilson
2018-02-05 10:40         ` Tvrtko Ursulin
2018-02-05 14:11           ` Chris Wilson
2018-02-05 15:01             ` [igt-dev] [PATCH i-g-t v3 " Tvrtko Ursulin
2018-02-05 11:36     ` [igt-dev] [PATCH i-g-t v2 " Tvrtko Ursulin
2018-02-05 14:12       ` Chris Wilson
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 7/9] tests/perf_pmu: Always skip missing engines Tvrtko Ursulin
2018-02-02 20:54   ` Chris Wilson
2018-02-05 11:37     ` [igt-dev] [PATCH i-g-t v2 " Tvrtko Ursulin
2018-02-05 14:13       ` Chris Wilson
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 8/9] tests/perf_pmu: Explicitly test for engine availability in init tests Tvrtko Ursulin
2018-02-02 20:57   ` Chris Wilson
2018-02-05 11:37     ` [igt-dev] [PATCH i-g-t v2 " Tvrtko Ursulin
2018-02-05 14:14       ` Chris Wilson
2018-02-05 15:02         ` [igt-dev] [PATCH i-g-t v3 " Tvrtko Ursulin
2018-02-02 18:37 ` [igt-dev] [PATCH i-g-t 9/9] tests/perf_pmu: Use short batches from hotplug test Tvrtko Ursulin
2018-02-02 21:43   ` Chris Wilson
2018-02-05 11:38     ` [igt-dev] [PATCH i-g-t v2 " Tvrtko Ursulin
2018-02-05 14:37       ` Chris Wilson
2018-02-05 11:59     ` [igt-dev] [PATCH i-g-t " Tvrtko Ursulin
2018-02-02 19:18 ` [igt-dev] ✓ Fi.CI.BAT: success for perf_pmu reliability improvements (rev2) Patchwork
2018-02-02 22:20 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-02-05 12:12 ` [igt-dev] ✓ Fi.CI.BAT: success for perf_pmu reliability improvements (rev7) Patchwork
2018-02-05 13:55 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-02-05 15:21 ` [igt-dev] ✓ Fi.CI.BAT: success for perf_pmu reliability improvements (rev9) Patchwork
2018-02-05 17:35 ` [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=77724920-b34e-a10e-509e-32640dfb6b5a@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=tursulin@ursulin.net \
    --cc=tvrtko.ursulin@intel.com \
    /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