* [PATCH] drm/gem: Document that handle_create must be the last step
@ 2018-03-22 8:02 Daniel Vetter
2018-03-22 8:12 ` Oleksandr Andrushchenko
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Vetter @ 2018-03-22 8:02 UTC (permalink / raw)
To: DRI Development; +Cc: Daniel Vetter, Daniel Vetter, Oleksandr Andrushchenko
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.
Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
drivers/gpu/drm/drm_gem.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 4975ba9a7bc8..4a16d7b26c89 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -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,
--
2.16.2
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/gem: Document that handle_create must be the last step
2018-03-22 8:02 [PATCH] drm/gem: Document that handle_create must be the last step Daniel Vetter
@ 2018-03-22 8:12 ` Oleksandr Andrushchenko
2018-03-26 15:42 ` Daniel Vetter
0 siblings, 1 reply; 3+ messages in thread
From: Oleksandr Andrushchenko @ 2018-03-22 8:12 UTC (permalink / raw)
To: Daniel Vetter, DRI Development; +Cc: Daniel Vetter
On 03/22/2018 10:02 AM, Daniel Vetter wrote:
> It published
s/It/If
> 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 <oleksandr_andrushchenko@epam.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
> drivers/gpu/drm/drm_gem.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 4975ba9a7bc8..4a16d7b26c89 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -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,
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/gem: Document that handle_create must be the last step
2018-03-22 8:12 ` Oleksandr Andrushchenko
@ 2018-03-26 15:42 ` Daniel Vetter
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2018-03-26 15:42 UTC (permalink / raw)
To: Oleksandr Andrushchenko; +Cc: Daniel Vetter, DRI Development, Daniel Vetter
On Thu, Mar 22, 2018 at 10:12:03AM +0200, Oleksandr Andrushchenko wrote:
> On 03/22/2018 10:02 AM, Daniel Vetter wrote:
> > It published
> s/It/If
Doesn't make much sense to me, It = drm_gem_handle_create.
> > 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 <oleksandr_andrushchenko@epam.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> > drivers/gpu/drm/drm_gem.c | 9 ++++++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> > index 4975ba9a7bc8..4a16d7b26c89 100644
> > --- a/drivers/gpu/drm/drm_gem.c
> > +++ b/drivers/gpu/drm/drm_gem.c
> > @@ -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,
>
> Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Applied, thx for review.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-26 15:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22 8:02 [PATCH] drm/gem: Document that handle_create must be the last step Daniel Vetter
2018-03-22 8:12 ` Oleksandr Andrushchenko
2018-03-26 15:42 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).