All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio-input: reset device during remove
@ 2015-08-05  7:20 Jason Wang
  2015-08-05  7:56 ` Michael S. Tsirkin
  2015-08-05  7:56 ` Michael S. Tsirkin
  0 siblings, 2 replies; 6+ messages in thread
From: Jason Wang @ 2015-08-05  7:20 UTC (permalink / raw)
  To: virtualization, linux-kernel; +Cc: kraxel, mst, Jason Wang

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


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

* [PATCH] virtio-input: reset device during remove
@ 2015-08-05  7:20 Jason Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Wang @ 2015-08-05  7:20 UTC (permalink / raw)
  To: virtualization, linux-kernel; +Cc: mst

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

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

* Re: [PATCH] virtio-input: reset device during remove
  2015-08-05  7:20 [PATCH] virtio-input: reset device during remove Jason Wang
@ 2015-08-05  7:56 ` Michael S. Tsirkin
  2015-08-05  7:56 ` Michael S. Tsirkin
  1 sibling, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2015-08-05  7:56 UTC (permalink / raw)
  To: Jason Wang; +Cc: linux-kernel, virtualization

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

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

* Re: [PATCH] virtio-input: reset device during remove
  2015-08-05  7:20 [PATCH] virtio-input: reset device during remove Jason Wang
  2015-08-05  7:56 ` Michael S. Tsirkin
@ 2015-08-05  7:56 ` Michael S. Tsirkin
  2015-08-05  8:18     ` Jason Wang
  1 sibling, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2015-08-05  7:56 UTC (permalink / raw)
  To: Jason Wang; +Cc: virtualization, linux-kernel, kraxel

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

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

* Re: [PATCH] virtio-input: reset device during remove
  2015-08-05  7:56 ` Michael S. Tsirkin
@ 2015-08-05  8:18     ` Jason Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Wang @ 2015-08-05  8:18 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: linux-kernel, virtualization



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[])

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

* Re: [PATCH] virtio-input: reset device during remove
@ 2015-08-05  8:18     ` Jason Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Wang @ 2015-08-05  8:18 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: virtualization, linux-kernel, kraxel



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[])

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

end of thread, other threads:[~2015-08-05  8:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-05  7:20 [PATCH] virtio-input: reset device during remove Jason Wang
2015-08-05  7:56 ` Michael S. Tsirkin
2015-08-05  7:56 ` Michael S. Tsirkin
2015-08-05  8:18   ` Jason Wang
2015-08-05  8:18     ` Jason Wang
  -- strict thread matches above, loose matches on Subject: below --
2015-08-05  7:20 Jason Wang

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.