[Intel-gfx] [PATCH v2 1/2] drm/i915: Add perf property support for context HW id
Chris Wilson
chris at chris-wilson.co.uk
Fri Jul 21 11:04:05 UTC 2017
Quoting Zhenyu Wang (2017-07-19 06:39:48)
> +static struct i915_gem_context *
> +lookup_context_hw_id(struct drm_i915_private *dev_priv, unsigned int hw_id)
> +{
> + struct i915_gem_context *ctx;
> + int ret;
> +
> + ret = i915_mutex_lock_interruptible(&dev_priv->drm);
> + if (ret)
> + return ERR_PTR(ret);
> +
> + list_for_each_entry(ctx, &dev_priv->contexts.list, link) {
> + if (!i915_gem_context_is_default(ctx))
> + continue;
This is still a massive what? Why ban normal contexts? Why are you not
banning the kernel context?
> +
> + if (ctx->hw_id == hw_id) {
> + ret = 1;
> + i915_gem_context_get(ctx);
> + break;
Bad news, your reference counting is still broken. You actually need an
i915_gem_context_get_rcu() variant for pulling from this list.
-Chris
More information about the Intel-gfx
mailing list