All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] fix memory leak in virtio_gpu_resource_destroy
@ 2016-11-24 12:30 Li Qiang
  2016-11-24 12:30 ` [Qemu-devel] [PATCH 1/2] virtio-gpu: add declaration for virtio_gpu_cleanup_mapping function Li Qiang
  2016-11-24 12:30 ` [Qemu-devel] [PATCH 2/2] virtio-gpu: call cleanup mapping function in resource destroy Li Qiang
  0 siblings, 2 replies; 4+ messages in thread
From: Li Qiang @ 2016-11-24 12:30 UTC (permalink / raw)
  To: kraxel, marcandre.lureau, qemu-devel; +Cc: liqiang6-s, Li Qiang

If the guest destroy the resource before detach banking, the 'iov'
and 'addrs' field in resource is not freed thus leading memory
leak issue. This patchset address this.

Li Qiang (2):
  virtio-gpu: add declaration for virtio_gpu_cleanup_mapping function
  virtio-gpu: call cleanup mapping function in resource destroy

 hw/display/virtio-gpu.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 1/2] virtio-gpu: add declaration for virtio_gpu_cleanup_mapping function
  2016-11-24 12:30 [Qemu-devel] [PATCH 0/2] fix memory leak in virtio_gpu_resource_destroy Li Qiang
@ 2016-11-24 12:30 ` Li Qiang
  2016-11-24 12:30 ` [Qemu-devel] [PATCH 2/2] virtio-gpu: call cleanup mapping function in resource destroy Li Qiang
  1 sibling, 0 replies; 4+ messages in thread
From: Li Qiang @ 2016-11-24 12:30 UTC (permalink / raw)
  To: kraxel, marcandre.lureau, qemu-devel; +Cc: liqiang6-s, Li Qiang

The virtio_gpu_resource_destroy function is before the definition
of the cleanup mapping function and it should call this cleanup
mapping function, so we should add a declaration for it.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
 hw/display/virtio-gpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 60bce94..cc725a6 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -28,6 +28,8 @@
 static struct virtio_gpu_simple_resource*
 virtio_gpu_find_resource(VirtIOGPU *g, uint32_t resource_id);
 
+static void virtio_gpu_cleanup_mapping(struct virtio_gpu_simple_resource *res);
+
 #ifdef CONFIG_VIRGL
 #include <virglrenderer.h>
 #define VIRGL(_g, _virgl, _simple, ...)                     \
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Qemu-devel] [PATCH 2/2] virtio-gpu: call cleanup mapping function in resource destroy
  2016-11-24 12:30 [Qemu-devel] [PATCH 0/2] fix memory leak in virtio_gpu_resource_destroy Li Qiang
  2016-11-24 12:30 ` [Qemu-devel] [PATCH 1/2] virtio-gpu: add declaration for virtio_gpu_cleanup_mapping function Li Qiang
@ 2016-11-24 12:30 ` Li Qiang
  2016-11-28 12:44   ` Marc-André Lureau
  1 sibling, 1 reply; 4+ messages in thread
From: Li Qiang @ 2016-11-24 12:30 UTC (permalink / raw)
  To: kraxel, marcandre.lureau, qemu-devel; +Cc: liqiang6-s, Li Qiang

If the guest destroy the resource before detach banking, the 'iov'
and 'addrs' field in resource is not freed thus leading memory
leak issue. This patch avoid this.

Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
 hw/display/virtio-gpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index cc725a6..98dadf2 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -360,6 +360,7 @@ static void virtio_gpu_resource_destroy(VirtIOGPU *g,
                                         struct virtio_gpu_simple_resource *res)
 {
     pixman_image_unref(res->image);
+    virtio_gpu_cleanup_mapping(res);
     QTAILQ_REMOVE(&g->reslist, res, next);
     g_free(res);
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] virtio-gpu: call cleanup mapping function in resource destroy
  2016-11-24 12:30 ` [Qemu-devel] [PATCH 2/2] virtio-gpu: call cleanup mapping function in resource destroy Li Qiang
@ 2016-11-28 12:44   ` Marc-André Lureau
  0 siblings, 0 replies; 4+ messages in thread
From: Marc-André Lureau @ 2016-11-28 12:44 UTC (permalink / raw)
  To: Li Qiang, kraxel, qemu-devel; +Cc: liqiang6-s

Hi

On Thu, Nov 24, 2016 at 4:30 PM Li Qiang <liq3ea@gmail.com> wrote:

> If the guest destroy the resource before detach banking, the 'iov'
> and 'addrs' field in resource is not freed thus leading memory
> leak issue. This patch avoid this.
>
>

That looks correct to me.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


Please squash patch 1 (no reason for it to be split).




> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> ---
>  hw/display/virtio-gpu.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index cc725a6..98dadf2 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -360,6 +360,7 @@ static void virtio_gpu_resource_destroy(VirtIOGPU *g,
>                                          struct virtio_gpu_simple_resource
> *res)
>  {
>      pixman_image_unref(res->image);
> +    virtio_gpu_cleanup_mapping(res);
>      QTAILQ_REMOVE(&g->reslist, res, next);
>      g_free(res);
>  }
> --
> 1.8.3.1
>
> --
Marc-André Lureau

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-28 12:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-24 12:30 [Qemu-devel] [PATCH 0/2] fix memory leak in virtio_gpu_resource_destroy Li Qiang
2016-11-24 12:30 ` [Qemu-devel] [PATCH 1/2] virtio-gpu: add declaration for virtio_gpu_cleanup_mapping function Li Qiang
2016-11-24 12:30 ` [Qemu-devel] [PATCH 2/2] virtio-gpu: call cleanup mapping function in resource destroy Li Qiang
2016-11-28 12:44   ` Marc-André Lureau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.