[Intel-gfx] [PATCH v12 2/4] drm/i915/perf: stop using the kernel context

Chris Wilson chris at chris-wilson.co.uk
Mon May 4 11:22:57 UTC 2020


Quoting Lionel Landwerlin (2020-05-04 12:12:47)
> +static int i915_perf_stream_sync(struct i915_perf_stream *stream,
> +                                bool enable)
> +{
> +       struct i915_active *active;
> +       int err = 0;
> +
> +       active = i915_active_create();
> +       if (!active)
> +               return -ENOMEM;
> +
> +       if (enable)
> +               err = stream->perf->ops.enable_metric_set(stream, active);
> +       else
> +               stream->perf->ops.disable_metric_set(stream, active);
> +       if (err == 0)
> +               __i915_active_wait(active, TASK_UNINTERRUPTIBLE);
> +
> +       i915_active_put(active);
> +       return err;
> +}
> +
>  static void i915_oa_stream_destroy(struct i915_perf_stream *stream)
>  {
>         struct i915_perf *perf = stream->perf;
> +       int err;
>  
>         BUG_ON(stream != perf->exclusive_stream);
>  
> @@ -1367,7 +1389,14 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream)
>          * See i915_oa_init_reg_state() and lrc_configure_all_contexts()
>          */
>         WRITE_ONCE(perf->exclusive_stream, NULL);
> -       perf->ops.disable_metric_set(stream);
> +       err = i915_perf_stream_sync(stream, false /* enable */);
> +       if (err) {
> +               drm_err(&perf->i915->drm,
> +                       "Error while disabling OA stream\n");
> +       }

And that error should be impossible, so explosions are fine :)

> +       intel_context_unpin(stream->config_context);
> +       intel_context_put(stream->config_context);

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the Intel-gfx mailing list