[Intel-gfx] [RFC 2/5] drm/i915: Expose list of clients in sysfs

Chris Wilson chris at chris-wilson.co.uk
Fri Oct 25 14:35:27 UTC 2019


Quoting Tvrtko Ursulin (2019-10-25 15:21:28)
>  int i915_gem_open(struct drm_i915_private *i915, struct drm_file *file)
>  {
> +       int ret = -ENOMEM;
>         struct drm_i915_file_private *file_priv;
> -       int ret;
>  
>         DRM_DEBUG("\n");
>  
>         file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL);
>         if (!file_priv)
> -               return -ENOMEM;
> +               goto err_alloc;
> +
> +       file_priv->client.id = atomic_inc_return(&i915->clients.serial);

We should make this a cyclic ida to avoid reuse on wraparound. 32b
wraps will happen, and they will still have client 0 alive! :)

That will mean we need a lock.

(Of course you could use -EEXIST from add_client and keep incrementing
serial until you find a hole :)
-Chris


More information about the Intel-gfx mailing list