drm/i915/perf: fix oa config reconfiguration
diff mbox series

Message ID 20191019214647.27866-1-lionel.g.landwerlin@intel.com
State New
Headers show
Series
  • drm/i915/perf: fix oa config reconfiguration
Related show

Commit Message

Lionel Landwerlin Oct. 19, 2019, 9:46 p.m. UTC
The current logic just reapplies the same configuration already stored
into stream->oa_config instead of the newly selected one.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 7831e9a965ea ("drm/i915/perf: Allow dynamic reconfiguration of the OA stream")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_perf.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Chris Wilson Oct. 20, 2019, 9 a.m. UTC | #1
Quoting Lionel Landwerlin (2019-10-19 22:46:47)
> The current logic just reapplies the same configuration already stored
> into stream->oa_config instead of the newly selected one.
> 
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Fixes: 7831e9a965ea ("drm/i915/perf: Allow dynamic reconfiguration of the OA stream")
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> @@ -2895,7 +2896,7 @@ static long i915_perf_config_locked(struct i915_perf_stream *stream,
>                  * When set globally, we use a low priority kernel context,
>                  * so it will effectively take effect when idle.
>                  */
> -               err = emit_oa_config(stream, oa_context(stream));
> +               err = emit_oa_config(stream, config, oa_context(stream));
>                 if (err == 0)
>                         config = xchg(&stream->oa_config, config);

Oh crikey.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 54ec1c4190ac..d2ac51fe4f04 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -1863,13 +1863,14 @@  get_oa_vma(struct i915_perf_stream *stream, struct i915_oa_config *oa_config)
 }
 
 static int emit_oa_config(struct i915_perf_stream *stream,
+			  struct i915_oa_config *oa_config,
 			  struct intel_context *ce)
 {
 	struct i915_request *rq;
 	struct i915_vma *vma;
 	int err;
 
-	vma = get_oa_vma(stream, stream->oa_config);
+	vma = get_oa_vma(stream, oa_config);
 	if (IS_ERR(vma))
 		return PTR_ERR(vma);
 
@@ -1927,7 +1928,7 @@  static int hsw_enable_metric_set(struct i915_perf_stream *stream)
 	intel_uncore_rmw(uncore, GEN6_UCGCTL1,
 			 0, GEN6_CSUNIT_CLOCK_GATE_DISABLE);
 
-	return emit_oa_config(stream, oa_context(stream));
+	return emit_oa_config(stream, stream->oa_config, oa_context(stream));
 }
 
 static void hsw_disable_metric_set(struct i915_perf_stream *stream)
@@ -2250,7 +2251,7 @@  static int gen8_configure_all_contexts(struct i915_perf_stream *stream,
 static int gen8_enable_metric_set(struct i915_perf_stream *stream)
 {
 	struct intel_uncore *uncore = stream->uncore;
-	const struct i915_oa_config *oa_config = stream->oa_config;
+	struct i915_oa_config *oa_config = stream->oa_config;
 	int ret;
 
 	/*
@@ -2291,7 +2292,7 @@  static int gen8_enable_metric_set(struct i915_perf_stream *stream)
 	if (ret)
 		return ret;
 
-	return emit_oa_config(stream, oa_context(stream));
+	return emit_oa_config(stream, oa_config, oa_context(stream));
 }
 
 static void gen8_disable_metric_set(struct i915_perf_stream *stream)
@@ -2895,7 +2896,7 @@  static long i915_perf_config_locked(struct i915_perf_stream *stream,
 		 * When set globally, we use a low priority kernel context,
 		 * so it will effectively take effect when idle.
 		 */
-		err = emit_oa_config(stream, oa_context(stream));
+		err = emit_oa_config(stream, config, oa_context(stream));
 		if (err == 0)
 			config = xchg(&stream->oa_config, config);
 		else