drm/gem: Document that handle_create must be the last step
Subsystems (2)
PATCH 1/1 drm/gem: Document that handle_create must be the last step
It published the gem object to userspace, by that point other threads can guess the id and start using it. And gem IDs are _very_ easy to guess (it's just an idr).
Since gem objects is the only thing we allow drivers to create themselves (all the kms/prime/syncobj stuff is handled by the core) no other functions seem to be in need of this clarification.
Motivated by reviewing the xen-front kms driver.
--- drivers/gpu/drm/drm_gem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_gem.c +6 -3
@@ -436,9 +436,12 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,* @obj: object to register * @handlep: pionter to return the created handle to the caller * -* Create a handle for this object. This adds a handle reference -* to the object, which includes a regular reference count. Callers -* will likely want to dereference the object afterwards. +* Create a handle for this object. This adds a handle reference to the object, +* which includes a regular reference count. Callers will likely want to +* dereference the object afterwards. +* +* Since this publishes @obj to userspace it must be fully set up by this point, +* drivers must call this last in their buffer object creation callbacks. */ int drm_gem_handle_create(struct drm_file *file_priv, struct drm_gem_object *obj,
Signature · 6 lines
2.16.2 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 1 line · Daniel Vetter
It published
s/It/If
Quoted 26 lines
the gem object to userspace, by that point other threads
can guess the id and start using it. And gem IDs are _very_ easy to guess (it's just an idr).Since gem objects is the only thing we allow drivers to create themselves (all the kms/prime/syncobj stuff is handled by the core) no other functions seem to be in need of this clarification.
Motivated by reviewing the xen-front kms driver.
Cc Oleksandr Andrushchenko <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_gem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem.c +0
-2@@ -436,9 +436,12 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,* @obj: object to register * @handlep: pionter to return the created handle to the caller * -* Create a handle for this object. This adds a handle reference -* to the object, which includes a regular reference count. Callers
drivers/gpu/drm/drm_gem.c drm_gem_handle_create_tail(struct drm_file *file_priv, · line 447
Quoted 10 lines
drivers/gpu/drm/drm_gem.c +6
-1-* will likely want to dereference the object afterwards. +* Create a handle for this object. This adds a handle reference to the object, +* which includes a regular reference count. Callers will likely want to +* dereference the object afterwards. +* +* Since this publishes @obj to userspace it must be fully set up by this point, +* drivers must call this last in their buffer object creation callbacks. */ int drm_gem_handle_create(struct drm_file *file_priv, struct drm_gem_object *obj,
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedQuoted 3 lines · Oleksandr Andrushchenko
Quoted 1 line · Daniel Vetter
It published
s/It/If
Doesn't make much sense to me, It = drm_gem_handle_create.
Quoted 30 lines
Quoted 30 lines
the gem object to userspace, by that point other threads
can guess the id and start using it. And gem IDs are _very_ easy to guess (it's just an idr).Since gem objects is the only thing we allow drivers to create themselves (all the kms/prime/syncobj stuff is handled by the core) no other functions seem to be in need of this clarification.
Motivated by reviewing the xen-front kms driver.
Cc Oleksandr Andrushchenko <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_gem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem.c +3
-3@@ -436,9 +436,12 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,* @obj: object to register * @handlep: pionter to return the created handle to the caller * -* Create a handle for this object. This adds a handle reference -* to the object, which includes a regular reference count. Callers -* will likely want to dereference the object afterwards. +* Create a handle for this object. This adds a handle reference to the object, +* which includes a regular reference count. Callers will likely want to +* dereference the object afterwards.
Quoted 8 lines
drivers/gpu/drm/drm_gem.c drm_gem_handle_create_tail(struct drm_file *file_priv, · line 447
Quoted 6 lines
drivers/gpu/drm/drm_gem.c +3
-0+* +* Since this publishes @obj to userspace it must be fully set up by this point, +* drivers must call this last in their buffer object creation callbacks. */ int drm_gem_handle_create(struct drm_file *file_priv, struct drm_gem_object *obj,Reviewed-by Oleksandr Andrushchenko <[email protected]>
Applied, thx for review.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel