Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1200473 > unrolled thread

[PATCH] virtio-input: reset device during remove

Started byJason Wang <jasowang@redhat.com>
First post2015-08-05 09:30 +0200
Last post2015-08-05 10:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] virtio-input: reset device during remove Jason Wang <jasowang@redhat.com> - 2015-08-05 09:30 +0200
    Re: [PATCH] virtio-input: reset device during remove "Michael S. Tsirkin" <mst@redhat.com> - 2015-08-05 10:00 +0200
      Re: [PATCH] virtio-input: reset device during remove Jason Wang <jasowang@redhat.com> - 2015-08-05 10:20 +0200

#1200473 — [PATCH] virtio-input: reset device during remove

FromJason Wang <jasowang@redhat.com>
Date2015-08-05 09:30 +0200
Subject[PATCH] virtio-input: reset device during remove
Message-ID<pU1jc-2Rg-11@gated-at.bofh.it>
Spec requires a device reset during cleanup, so do it and avoid warn
in virtio core.

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/virtio/virtio_input.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c
index 60e2a16..6222f9b 100644
--- a/drivers/virtio/virtio_input.c
+++ b/drivers/virtio/virtio_input.c
@@ -320,6 +320,7 @@ static void virtinput_remove(struct virtio_device *vdev)
 	spin_unlock_irqrestore(&vi->lock, flags);
 
 	input_unregister_device(vi->idev);
+	vdev->config->reset(vdev);
 	vdev->config->del_vqs(vdev);
 	kfree(vi);
 }
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1200491

From"Michael S. Tsirkin" <mst@redhat.com>
Date2015-08-05 10:00 +0200
Message-ID<pU1Me-3p8-7@gated-at.bofh.it>
In reply to#1200473
On Wed, Aug 05, 2015 at 03:20:18PM +0800, Jason Wang wrote:
> Spec requires a device reset during cleanup, so do it and avoid warn
> in virtio core.
> 
> Signed-off-by: Jason Wang <jasowang@redhat.com>

OK but now that I look at this driver, that's not enough.

Need to also detach and free unused buffers, otherwise
we leak memory in evt and sts queues.



> ---
>  drivers/virtio/virtio_input.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/virtio/virtio_input.c b/drivers/virtio/virtio_input.c
> index 60e2a16..6222f9b 100644
> --- a/drivers/virtio/virtio_input.c
> +++ b/drivers/virtio/virtio_input.c
> @@ -320,6 +320,7 @@ static void virtinput_remove(struct virtio_device *vdev)
>  	spin_unlock_irqrestore(&vi->lock, flags);
>  
>  	input_unregister_device(vi->idev);
> +	vdev->config->reset(vdev);
>  	vdev->config->del_vqs(vdev);
>  	kfree(vi);
>  }
> -- 
> 2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1200512

FromJason Wang <jasowang@redhat.com>
Date2015-08-05 10:20 +0200
Message-ID<pU25z-411-1@gated-at.bofh.it>
In reply to#1200491

On 08/05/2015 03:56 PM, Michael S. Tsirkin wrote:
> On Wed, Aug 05, 2015 at 03:20:18PM +0800, Jason Wang wrote:
>> > Spec requires a device reset during cleanup, so do it and avoid warn
>> > in virtio core.
>> > 
>> > Signed-off-by: Jason Wang <jasowang@redhat.com>
> OK but now that I look at this driver, that's not enough.
>
> Need to also detach and free unused buffers, otherwise
> we leak memory in evt and sts queues.

Probably only sts. For evt queue, all buffer it used was an array
embedded in virtio_input structure (vi->evts[])
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web