Re: [RFC 2/5] drm/i915: Expose list of clients in sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux