All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Bragg <robert@sixbynine.org>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v4 07/15] drm/i915/perf: better pipeline aged/aging tail updates
Date: Wed, 12 Apr 2017 16:55:48 +0100	[thread overview]
Message-ID: <20170412155556.6602-8-robert@sixbynine.org> (raw)
In-Reply-To: <20170412155556.6602-1-robert@sixbynine.org>

This updates the tail pointer race workaround handling to updating the
'aged' pointer before looking to start aging a new one. There's the
possibility that there is already new data available and so we can
immediately start aging a new pointer without having to first wait for a
later hrtimer callback (and then another to age).

Signed-off-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/i915_perf.c | 41 ++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 08cc2b0dd734..5738b99caa5b 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -391,6 +391,29 @@ static bool gen7_oa_buffer_check_unlocked(struct drm_i915_private *dev_priv)
 
 	now = ktime_get_mono_fast_ns();
 
+	/* Update the aged tail
+	 *
+	 * Flip the tail pointer available for read()s once the aging tail is
+	 * old enough to trust that the corresponding data will be visible to
+	 * the CPU...
+	 *
+	 * Do this before updating the aging pointer in case we may be able to
+	 * immediately start aging a new pointer too (if new data has become
+	 * available) without needing to wait for a later hrtimer callback.
+	 */
+	if (aging_tail != INVALID_TAIL_PTR &&
+	    ((now - dev_priv->perf.oa.oa_buffer.aging_timestamp) >
+	     OA_TAIL_MARGIN_NSEC)) {
+		aged_idx ^= 1;
+		dev_priv->perf.oa.oa_buffer.aged_tail_idx = aged_idx;
+
+		aged_tail = aging_tail;
+
+		/* Mark that we need a new pointer to start aging... */
+		dev_priv->perf.oa.oa_buffer.tails[!aged_idx].offset = INVALID_TAIL_PTR;
+		aging_tail = INVALID_TAIL_PTR;
+	}
+
 	/* Update the aging tail
 	 *
 	 * We throttle aging tail updates until we have a new tail that
@@ -420,24 +443,6 @@ static bool gen7_oa_buffer_check_unlocked(struct drm_i915_private *dev_priv)
 		}
 	}
 
-	/* Update the aged tail
-	 *
-	 * Flip the tail pointer available for read()s once the aging tail is
-	 * old enough to trust that the corresponding data will be visible to
-	 * the CPU...
-	 */
-	if (aging_tail != INVALID_TAIL_PTR &&
-	    ((now - dev_priv->perf.oa.oa_buffer.aging_timestamp) >
-	     OA_TAIL_MARGIN_NSEC)) {
-		aged_idx ^= 1;
-		dev_priv->perf.oa.oa_buffer.aged_tail_idx = aged_idx;
-
-		aged_tail = aging_tail;
-
-		/* Mark that we need a new pointer to start aging... */
-		dev_priv->perf.oa.oa_buffer.tails[!aged_idx].offset = INVALID_TAIL_PTR;
-	}
-
 	spin_unlock_irqrestore(&dev_priv->perf.oa.oa_buffer.ptr_lock, flags);
 
 	return aged_tail == INVALID_TAIL_PTR ?
