All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/i915/pmu: Reconstruct active state on starting busy-stats
Date: Wed, 10 Jan 2018 16:17:50 +0000	[thread overview]
Message-ID: <9cb230ee-b804-ae65-e6b3-2b30e463ba91@linux.intel.com> (raw)
In-Reply-To: <20180110161106.3317-1-chris@chris-wilson.co.uk>


On 10/01/2018 16:11, Chris Wilson wrote:
> We have a hole in our busy-stat accounting if the pmu is enabled during
> a long running batch, the pmu will not start accumulating busy-time
> until the next context switch. This then fails tests that are only
> sampling a single batch.
> 
> v2: Count each active port just once (context in/out events are only on
> the first and last assigment to a port).
> 
> Testcase: igt/perf_pmu/busy-start
> Testcase: igt/perf_pmu/busy-double-start
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_engine_cs.c  | 10 +++++++++-
>   drivers/gpu/drm/i915/intel_ringbuffer.h |  2 +-
>   2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index 6bb51a502b8b..3a11602e60c7 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -1951,8 +1951,16 @@ int intel_enable_engine_stats(struct intel_engine_cs *engine)
>   	spin_lock_irqsave(&engine->stats.lock, flags);
>   	if (engine->stats.enabled == ~0)
>   		goto busy;
> -	if (engine->stats.enabled++ == 0)
> +	if (engine->stats.enabled++ == 0) {
>   		engine->stats.enabled_at = ktime_get();
> +
> +		/* XXX submission method oblivious? */
> +		engine->stats.active =
> +			port_isset(&engine->execlists.port[1]) +
> +			port_isset(&engine->execlists.port[0]);
> +		if (engine->stats.active)
> +			engine->stats.start = engine->stats.enabled_at;
> +	}
>   	spin_unlock_irqrestore(&engine->stats.lock, flags);
>   
>   	return 0;
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index c5ff203e42d6..37cf665692e5 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -225,7 +225,7 @@ struct intel_engine_execlists {
>   #define port_pack(rq, count) ptr_pack_bits(rq, count, EXECLIST_COUNT_BITS)
>   #define port_unpack(p, count) ptr_unpack_bits((p)->request_count, count, EXECLIST_COUNT_BITS)
>   #define port_set(p, packed) ((p)->request_count = (packed))
> -#define port_isset(p) ((p)->request_count)
> +#define port_isset(p) (((p)->request_count) != NULL)
>   #define port_index(p, execlists) ((p) - (execlists)->port)
>   
>   		/**
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

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

  reply	other threads:[~2018-01-10 16:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 16:11 [PATCH v2] drm/i915/pmu: Reconstruct active state on starting busy-stats Chris Wilson
2018-01-10 16:17 ` Tvrtko Ursulin [this message]
2018-01-10 16:27   ` Chris Wilson
2018-01-10 16:46 ` ✓ Fi.CI.BAT: success for " 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=9cb230ee-b804-ae65-e6b3-2b30e463ba91@linux.intel.com \
    --to=tvrtko.ursulin@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.