All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Intel-gfx@lists.freedesktop.org
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>,
	David Airlie <airlied@linux.ie>,
	tursulin@ursulin.net, dri-devel@lists.freedesktop.org,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/pmu: Fix sleep under atomic in RC6 readout
Date: Tue, 06 Feb 2018 16:04:10 +0000	[thread overview]
Message-ID: <151793305045.17167.6711383531076093568@mail.alporthouse.com> (raw)
In-Reply-To: <20180206143107.25786-1-tvrtko.ursulin@linux.intel.com>

Quoting Tvrtko Ursulin (2018-02-06 14:31:07)
> +static u64 read_rc6_residency(struct drm_i915_private *i915)
> +{
> +       u64 val;
> +
> +       val = intel_rc6_residency_ns(i915, IS_VALLEYVIEW(i915) ?
> +                                          VLV_GT_RENDER_RC6 : GEN6_GT_GFX_RC6);
> +       if (HAS_RC6p(i915))
> +               val += intel_rc6_residency_ns(i915, GEN6_GT_GFX_RC6p);
> +       if (HAS_RC6pp(i915))
> +               val += intel_rc6_residency_ns(i915, GEN6_GT_GFX_RC6pp);

We really should mention that these may produce interesting results
every 53 minutes. Switching to a timer will allow us to notice the
wraparound in each counter.

> +
> +       return val;
> +}
> +
> +static void
> +update_rc6_sample(struct drm_i915_private *i915, u64 val, bool locked)
> +{
> +       unsigned long flags;
> +
> +       if (!locked)
> +               spin_lock_irqsave(&i915->pmu.lock, flags);
> +
> +       /*
> +        * Update stored RC6 counter only if it is greater than the current
> +        * value. This deals with periods of runtime suspend during which we are
> +        * estimating the RC6 residency, so do not want to overshoot the real
> +        * value read once the device is woken up.
> +        */
> +       if (val > i915->pmu.sample[__I915_SAMPLE_RC6].cur)
> +               i915->pmu.sample[__I915_SAMPLE_RC6].cur = val;

64b wraparound? Maybe not today, maybe not tomorrow... ;)

> +
> +       /* We don't need to sample RC6 from the timer any more. */
> +       i915->pmu.timer_enabled =
> +               __pmu_needs_timer(i915,
> +                                 i915->pmu.enable & ~config_enabled_mask(I915_PMU_RC6_RESIDENCY),
> +                                 READ_ONCE(i915->gt.awake));

But we do... :)
One thing I had in mind was to hook into runtime suspend/resume to read
the counters there and compensate, but the more I think about it, we may
as well solve the lack of resolution in the rc6 counters whilst we are
here. https://bugs.freedesktop.org/show_bug.cgi?id=94852.
-Chris
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2018-02-06 16:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-06 14:31 [PATCH] drm/i915/pmu: Fix sleep under atomic in RC6 readout Tvrtko Ursulin
2018-02-06 15:13 ` ✗ Fi.CI.BAT: warning for " Patchwork
2018-02-06 16:04 ` Chris Wilson [this message]
2018-02-06 16:10   ` [PATCH] " Imre Deak
2018-02-06 17:12     ` [Intel-gfx] " Tvrtko Ursulin
2018-02-06 18:33     ` [PATCH v2] " Tvrtko Ursulin
2018-02-06 21:11       ` Chris Wilson
2018-02-06 21:54         ` Imre Deak
2018-02-07  9:20           ` [Intel-gfx] " Tvrtko Ursulin
2018-02-07  9:36             ` Chris Wilson
2018-02-07 14:06           ` Rafael J. Wysocki
2018-02-06 19:16 ` ✓ Fi.CI.BAT: success for drm/i915/pmu: Fix sleep under atomic in RC6 readout (rev2) Patchwork
2018-02-07  9:40 ` Patchwork
2018-02-07 13:40   ` Tvrtko Ursulin
2018-02-07 12:10 ` ✗ Fi.CI.IGT: failure " 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=151793305045.17167.6711383531076093568@mail.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    --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 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.