-- 
2.12.0

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

  parent reply	other threads:[~2017-04-12 15:56 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12 15:55 [PATCH v4 00/15] Enable OA unit for Gen 8 and 9 in i915 perf Robert Bragg
2017-04-12 15:55 ` [PATCH v4 01/15] drm/i915/perf: fix gen7_append_oa_reports comment Robert Bragg
2017-04-12 15:55 ` [PATCH v4 02/15] drm/i915/perf: avoid poll, read, EAGAIN busy loops Robert Bragg
2017-04-12 15:55 ` [PATCH v4 03/15] drm/i915/perf: avoid read back of head register Robert Bragg
2017-04-12 15:55 ` [PATCH v4 04/15] drm/i915/perf: no head/tail ref in gen7_oa_read Robert Bragg
2017-04-12 15:55 ` [PATCH v4 05/15] drm/i915/perf: improve tail race workaround Robert Bragg
2017-04-12 15:55 ` [PATCH v4 06/15] drm/i915/perf: improve invalid OA format debug message Robert Bragg
2017-04-12 15:55 ` Robert Bragg [this message]
2017-04-12 15:55 ` [PATCH v4 08/15] drm/i915/perf: rate limit spurious oa report notice Robert Bragg
2017-04-12 15:55 ` [PATCH v4 09/15] drm/i915: expose _SLICE_MASK GETPARM Robert Bragg
2017-04-12 15:55 ` [PATCH v4 10/15] drm/i915: expose _SUBSLICE_MASK GETPARM Robert Bragg
2017-04-12 15:55 ` [PATCH v4 11/15] drm/i915/perf: Add 'render basic' Gen8+ OA unit configs Robert Bragg
2017-04-12 15:55 ` [PATCH v4 12/15] drm/i915/perf: Add OA unit support for Gen 8+ Robert Bragg
2017-04-12 17:47   ` Matthew Auld
2017-04-12 15:55 ` [PATCH v4 13/15] drm/i915/perf: Add more OA configs for BDW, CHV, SKL + BXT Robert Bragg
2017-04-12 15:55 ` [PATCH v4 14/15] drm/i915/perf: per-gen timebase for checking sample freq Robert Bragg
2017-04-12 15:55 ` [PATCH v4 15/15] drm/i915/perf: remove perf.hook_lock Robert Bragg
2017-04-12 17:33 ` ✓ Fi.CI.BAT: success for Enable OA unit for Gen 8 and 9 in i915 perf (rev6) Patchwork
2017-04-24  7:17 ` [PATCH 00/15] Enable OA unit for Gen 8 and 9 in i915 perf Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 01/15] drm/i915/perf: fix gen7_append_oa_reports comment Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 02/15] drm/i915/perf: avoid poll, read, EAGAIN busy loops Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 03/15] drm/i915/perf: avoid read back of head register Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 04/15] drm/i915/perf: no head/tail ref in gen7_oa_read Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 05/15] drm/i915/perf: improve tail race workaround Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 06/15] drm/i915/perf: improve invalid OA format debug message Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 07/15] drm/i915/perf: better pipeline aged/aging tail updates Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 08/15] drm/i915/perf: rate limit spurious oa report notice Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 09/15] drm/i915: expose _SLICE_MASK GETPARM Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 10/15] drm/i915: expose _SUBSLICE_MASK GETPARM Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 11/15] drm/i915/perf: Add 'render basic' Gen8+ OA unit configs Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 12/15] drm/i915/perf: Add OA unit support for Gen 8+ Lionel Landwerlin
2017-04-24 10:35     ` Chris Wilson
2017-04-24 18:49       ` [PATCH v6 " Lionel Landwerlin
2017-04-25 16:20         ` Lionel Landwerlin
2017-04-25 16:42         ` Matthew Auld
2017-04-25 17:10           ` Lionel Landwerlin
2017-04-25 17:47             ` Matthew Auld
2017-04-25 17:30           ` [PATCH v7 " Lionel Landwerlin
2017-04-27  8:53             ` Chris Wilson
2017-05-02  1:17               ` [PATCH v9 " Lionel Landwerlin
2017-05-02 20:14                 ` Chris Wilson
2017-05-02 21:44                   ` [PATCH v10 " Lionel Landwerlin
2017-05-03 10:31                     ` Chris Wilson
2017-04-24  7:17   ` [PATCH v5 13/15] drm/i915/perf: Add more OA configs for BDW, CHV, SKL + BXT Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 14/15] drm/i915/perf: per-gen timebase for checking sample freq Lionel Landwerlin
2017-04-24  7:17   ` [PATCH v5 15/15] drm/i915/perf: remove perf.hook_lock Lionel Landwerlin
2017-05-03 16:23   ` [PATCH v2 9/15] drm/i915: expose _SLICE_MASK GETPARM Lionel Landwerlin
2017-05-03 16:23     ` [PATCH v2 9/15] drm/i915: expose _SUBSLICE_MASK GETPARM Lionel Landwerlin
2017-05-03 16:33     ` [PATCH v2 9/15] drm/i915: expose _SLICE_MASK GETPARM Chris Wilson
2017-05-03 18:14       ` Lionel Landwerlin
2017-05-26 11:56   ` [PATCH v14 00/14] Enable OA unit for Gen 8 and 9 in i915 perf Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 01/14] drm/i915: Record both min/max eu_per_subslice in sseu_dev_info Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 02/14] drm/i915: Program RPCS for Broadwell Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 03/14] drm/i915: Record the sseu configuration per-context & engine Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 04/14] drm/i915/perf: rework mux configurations queries Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 05/14] drm/i915/perf: Add 'render basic' Gen8+ OA unit configs Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 06/14] drm/i915/perf: Add OA unit support for Gen 8+ Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 07/14] drm/i915/perf: Add more OA configs for BDW, CHV, SKL + BXT Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 08/14] drm/i915/perf: per-gen timebase for checking sample freq Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 09/14] drm/i915/perf: remove perf.hook_lock Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 10/14] drm/i915: add KBL GT2/GT3 check macros Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 11/14] drm/i915/perf: add KBL support Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 12/14] drm/i915/perf: add GLK support Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 13/14] drm/i915/perf: reprogram NOA muxes at the beginning of each workload Lionel Landwerlin
2017-05-30 18:51       ` Lionel Landwerlin
2017-05-26 11:56     ` [PATCH v14 14/14] drm/i915/perf: notify sseu configuration changes Lionel Landwerlin
2017-05-26 12:28   ` ✓ Fi.CI.BAT: success for series starting with [v2,9/15] drm/i915: expose _SLICE_MASK GETPARM (rev2) Patchwork
2017-05-31 12:33   ` [PATCH v15 00/14] Enable OA unit for Gen 8 and 9 in i915 perf Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 01/14] drm/i915: Record both min/max eu_per_subslice in sseu_dev_info Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 02/14] drm/i915: Program RPCS for Broadwell Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 03/14] drm/i915: Record the sseu configuration per-context & engine Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 04/14] drm/i915/perf: rework mux configurations queries Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 05/14] drm/i915/perf: Add 'render basic' Gen8+ OA unit configs Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 06/14] drm/i915/perf: Add OA unit support for Gen 8+ Lionel Landwerlin
2017-06-01 11:48       ` Chris Wilson
2017-05-31 12:33     ` [PATCH v15 07/14] drm/i915/perf: Add more OA configs for BDW, CHV, SKL + BXT Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 08/14] drm/i915/perf: per-gen timebase for checking sample freq Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 09/14] drm/i915/perf: remove perf.hook_lock Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 10/14] drm/i915: add KBL GT2/GT3 check macros Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 11/14] drm/i915/perf: add KBL support Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 12/14] drm/i915/perf: add GLK support Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 13/14] drm/i915/perf: reprogram NOA muxes at the beginning of each workload Lionel Landwerlin
2017-05-31 12:33     ` [PATCH v15 14/14] drm/i915/perf: notify sseu configuration changes Lionel Landwerlin
2017-06-01 11:50       ` Chris Wilson
2017-06-01 11:52       ` Chris Wilson
2017-04-24 18:52 ` ✗ Fi.CI.BAT: failure for Enable OA unit for Gen 8 and 9 in i915 perf (rev7) Patchwork
2017-04-25 17:35 ` ✗ Fi.CI.BAT: failure for Enable OA unit for Gen 8 and 9 in i915 perf (rev8) 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=20170412155556.6602-8-robert@sixbynine.org \
    --to=robert@sixbynine.org \
    --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.