linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck
@ 2014-10-10 22:51 Amos Kong
  2014-10-10 22:51 ` [3.16 stable PATCH 1/2] virtio-rng: fix stuck of hot-unplugging busy device Amos Kong
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Amos Kong @ 2014-10-10 22:51 UTC (permalink / raw)
  To: stable; +Cc: rusty, amit.shah, gregkh, virtualization, linux-kernel

I received two mails about faile to apply patches to 3.16-stable tree:

FAILED: patch "[PATCH] virtio-rng: skip reading when we start to remove the device" failed to apply to 3.16-stable tree
FAILED: patch "[PATCH] virtio-rng: fix stuck of hot-unplugging busy device" failed to apply to 3.16-stable tree

Amit already backported two patches for 3.16-stable, then cherry-pick
of my two patches works.

Thanks.

Amos Kong (2):
  virtio-rng: fix stuck of hot-unplugging busy device
  virtio-rng: skip reading when we start to remove the device

 drivers/char/hw_random/virtio-rng.c | 7 +++++++
 1 file changed, 7 insertions(+)

-- 
1.9.3


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

* [3.16 stable PATCH 1/2] virtio-rng: fix stuck of hot-unplugging busy device
  2014-10-10 22:51 [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck Amos Kong
@ 2014-10-10 22:51 ` Amos Kong
  2014-10-10 22:51 ` [3.16 stable PATCH 2/2] virtio-rng: skip reading when we start to remove the device Amos Kong
  2014-11-04  4:32 ` [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck Amos Kong
  2 siblings, 0 replies; 7+ messages in thread
From: Amos Kong @ 2014-10-10 22:51 UTC (permalink / raw)
  To: stable; +Cc: rusty, amit.shah, gregkh, virtualization, linux-kernel

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 exits the waiting by completing have_data completion before
unregistering, resets data_avail to avoid the hwrng core use wrong
buffer bytes.

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from commit 3856e548372513665670ca5db60d9a74b970fe0d)
Signed-off-by: Amos Kong <akong@redhat.com>
---
 drivers/char/hw_random/virtio-rng.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index f1aa13b..b50252c 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -137,6 +137,8 @@ static void remove_common(struct virtio_device *vdev)
 {
 	struct virtrng_info *vi = vdev->priv;
 
+	vi->data_avail = 0;
+	complete(&vi->have_data);
 	vdev->config->reset(vdev);
 	vi->busy = false;
 	if (vi->hwrng_register_done)
-- 
1.9.3


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

* [3.16 stable PATCH 2/2] virtio-rng: skip reading when we start to remove the device
  2014-10-10 22:51 [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck Amos Kong
  2014-10-10 22:51 ` [3.16 stable PATCH 1/2] virtio-rng: fix stuck of hot-unplugging busy device Amos Kong
@ 2014-10-10 22:51 ` Amos Kong
  2014-11-04  4:32 ` [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck Amos Kong
  2 siblings, 0 replies; 7+ messages in thread
From: Amos Kong @ 2014-10-10 22:51 UTC (permalink / raw)
  To: stable; +Cc: rusty, amit.shah, gregkh, virtualization, linux-kernel

Before we really unregister the hwrng device, reading will get stuck if
the virtio device is reset. We should return error for reading when we
start to remove the device.

Signed-off-by: Amos Kong <akong@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from commit f49819560f53b7f3a596a8ea2e6764dc86695b62)
Signed-off-by: Amos Kong <akong@redhat.com>
---
 drivers/char/hw_random/virtio-rng.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index b50252c..cb1688a 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -37,6 +37,7 @@ struct virtrng_info {
 	char name[25];
 	int index;
 	bool hwrng_register_done;
+	bool hwrng_removed;
 };
 
 
@@ -69,6 +70,9 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait)
 	int ret;
 	struct virtrng_info *vi = (struct virtrng_info *)rng->priv;
 
+	if (vi->hwrng_removed)
+		return -ENODEV;
+
 	if (!vi->busy) {
 		vi->busy = true;
 		init_completion(&vi->have_data);
@@ -137,6 +141,7 @@ static void remove_common(struct virtio_device *vdev)
 {
 	struct virtrng_info *vi = vdev->priv;
 
+	vi->hwrng_removed = true;
 	vi->data_avail = 0;
 	complete(&vi->have_data);
 	vdev->config->reset(vdev);
-- 
1.9.3


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

* Re: [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck
  2014-10-10 22:51 [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck Amos Kong
  2014-10-10 22:51 ` [3.16 stable PATCH 1/2] virtio-rng: fix stuck of hot-unplugging busy device Amos Kong
  2014-10-10 22:51 ` [3.16 stable PATCH 2/2] virtio-rng: skip reading when we start to remove the device Amos Kong
@ 2014-11-04  4:32 ` Amos Kong
  2014-11-05 16:02   ` Luis Henriques
  2014-11-19  1:20   ` Greg KH
  2 siblings, 2 replies; 7+ messages in thread
From: Amos Kong @ 2014-11-04  4:32 UTC (permalink / raw)
  To: stable, gregkh; +Cc: rusty, amit.shah, virtualization, linux-kernel

On Sat, Oct 11, 2014 at 06:51:47AM +0800, Amos Kong wrote:
> I received two mails about faile to apply patches to 3.16-stable tree:
> 
> FAILED: patch "[PATCH] virtio-rng: skip reading when we start to remove the device" failed to apply to 3.16-stable tree
> FAILED: patch "[PATCH] virtio-rng: fix stuck of hot-unplugging busy device" failed to apply to 3.16-stable tree
> 
> Amit already backported two patches for 3.16-stable, then cherry-pick
> of my two patches works.
> 
> Thanks.

Ping Greg, thanks.
 
> Amos Kong (2):
>   virtio-rng: fix stuck of hot-unplugging busy device
>   virtio-rng: skip reading when we start to remove the device
> 
>  drivers/char/hw_random/virtio-rng.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> -- 
> 1.9.3
> 
> --
> 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/

-- 
			Amos.

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

* Re: [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck
  2014-11-04  4:32 ` [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck Amos Kong
@ 2014-11-05 16:02   ` Luis Henriques
  2014-11-05 16:14     ` Amos Kong
  2014-11-19  1:20   ` Greg KH
  1 sibling, 1 reply; 7+ messages in thread
From: Luis Henriques @ 2014-11-05 16:02 UTC (permalink / raw)
  To: Amos Kong; +Cc: stable, gregkh, rusty, amit.shah, virtualization, linux-kernel

Hi Amos

On Tue, Nov 04, 2014 at 12:32:27PM +0800, Amos Kong wrote:
> On Sat, Oct 11, 2014 at 06:51:47AM +0800, Amos Kong wrote:
> > I received two mails about faile to apply patches to 3.16-stable tree:
> > 
> > FAILED: patch "[PATCH] virtio-rng: skip reading when we start to remove the device" failed to apply to 3.16-stable tree
> > FAILED: patch "[PATCH] virtio-rng: fix stuck of hot-unplugging busy device" failed to apply to 3.16-stable tree
> > 
> > Amit already backported two patches for 3.16-stable, then cherry-pick
> > of my two patches works.
> > 
> > Thanks.
> 
> Ping Greg, thanks.
>  

I'm now doing the extended stable maintenance of the 3.16 kernel, as
Greg has EOL'ed it.

Anyway, I will be queuing these 2 patches for the extended 3.16
kernel.  Thank you!

Cheers,
--
Luís

> > Amos Kong (2):
> >   virtio-rng: fix stuck of hot-unplugging busy device
> >   virtio-rng: skip reading when we start to remove the device
> > 
> >  drivers/char/hw_random/virtio-rng.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > -- 
> > 1.9.3
> > 
> > --
> > 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/
> 
> -- 
> 			Amos.
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck
  2014-11-05 16:02   ` Luis Henriques
@ 2014-11-05 16:14     ` Amos Kong
  0 siblings, 0 replies; 7+ messages in thread
From: Amos Kong @ 2014-11-05 16:14 UTC (permalink / raw)
  To: Luis Henriques
  Cc: stable, gregkh, rusty, amit.shah, virtualization, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

On Wed, Nov 05, 2014 at 04:02:49PM +0000, Luis Henriques wrote:
> Hi Amos
> 
> On Tue, Nov 04, 2014 at 12:32:27PM +0800, Amos Kong wrote:
> > On Sat, Oct 11, 2014 at 06:51:47AM +0800, Amos Kong wrote:
> > > I received two mails about faile to apply patches to 3.16-stable tree:
> > > 
> > > FAILED: patch "[PATCH] virtio-rng: skip reading when we start to remove the device" failed to apply to 3.16-stable tree
> > > FAILED: patch "[PATCH] virtio-rng: fix stuck of hot-unplugging busy device" failed to apply to 3.16-stable tree
> > > 
> > > Amit already backported two patches for 3.16-stable, then cherry-pick
> > > of my two patches works.
> > > 
> > > Thanks.
> > 
> > Ping Greg, thanks.
> >  
> 
> I'm now doing the extended stable maintenance of the 3.16 kernel, as
> Greg has EOL'ed it.
> 
> Anyway, I will be queuing these 2 patches for the extended 3.16
> kernel.  Thank you!

Thanks a lot!
 
> Cheers,
> --
> Luís
> 
> > > Amos Kong (2):
> > >   virtio-rng: fix stuck of hot-unplugging busy device
> > >   virtio-rng: skip reading when we start to remove the device
> > > 
> > >  drivers/char/hw_random/virtio-rng.c | 7 +++++++
> > >  1 file changed, 7 insertions(+)

-- 
			Amos.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck
  2014-11-04  4:32 ` [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck Amos Kong
  2014-11-05 16:02   ` Luis Henriques
@ 2014-11-19  1:20   ` Greg KH
  1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2014-11-19  1:20 UTC (permalink / raw)
  To: Amos Kong; +Cc: stable, rusty, amit.shah, virtualization, linux-kernel

On Tue, Nov 04, 2014 at 12:32:27PM +0800, Amos Kong wrote:
> On Sat, Oct 11, 2014 at 06:51:47AM +0800, Amos Kong wrote:
> > I received two mails about faile to apply patches to 3.16-stable tree:
> > 
> > FAILED: patch "[PATCH] virtio-rng: skip reading when we start to remove the device" failed to apply to 3.16-stable tree
> > FAILED: patch "[PATCH] virtio-rng: fix stuck of hot-unplugging busy device" failed to apply to 3.16-stable tree
> > 
> > Amit already backported two patches for 3.16-stable, then cherry-pick
> > of my two patches works.
> > 
> > Thanks.
> 
> Ping Greg, thanks.

Why me?  3.16-stable is end-of-life, I'm no longer maintaining it, so
what can I do here with these patches?

confused,

greg k-h

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

end of thread, other threads:[~2014-11-19  1:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-10 22:51 [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck Amos Kong
2014-10-10 22:51 ` [3.16 stable PATCH 1/2] virtio-rng: fix stuck of hot-unplugging busy device Amos Kong
2014-10-10 22:51 ` [3.16 stable PATCH 2/2] virtio-rng: skip reading when we start to remove the device Amos Kong
2014-11-04  4:32 ` [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck Amos Kong
2014-11-05 16:02   ` Luis Henriques
2014-11-05 16:14     ` Amos Kong
2014-11-19  1:20   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).