2014-10-10 22:51:55

by Amos Kong

[permalink] [raw]
Subject: [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck

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


2014-10-10 22:51:59

by Amos Kong

[permalink] [raw]
Subject: [3.16 stable PATCH 1/2] virtio-rng: fix stuck of hot-unplugging busy device

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 <[email protected]>
Reviewed-by: Amit Shah <[email protected]>
Cc: [email protected]
Signed-off-by: Rusty Russell <[email protected]>
(cherry picked from commit 3856e548372513665670ca5db60d9a74b970fe0d)
Signed-off-by: Amos Kong <[email protected]>
---
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

2014-10-10 22:52:06

by Amos Kong

[permalink] [raw]
Subject: [3.16 stable PATCH 2/2] virtio-rng: skip reading when we start to remove the device

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 <[email protected]>
Reviewed-by: Amit Shah <[email protected]>
Cc: [email protected]
Signed-off-by: Rusty Russell <[email protected]>
(cherry picked from commit f49819560f53b7f3a596a8ea2e6764dc86695b62)
Signed-off-by: Amos Kong <[email protected]>
---
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

2014-11-04 04:32:36

by Amos Kong

[permalink] [raw]
Subject: Re: [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck

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 [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

--
Amos.

2014-11-05 16:02:58

by Luis Henriques

[permalink] [raw]
Subject: Re: [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck

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 [email protected]
> > 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 [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2014-11-05 16:14:21

by Amos Kong

[permalink] [raw]
Subject: Re: [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck

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.


Attachments:
(No filename) (1.16 kB)
signature.asc (819.00 B)
Digital signature
Download all attachments

2014-11-19 01:20:24

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [3.16 stable PATCH 0/2] virtio-rng: two backports to fix stuck

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