2020-07-21 10:20:13

by 何鑫

[permalink] [raw]
Subject: [PATCH v3] drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()

From: Qi Liu <[email protected]>

We should put the reference count of the fence after calling
virtio_gpu_cmd_submit(). So add the missing dma_fence_put().

Fixes: 2cd7b6f08bc4 ("drm/virtio: add in/out fence support for explicit synchronization")
Co-developed-by: Xin He <[email protected]>
Signed-off-by: Xin He <[email protected]>
Signed-off-by: Qi Liu <[email protected]>
Reviewed-by: Muchun Song <[email protected]>
---

changelog in v3:
1) Change the subject from "drm/virtio: fixed memory leak in virtio_gpu_execbuffer_ioctl()" to
"drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()"
2) Rework the commit log

changelog in v2:
1) Add a change description

drivers/gpu/drm/virtio/virtgpu_ioctl.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 5df722072ba0..19c5bc01eb79 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -179,6 +179,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,

virtio_gpu_cmd_submit(vgdev, buf, exbuf->size,
vfpriv->ctx_id, buflist, out_fence);
+ dma_fence_put(&out_fence->f);
virtio_gpu_notify(vgdev);
return 0;

--
2.21.1 (Apple Git-122.3)


2020-07-29 07:39:39

by Muchun Song

[permalink] [raw]
Subject: Re: [PATCH v3] drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()

On Tue, Jul 21, 2020 at 6:17 PM Xin He <[email protected]> wrote:
>
> From: Qi Liu <[email protected]>
>
> We should put the reference count of the fence after calling
> virtio_gpu_cmd_submit(). So add the missing dma_fence_put().
>
> Fixes: 2cd7b6f08bc4 ("drm/virtio: add in/out fence support for explicit synchronization")
> Co-developed-by: Xin He <[email protected]>
> Signed-off-by: Xin He <[email protected]>
> Signed-off-by: Qi Liu <[email protected]>
> Reviewed-by: Muchun Song <[email protected]>
> ---
>
> changelog in v3:
> 1) Change the subject from "drm/virtio: fixed memory leak in virtio_gpu_execbuffer_ioctl()" to
> "drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()"
> 2) Rework the commit log
>
> changelog in v2:
> 1) Add a change description
>
> drivers/gpu/drm/virtio/virtgpu_ioctl.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index 5df722072ba0..19c5bc01eb79 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -179,6 +179,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
>
> virtio_gpu_cmd_submit(vgdev, buf, exbuf->size,
> vfpriv->ctx_id, buflist, out_fence);
> + dma_fence_put(&out_fence->f);
> virtio_gpu_notify(vgdev);
> return 0;
>
> --
> 2.21.1 (Apple Git-122.3)
>

Ping guys. Any comments or suggestions?

--
Yours,
Muchun

2020-08-07 03:01:43

by 何鑫

[permalink] [raw]
Subject: Re: [PATCH v3] drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()

Xin He <[email protected]> 于2020年7月21日周二 下午6:17写道:
>
> From: Qi Liu <[email protected]>
>
> We should put the reference count of the fence after calling
> virtio_gpu_cmd_submit(). So add the missing dma_fence_put().
>
> Fixes: 2cd7b6f08bc4 ("drm/virtio: add in/out fence support for explicit synchronization")
> Co-developed-by: Xin He <[email protected]>
> Signed-off-by: Xin He <[email protected]>
> Signed-off-by: Qi Liu <[email protected]>
> Reviewed-by: Muchun Song <[email protected]>
> ---
>
> changelog in v3:
> 1) Change the subject from "drm/virtio: fixed memory leak in virtio_gpu_execbuffer_ioctl()" to
> "drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()"
> 2) Rework the commit log
>
> changelog in v2:
> 1) Add a change description
>
> drivers/gpu/drm/virtio/virtgpu_ioctl.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index 5df722072ba0..19c5bc01eb79 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -179,6 +179,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
>
> virtio_gpu_cmd_submit(vgdev, buf, exbuf->size,
> vfpriv->ctx_id, buflist, out_fence);
> + dma_fence_put(&out_fence->f);
> virtio_gpu_notify(vgdev);
> return 0;
>
> --
> 2.21.1 (Apple Git-122.3)
>

cc Greg

--
Xin He

2020-08-07 05:53:58

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v3] drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()

On Fri, Aug 07, 2020 at 11:00:11AM +0800, 何鑫 wrote:
> Xin He <[email protected]> 于2020年7月21日周二 下午6:17写道:
> >
> > From: Qi Liu <[email protected]>
> >
> > We should put the reference count of the fence after calling
> > virtio_gpu_cmd_submit(). So add the missing dma_fence_put().
> >
> > Fixes: 2cd7b6f08bc4 ("drm/virtio: add in/out fence support for explicit synchronization")
> > Co-developed-by: Xin He <[email protected]>
> > Signed-off-by: Xin He <[email protected]>
> > Signed-off-by: Qi Liu <[email protected]>
> > Reviewed-by: Muchun Song <[email protected]>
> > ---
> >
> > changelog in v3:
> > 1) Change the subject from "drm/virtio: fixed memory leak in virtio_gpu_execbuffer_ioctl()" to
> > "drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()"
> > 2) Rework the commit log
> >
> > changelog in v2:
> > 1) Add a change description
> >
> > drivers/gpu/drm/virtio/virtgpu_ioctl.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > index 5df722072ba0..19c5bc01eb79 100644
> > --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> > @@ -179,6 +179,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
> >
> > virtio_gpu_cmd_submit(vgdev, buf, exbuf->size,
> > vfpriv->ctx_id, buflist, out_fence);
> > + dma_fence_put(&out_fence->f);
> > virtio_gpu_notify(vgdev);
> > return 0;
> >
> > --
> > 2.21.1 (Apple Git-122.3)
> >
>
> cc Greg

Why?

$ ./scripts/get_maintainer.pl --file drivers/gpu/drm/virtio/virtgpu_ioctl.c
David Airlie <[email protected]> (maintainer:VIRTIO GPU DRIVER)
Gerd Hoffmann <[email protected]> (maintainer:VIRTIO GPU DRIVER)
Daniel Vetter <[email protected]> (maintainer:DRM DRIVERS)
Sumit Semwal <[email protected]> (maintainer:DMA BUFFER SHARING FRAMEWORK)
"Christian König" <[email protected]> (maintainer:DMA BUFFER SHARING FRAMEWORK)
[email protected] (open list:VIRTIO GPU DRIVER)
[email protected] (open list:VIRTIO GPU DRIVER)
[email protected] (open list)
[email protected] (open list:DMA BUFFER SHARING FRAMEWORK)
[email protected] (moderated list:DMA BUFFER SHARING FRAMEWORK)

2020-08-07 11:58:43

by Gerd Hoffmann

[permalink] [raw]
Subject: Re: [PATCH v3] drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()

On Tue, Jul 21, 2020 at 06:16:47PM +0800, Xin He wrote:
> From: Qi Liu <[email protected]>
>
> We should put the reference count of the fence after calling
> virtio_gpu_cmd_submit(). So add the missing dma_fence_put().

> virtio_gpu_cmd_submit(vgdev, buf, exbuf->size,
> vfpriv->ctx_id, buflist, out_fence);
> + dma_fence_put(&out_fence->f);
> virtio_gpu_notify(vgdev);

Pushed to drm-misc-fixes.

thanks,
Gerd