All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: virtualization@lists.linux-foundation.org
Cc: amit.shah@redhat.com, stable@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] virtio-rng: complete have_data completion in removing device
Date: Wed, 6 Aug 2014 16:05:41 +0800	[thread overview]
Message-ID: <20140806080541.GA3304@z.redhat.com> (raw)
In-Reply-To: <1407260115-26767-1-git-send-email-akong@redhat.com>

On Wed, Aug 06, 2014 at 01:35:15AM +0800, Amos Kong wrote:
> When we try to hot-remove a busy virtio-rng device from QEMU monitor,
> the device can't be hot-removed. Because virtio-rng driver hangs at
> wait_for_completion_killable().
> 
> This patch fixed the hang by completing have_data completion before
> unregistering a virtio-rng device.

Hi Amit,

Before applying this patch, it's blocking insider wait_for_completion_killable()                     
Applied this patch, wait_for_completion_killable() returns 0,
and vi->data_avail becomes 0, then rng_get_date() will return 0.

Is it expected result?

 
> Signed-off-by: Amos Kong <akong@redhat.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/char/hw_random/virtio-rng.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
> index 0027137..416b15c 100644
> --- a/drivers/char/hw_random/virtio-rng.c
> +++ b/drivers/char/hw_random/virtio-rng.c
> @@ -137,6 +137,7 @@ static void remove_common(struct virtio_device *vdev)
>  	struct virtrng_info *vi = vdev->priv;
>  
>  	vdev->config->reset(vdev);
> +	complete(&vi->have_data);
>  	vi->busy = false;
>  	if (vi->hwrng_register_done)
>  		hwrng_unregister(&vi->hwrng);
> -- 
> 1.9.3
> 
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization

-- 
			Amos.

WARNING: multiple messages have this Message-ID (diff)
From: Amos Kong <akong@redhat.com>
To: virtualization@lists.linux-foundation.org
Cc: amit.shah@redhat.com, kvm@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] virtio-rng: complete have_data completion in removing device
Date: Wed, 6 Aug 2014 16:05:41 +0800	[thread overview]
Message-ID: <20140806080541.GA3304@z.redhat.com> (raw)
In-Reply-To: <1407260115-26767-1-git-send-email-akong@redhat.com>

On Wed, Aug 06, 2014 at 01:35:15AM +0800, Amos Kong wrote:
> When we try to hot-remove a busy virtio-rng device from QEMU monitor,
> the device can't be hot-removed. Because virtio-rng driver hangs at
> wait_for_completion_killable().
> 
> This patch fixed the hang by completing have_data completion before
> unregistering a virtio-rng device.

Hi Amit,

Before applying this patch, it's blocking insider wait_for_completion_killable()                     
Applied this patch, wait_for_completion_killable() returns 0,
and vi->data_avail becomes 0, then rng_get_date() will return 0.

Is it expected result?

 
> Signed-off-by: Amos Kong <akong@redhat.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/char/hw_random/virtio-rng.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
> index 0027137..416b15c 100644
> --- a/drivers/char/hw_random/virtio-rng.c
> +++ b/drivers/char/hw_random/virtio-rng.c
> @@ -137,6 +137,7 @@ static void remove_common(struct virtio_device *vdev)
>  	struct virtrng_info *vi = vdev->priv;
>  
>  	vdev->config->reset(vdev);
> +	complete(&vi->have_data);
>  	vi->busy = false;
>  	if (vi->hwrng_register_done)
>  		hwrng_unregister(&vi->hwrng);
> -- 
> 1.9.3
> 
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization

-- 
			Amos.

  reply	other threads:[~2014-08-06  8:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05 17:35 [PATCH] virtio-rng: complete have_data completion in removing device Amos Kong
2014-08-05 17:35 ` Amos Kong
2014-08-06  8:05 ` Amos Kong [this message]
2014-08-06  8:05   ` Amos Kong
2014-08-06  8:25   ` Amit Shah
2014-08-06  8:25     ` Amit Shah
2014-09-08 15:29     ` Amos Kong
2014-09-08 15:29       ` Amos Kong
2014-09-09 10:47       ` Amos Kong
2014-09-09 10:47         ` Amos Kong

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=20140806080541.GA3304@z.redhat.com \
    --to=akong@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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 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.