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

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Tue Mar 10 19:52:31 UTC 2020


On 10/03/2020 18:11, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2020-03-09 18:31:19)
>> @@ -92,8 +107,8 @@ __i915_drm_client_register(struct i915_drm_client *client,
>>   static void
>>   __i915_drm_client_unregister(struct i915_drm_client *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));
> 
> client_unregister is not after an RCU grace period, so what's the
> protection here?

Against concurrent access via sysfs? Hm.. I think kobject_put needs to 
go first and clearing of name and pid last. Will fix this.

Accesses via GEM contexts always have a reference so that should be fine.

RCU business on pid and name is basically only so the two can be 
asynchronously replaced if need to be updated on context create. So 
anyone accessing them sees either old or new, but always valid data.

Regards,

Tvrtko


More information about the Intel-gfx mailing list