public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Rogozhkin, Dmitry V" <dmitry.v.rogozhkin@intel.com>
To: "tursulin@ursulin.net" <tursulin@ursulin.net>
Cc: "Intel-gfx@lists.freedesktop.org" <Intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH 8/8] drm/i915: Gate engine stats collection with a static key
Date: Tue, 19 Sep 2017 00:38:16 +0000	[thread overview]
Message-ID: <1505752565.8257.1.camel@intel.com> (raw)
In-Reply-To: <20170918113814.2591-9-tvrtko.ursulin@linux.intel.com>

On Mon, 2017-09-18 at 12:38 +0100, Tvrtko Ursulin wrote:
>  static inline void intel_engine_context_out(struct intel_engine_cs
> *engine)
>  {
>         unsigned long flags;
>  
> -       if (READ_ONCE(engine->stats.enabled) == 0)
> -               return;
> -
> -       spin_lock_irqsave(&engine->stats.lock, flags);
> -
> -       if (engine->stats.enabled > 0) {
> -               ktime_t last, now = ktime_get();
> -
> -               if (engine->stats.active && --engine->stats.active ==
> 0) {
> -                       /*
> -                        * Decrement the active context count and in
> case GPU
> -                        * is now idle add up to the running total.
> -                        */
> -                       last = ktime_sub(now, engine->stats.start);
> -
> -                       engine->stats.total =
> ktime_add(engine->stats.total,
> -                                                       last);
> -               } else if (engine->stats.active == 0) {
> -                       /*
> -                        * After turning on engine stats, context out
> might be
> -                        * the first event in which case we account
> from the
> -                        * time stats gathering was turned on.
> -                        */
> -                       last = ktime_sub(now,
> engine->stats.enabled_at);
> -
> -                       engine->stats.total =
> ktime_add(engine->stats.total,
> -                                                       last);
> +       if (static_branch_unlikely(&i915_engine_stats_key)) {
> +               if (READ_ONCE(engine->stats.enabled) == 0)
> +                       return;
> +
> +               spin_lock_irqsave(&engine->stats.lock, flags);
> +
> +               if (engine->stats.enabled > 0) {
> +                       ktime_t last, now = ktime_get();
> +
> +                       if (engine->stats.active &&
> +                           --engine->stats.active == 0) {
> +                               /*
> +                                * Decrement the active context count
> and in
> +                                * case GPU is now idle add up to the
> running
> +                                * total.
> +                                */
> +                               last = ktime_sub(now,
> engine->stats.start);
> +
> +                               engine->stats.total =
> +                                       ktime_add(engine->stats.total,
> last);
> +                       } else if (engine->stats.active == 0) {
> +                               /*
> +                                * After turning on engine stats,
> context out
> +                                * might be the first event in which
> case we
> +                                * account from the time stats
> gathering was
> +                                * turned on.
> +                                */
> +                               last = ktime_sub(now,
> engine->stats.enabled_at);
> +
> +                               engine->stats.total =
> +                                       ktime_add(engine->stats.total,
> last);
> +                       }
> +
> +                       spin_unlock_irqrestore(&engine->stats.lock,
> flags);

This irqrestore looks placed asymmetric with irqsave.

>                 }
>         }
> -
> -       spin_unlock_irqrestore(&engine->stats.lock, flags);
>  }

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

  reply	other threads:[~2017-09-19  0:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 11:38 [PATCH v4 00/8] i915 PMU and engine busy stats Tvrtko Ursulin
2017-09-18 11:38 ` [PATCH 1/8] drm/i915: Convert intel_rc6_residency_us to ns Tvrtko Ursulin
2017-09-18 11:38 ` [PATCH 2/8] drm/i915: Extract intel_get_cagf Tvrtko Ursulin
2017-09-18 11:38 ` [PATCH 3/8] drm/i915/pmu: Expose a PMU interface for perf queries Tvrtko Ursulin
2017-09-20 16:02   ` [PATCH v10 " Tvrtko Ursulin
2017-09-18 11:38 ` [PATCH 4/8] drm/i915/pmu: Suspend sampling when GPU is idle Tvrtko Ursulin
2017-09-18 11:38 ` [PATCH 5/8] drm/i915: Wrap context schedule notification Tvrtko Ursulin
2017-09-18 11:38 ` [PATCH 6/8] drm/i915: Engine busy time tracking Tvrtko Ursulin
2017-09-18 11:38 ` [PATCH 7/8] drm/i915/pmu: Wire up engine busy stats to PMU Tvrtko Ursulin
2017-09-18 14:58   ` Chris Wilson
2017-09-19  8:46     ` Tvrtko Ursulin
2017-09-18 11:38 ` [PATCH 8/8] drm/i915: Gate engine stats collection with a static key Tvrtko Ursulin
2017-09-19  0:38   ` Rogozhkin, Dmitry V [this message]
2017-09-19  8:43     ` [PATCH v7 " Tvrtko Ursulin
2017-09-18 14:00 ` ✓ Fi.CI.BAT: success for i915 PMU and engine busy stats (rev9) Patchwork
2017-09-18 15:37 ` [PATCH v4 00/8] i915 PMU and engine busy stats Chris Wilson
2017-09-19  8:15   ` Tvrtko Ursulin
2017-09-18 16:30 ` ✓ Fi.CI.IGT: success for i915 PMU and engine busy stats (rev9) Patchwork
2017-09-19 18:33 ` ✓ Fi.CI.BAT: success for i915 PMU and engine busy stats (rev10) Patchwork
2017-09-19 21:00 ` ✓ Fi.CI.IGT: " Patchwork
2017-09-20 16:29 ` ✗ Fi.CI.BAT: warning for i915 PMU and engine busy stats (rev11) Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2017-09-25 15:15 [PATCH v5 0/8] i915 PMU and engine busy stats Tvrtko Ursulin
2017-09-25 15:15 ` [PATCH 8/8] drm/i915: Gate engine stats collection with a static key Tvrtko Ursulin
2017-09-25 17:56   ` Chris Wilson
2017-09-26 12:42     ` 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=1505752565.8257.1.camel@intel.com \
    --to=dmitry.v.rogozhkin@intel.com \
    --cc=Intel-gfx@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox