All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v5 08/15] drm/i915/perf: rate limit spurious oa report notice
Date: Mon, 24 Apr 2017 00:17:44 -0700	[thread overview]
Message-ID: <20170424071751.2416-9-lionel.g.landwerlin@intel.com> (raw)
In-Reply-To: <20170424071751.2416-1-lionel.g.landwerlin@intel.com>

From: Robert Bragg <robert@sixbynine.org>

This change is pre-emptively aiming to avoid a potential cause of kernel
logging noise in case some condition were to result in us seeing invalid
OA reports.

The workaround for the OA unit's tail pointer race condition is what
avoids the primary known cause of invalid reports being seen and with
that in place we aren't expecting to see this notice but it can't be
entirely ruled out.

Just in case some condition does lead to the notice then it's likely
that it will be triggered repeatedly while attempting to append a
sequence of reports and depending on the configured OA sampling
frequency that might be a large number of repeat notices.

v2: (Chris) avoid inconsistent warning on throttle with
    printk_ratelimit()
v3: (Matt) init and summarise with stream init/close not driver init/fini

Signed-off-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h  |  6 ++++++
 drivers/gpu/drm/i915/i915_perf.c | 28 +++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 69a914870774..fb2188c8d72f 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2451,6 +2451,12 @@ struct drm_i915_private {
 			wait_queue_head_t poll_wq;
 			bool pollin;

+			/**
+			 * For rate limiting any notifications of spurious
+			 * invalid OA reports
+			 */
+			struct ratelimit_state spurious_report_rs;
+
 			bool periodic;
 			int period_exponent;

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 5738b99caa5b..3277a52ce98e 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -632,7 +632,8 @@ static int gen7_append_oa_reports(struct i915_perf_stream *stream,
 		 * copying it to userspace...
 		 */
 		if (report32[0] == 0) {
-			DRM_NOTE("Skipping spurious, invalid OA report\n");
+			if (__ratelimit(&dev_priv->perf.oa.spurious_report_rs))
+				DRM_NOTE("Skipping spurious, invalid OA report\n");
 			continue;
 		}

@@ -913,6 +914,11 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream)
 		oa_put_render_ctx_id(stream);

 	dev_priv->perf.oa.exclusive_stream = NULL;
+
+	if (dev_priv->perf.oa.spurious_report_rs.missed) {
+		DRM_NOTE("%d spurious OA report notices suppressed due to ratelimiting\n",
+			 dev_priv->perf.oa.spurious_report_rs.missed);
+	}
 }

 static void gen7_init_oa_buffer(struct drm_i915_private *dev_priv)
@@ -1268,6 +1274,26 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
 		return -EINVAL;
 	}

+	/* We set up some ratelimit state to potentially throttle any _NOTES
+	 * about spurious, invalid OA reports which we don't forward to
+	 * userspace.
+	 *
+	 * The initialization is associated with opening the stream (not driver
+	 * init) considering we print a _NOTE about any throttling when closing
+	 * the stream instead of waiting until driver _fini which no one would
+	 * ever see.
+	 *
+	 * Using the same limiting factors as printk_ratelimit()
+	 */
+	ratelimit_state_init(&dev_priv->perf.oa.spurious_report_rs,
+			     5 * HZ, 10);
+	/* Since we use a DRM_NOTE for spurious reports it would be
+	 * inconsistent to let __ratelimit() automatically print a warning for
+	 * throttling.
+	 */
+	ratelimit_set_flags(&dev_priv->perf.oa.spurious_report_rs,
+			    RATELIMIT_MSG_ON_RELEASE);
+
 	stream->sample_size = sizeof(struct drm_i915_perf_record_header);

 	format_size = dev_priv->perf.oa.oa_formats[props->oa_format].size;
--
2.11.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2017-04-24  7:18 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 ` [PATCH v4 07/15] drm/i915/perf: better pipeline aged/aging tail updates Robert Bragg
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   ` Lionel Landwerlin [this message]
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=20170424071751.2416-9-lionel.g.landwerlin@intel.com \
    --to=lionel.g.landwerlin@intel.com \
    --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.