[Intel-gfx] [RFC 02/10] drm/i915: Update client name on context create

Chris Wilson chris at chris-wilson.co.uk
Fri Mar 13 10:41:27 UTC 2020


Quoting Tvrtko Ursulin (2020-03-11 18:26:10)
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> index cb6b6be48978..2c3fd9748d39 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> @@ -74,6 +74,7 @@
>  #include "gt/intel_engine_user.h"
>  #include "gt/intel_ring.h"
>  
> +#include "i915_drm_client.h"
>  #include "i915_gem_context.h"
>  #include "i915_globals.h"
>  #include "i915_trace.h"
> @@ -2294,6 +2295,7 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
>  {
>         struct drm_i915_private *i915 = to_i915(dev);
>         struct drm_i915_gem_context_create_ext *args = data;
> +       struct drm_i915_file_private *file_priv = file->driver_priv;
>         struct create_ext ext_data;

ext_data.fpriv is on the stack already and you don't use file_priv
before ext_data.

> @@ -127,8 +140,8 @@ __i915_drm_client_unregister(struct i915_drm_client *client)
>  {
>         __client_unregister_sysfs(client);
>  
> -       put_pid(fetch_and_zero(&client->pid));
> -       kfree(fetch_and_zero(&client->name));
> +       put_pid(rcu_replace_pointer(client->pid, NULL, true));
> +       kfree(rcu_replace_pointer(client->name, NULL, true));
>  }

Ok, we should be past the point of last concurrent access.

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


More information about the Intel-gfx mailing list