intel-gfx.lists.freedesktop.org archive mirror
 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>,
	Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 6/7] drm/i915/pmu: Add running counter
Date: Wed, 6 Jun 2018 16:52:17 +0100	[thread overview]
Message-ID: <1ba700ec-319d-5ab3-b8db-fd2bc0b760f4@linux.intel.com> (raw)
In-Reply-To: <152829863556.9058.1419672815018186721@mail.alporthouse.com>


On 06/06/2018 16:23, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2018-06-06 15:40:10)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> We add a PMU counter to expose the number of requests currently executing
>> on the GPU.
>>
>> This is useful to analyze the overall load of the system.
>>
>> v2:
>>   * Rebase.
>>   * Drop floating point constant. (Chris Wilson)
>>
>> v3:
>>   * Change scale to 1024 for faster arithmetics. (Chris Wilson)
>>
>> v4:
>>   * Refactored for timer period accounting.
>>
>> v5:
>>   * Avoid 64-division. (Chris Wilson)
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>>   #define ENGINE_SAMPLE_BITS (1 << I915_PMU_SAMPLE_BITS)
>>   
>> @@ -226,6 +227,13 @@ engines_sample(struct drm_i915_private *dev_priv, unsigned int period_ns)
>>                                          div_u64((u64)period_ns *
>>                                                  I915_SAMPLE_QUEUED_DIVISOR,
>>                                                  1000000));
>> +
>> +               if (engine->pmu.enable & BIT(I915_SAMPLE_RUNNING))
>> +                       add_sample_mult(&engine->pmu.sample[I915_SAMPLE_RUNNING],
>> +                                       last_seqno - current_seqno,
>> +                                       div_u64((u64)period_ns *
>> +                                               I915_SAMPLE_QUEUED_DIVISOR,
>> +                                               1000000));
> 
> Are we worried about losing precision with qd.ns?
> 
> add_sample_mult(SAMPLE, x, period_ns); here
> 
>> @@ -560,7 +569,8 @@ static u64 __i915_pmu_event_read(struct perf_event *event)
>>                          val = engine->pmu.sample[sample].cur;
>>   
>>                          if (sample == I915_SAMPLE_QUEUED ||
>> -                           sample == I915_SAMPLE_RUNNABLE)
>> +                           sample == I915_SAMPLE_RUNNABLE ||
>> +                           sample == I915_SAMPLE_RUNNING)
>>                                  val = div_u64(val, MSEC_PER_SEC);  /* to qd */
> 
> and val = div_u64(val * I915_SAMPLE_QUEUED_DIVISOR, NSEC_PER_SEC);

Yeah that works, thanks.

> So that gives us a limit of ~1 million qd (assuming the user cares for
> about 1s intervals). Up to 8 million wlog with
> 
> 	val = div_u64(val * I915_SAMPLE_QUEUED_DIVISOR/8, NSEC_PER_SEC/8);

Or keep in qd.us as for frequency. I think precision is plenty in any case.

> Anyway, just concerned to have more than one 64b division and want to
> provoke you into thinking of a way of avoiding it :)

It is an optimized 64-bit divide, or 64-divide as I faltered in the 
commit message :), so not as bad as 64/64, but still your idea is very good.

Regards,

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

  reply	other threads:[~2018-06-06 15:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-06 12:48 [PATCH v6 0/7] Queued/runnable/running engine stats Tvrtko Ursulin
2018-06-06 12:48 ` [PATCH 1/7] drm/i915/pmu: Fix enable count array size and bounds checking Tvrtko Ursulin
2018-06-06 12:48 ` [PATCH 2/7] drm/i915: Keep a count of requests waiting for a slot on GPU Tvrtko Ursulin
2018-06-06 12:48 ` [PATCH 3/7] drm/i915: Keep a count of requests submitted from userspace Tvrtko Ursulin
2018-06-06 12:48 ` [PATCH 4/7] drm/i915/pmu: Add queued counter Tvrtko Ursulin
2018-06-06 13:16   ` Chris Wilson
2018-06-06 13:24     ` Tvrtko Ursulin
2018-06-06 14:39   ` Tvrtko Ursulin
2018-06-07 13:24     ` Tvrtko Ursulin
2018-06-06 12:48 ` [PATCH 5/7] drm/i915/pmu: Add runnable counter Tvrtko Ursulin
2018-06-06 14:39   ` Tvrtko Ursulin
2018-06-07 13:24     ` Tvrtko Ursulin
2018-06-06 12:48 ` [PATCH 6/7] drm/i915/pmu: Add running counter Tvrtko Ursulin
2018-06-06 14:40   ` Tvrtko Ursulin
2018-06-06 15:23     ` Chris Wilson
2018-06-06 15:52       ` Tvrtko Ursulin [this message]
2018-06-07 13:25     ` Tvrtko Ursulin
2018-06-07 14:45       ` Chris Wilson
2018-06-06 12:48 ` [PATCH 7/7] drm/i915: Engine queues query Tvrtko Ursulin
2018-06-06 13:31 ` ✓ Fi.CI.BAT: success for Queued/runnable/running engine stats (rev8) Patchwork
2018-06-06 15:17 ` ✓ Fi.CI.BAT: success for Queued/runnable/running engine stats (rev11) Patchwork
2018-06-06 16:06 ` ✗ Fi.CI.IGT: failure for Queued/runnable/running engine stats (rev8) Patchwork
2018-06-06 17:26 ` ✓ Fi.CI.IGT: success for Queued/runnable/running engine stats (rev11) Patchwork
2018-06-07 13:57 ` ✓ Fi.CI.BAT: success for Queued/runnable/running engine stats (rev14) Patchwork
2018-06-07 17:55 ` ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2018-04-05 12:39 [PATCH v5 0/7] Queued/runnable/running engine stats Tvrtko Ursulin
2018-04-05 12:39 ` [PATCH 6/7] drm/i915/pmu: Add running counter Tvrtko Ursulin
2018-04-06 20:24   ` Chris Wilson
2018-04-09  9:13     ` Tvrtko Ursulin
2018-03-19 18:16 [PATCH v4 0/7] Queued/runnable/running engine stats Tvrtko Ursulin
2018-03-19 18:16 ` [PATCH 6/7] drm/i915/pmu: Add running counter 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=1ba700ec-319d-5ab3-b8db-fd2bc0b760f4@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).