[Intel-gfx] [PATCH v3 2/7] drm/i915/perf: allow for CS OA configs to be created lazily

Chris Wilson chris at chris-wilson.co.uk
Tue Jun 4 13:29:57 UTC 2019


Quoting Lionel Landwerlin (2019-06-04 14:11:35)
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 2e33a9b4eae7..e0071e44de3d 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -366,9 +366,16 @@ struct perf_open_properties {
>         int oa_period_exponent;
>  };
>  
> -static void free_oa_config(struct drm_i915_private *dev_priv,
> -                          struct i915_oa_config *oa_config)
> +static void put_oa_config(struct i915_oa_config *oa_config)
>  {
> +       if (!atomic_dec_and_test(&oa_config->ref_count))

Might as well use struct kref? At the very least, refcount_t.

> +               return;
> +

> +       if (oa_config->obj) {
lockdep_assert_held(&dev_priv->perf.metrics_lock);

It's not apparent that the lock is held for the list_del.

> +               list_del(&oa_config->vma_link);
> +               i915_gem_object_put(oa_config->obj);
> +       }
> +


More information about the Intel-gfx mailing list