public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, stable@vger.kernel.org
Subject: Re: [PATCH v3 1/3] drm/prime: Pass the right module owner through to dma_buf_export()
Date: Fri, 30 Sep 2016 16:22:20 +0200	[thread overview]
Message-ID: <4ff14f91-e5d7-9cc6-5429-ee599ead79ef@amd.com> (raw)
In-Reply-To: <20160930135959.9159-1-chris@chris-wilson.co.uk>

Am 30.09.2016 um 15:59 schrieb Chris Wilson:
> dma_buf_export() adds a reference to the owning module to the dmabuf (to
> prevent the driver from being unloaded whilst a third party still refers
> to the dmabuf). However, drm_gem_prime_export() was passing its own
> THIS_MODULE (i.e. drm.ko) rather than the driver. Extract the right
> owner from the device->fops instead.
>
> v2: Use C99 initializers to zero out unset elements of
> dma_buf_export_info
> v3: Extract the right module from dev->fops.
>
> Testcase: igt/vgem_basic/unload
> Reported-by: Petri Latvala <petri.latvala@intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Petri Latvala <petri.latvala@intel.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: stable@vger.kernel.org
> Tested-by: Petri Latvala <petri.latvala@intel.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/drm_prime.c | 17 ++++++++++-------
>   include/drm/drmP.h          |  3 ++-
>   2 files changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index 57201d68cf61..80907b34d857 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -397,14 +397,17 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
>    * using the PRIME helpers.
>    */
>   struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
> -				     struct drm_gem_object *obj, int flags)
> +				     struct drm_gem_object *obj,
> +				     int flags)
>   {
> -	DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
> -
> -	exp_info.ops = &drm_gem_prime_dmabuf_ops;
> -	exp_info.size = obj->size;
> -	exp_info.flags = flags;
> -	exp_info.priv = obj;
> +	struct dma_buf_export_info exp_info = {
> +		.exp_name = KBUILD_MODNAME, /* white lie for debug */
> +		.owner = dev->driver->fops->owner,
> +		.ops = &drm_gem_prime_dmabuf_ops,
> +		.size = obj->size,
> +		.flags = flags,
> +		.priv = obj,
> +	};
>   
>   	if (dev->driver->gem_prime_res_obj)
>   		exp_info.resv = dev->driver->gem_prime_res_obj(obj);
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 0e99669159c1..81fcd553edf7 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -1012,7 +1012,8 @@ static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
>   #endif
>   
>   extern struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
> -		struct drm_gem_object *obj, int flags);
> +					    struct drm_gem_object *obj,
> +					    int flags);
>   extern int drm_gem_prime_handle_to_fd(struct drm_device *dev,
>   		struct drm_file *file_priv, uint32_t handle, uint32_t flags,
>   		int *prime_fd);


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-09-30 14:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-30 13:59 [PATCH v3 1/3] drm/prime: Pass the right module owner through to dma_buf_export() Chris Wilson
2016-09-30 13:59 ` [PATCH v3 2/3] drm/prime: Take a ref on the drm_dev when exporting a dma_buf Chris Wilson
2016-09-30 13:59 ` [PATCH v3 3/3] drm/vgem: Keep a reference to the dmabuf when mmaped Chris Wilson
2016-10-05 13:11   ` Daniel Vetter
2016-10-05 13:40     ` Chris Wilson
2016-10-05 13:42       ` Daniel Vetter
2016-09-30 14:22 ` Christian König [this message]
2016-09-30 14:49 ` ✗ Fi.CI.BAT: warning for series starting with [v3,1/3] drm/prime: Pass the right module owner through to dma_buf_export() Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ff14f91-e5d7-9cc6-5429-ee599ead79ef@amd.com \
    --to=christian.koenig@amd.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox