Displaying 14 results from an estimated 14 matches for "hwrng_removed".
2014 Sep 10
0
[PATCH v3 2/2] virtio-rng: skip reading when we start to remove the device
...ff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
index 849b228..132c9cc 100644
--- a/drivers/char/hw_random/virtio-rng.c
+++ b/drivers/char/hw_random/virtio-rng.c
@@ -36,6 +36,7 @@ struct virtrng_info {
int index;
bool busy;
bool hwrng_register_done;
+ bool hwrng_removed;
};
@@ -68,6 +69,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(&...
2014 Sep 10
4
[PATCH v3 0/2] virtio-rng: fix hotunplug
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1121540
When we try to hot-unplugging a busy virtio-rng device, the device
can't be removed. And the reading process in guest gets stuck.
Those two patches fixed this issue by completing have_data completion
and preventing invalid reading.
Thanks for the help of Amit.
Cc: stable at vger.kernel.org
V2: reset data_avail (Amit)
adjust
2014 Sep 10
4
[PATCH v3 0/2] virtio-rng: fix hotunplug
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1121540
When we try to hot-unplugging a busy virtio-rng device, the device
can't be removed. And the reading process in guest gets stuck.
Those two patches fixed this issue by completing have_data completion
and preventing invalid reading.
Thanks for the help of Amit.
Cc: stable at vger.kernel.org
V2: reset data_avail (Amit)
adjust
2014 Oct 10
5
[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
2014 Oct 10
5
[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
2017 Sep 26
0
[PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.
...hich can let mutex to be used by other
threads waiting if any?
rng_dev_read
rng_get_data
virtio_read
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);
register_buffer(vi, buf, size);
}
if (!wait)
return 0;
ret = wait_for_completion_killab...
2020 Aug 11
0
[PATCH v2] virtio-rng: return available data with O_NONBLOCK
.....984713b35892 100644
>>>> --- a/drivers/char/hw_random/virtio-rng.c
>>>> +++ b/drivers/char/hw_random/virtio-rng.c
>>>> @@ -59,6 +59,20 @@ static int virtio_read(struct hwrng *rng, void
>>>> *buf, size_t size, bool wait)
>>>> if (vi->hwrng_removed)
>>>> return -ENODEV;
>>>>
>>>> + /*
>>>> + * If the previous call was non-blocking, we may have got some
>>>> + * randomness already.
>>>> + */
>>>> + if (vi->busy && completion_done(&vi->...
2020 Aug 11
0
[PATCH v2] virtio-rng: return available data with O_NONBLOCK
...a6e47b5fbc..984713b35892 100644
> > > --- a/drivers/char/hw_random/virtio-rng.c
> > > +++ b/drivers/char/hw_random/virtio-rng.c
> > > @@ -59,6 +59,20 @@ static int virtio_read(struct hwrng *rng, void
> > > *buf, size_t size, bool wait)
> > > if (vi->hwrng_removed)
> > > return -ENODEV;
> > >
> > > + /*
> > > + * If the previous call was non-blocking, we may have got some
> > > + * randomness already.
> > > + */
> > > + if (vi->busy && completion_done(&vi->have_data)) {...
2020 Aug 11
2
[PATCH v2] virtio-rng: return available data with O_NONBLOCK
.../hw_random/virtio-rng.c
>>>>>> +++ b/drivers/char/hw_random/virtio-rng.c
>>>>>> @@ -59,6 +59,20 @@ static int virtio_read(struct hwrng *rng,
>>>>>> void
>>>>>> *buf, size_t size, bool wait)
>>>>>> if (vi->hwrng_removed)
>>>>>> return -ENODEV;
>>>>>>
>>>>>> + /*
>>>>>> + * If the previous call was non-blocking, we may have
>>>>>> got some
>>>>>> + * randomness already.
>>>>>> + */
&...
2020 Aug 11
2
[PATCH v2] virtio-rng: return available data with O_NONBLOCK
.../hw_random/virtio-rng.c
>>>>>> +++ b/drivers/char/hw_random/virtio-rng.c
>>>>>> @@ -59,6 +59,20 @@ static int virtio_read(struct hwrng *rng,
>>>>>> void
>>>>>> *buf, size_t size, bool wait)
>>>>>> if (vi->hwrng_removed)
>>>>>> return -ENODEV;
>>>>>>
>>>>>> + /*
>>>>>> + * If the previous call was non-blocking, we may have
>>>>>> got some
>>>>>> + * randomness already.
>>>>>> + */
&...
2020 Aug 11
0
[PATCH v2] virtio-rng: return available data with O_NONBLOCK
...g.c b/drivers/char/hw_random/virtio-rng.c
> index 79a6e47b5fbc..984713b35892 100644
> --- a/drivers/char/hw_random/virtio-rng.c
> +++ b/drivers/char/hw_random/virtio-rng.c
> @@ -59,6 +59,20 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait)
> if (vi->hwrng_removed)
> return -ENODEV;
>
> + /*
> + * If the previous call was non-blocking, we may have got some
> + * randomness already.
> + */
> + if (vi->busy && completion_done(&vi->have_data)) {
> + unsigned int len;
> +
> + vi->busy = false;
> +...
2020 Aug 11
0
[PATCH v2] virtio-rng: return available data with O_NONBLOCK
...w_random/virtio-rng.c
>> index 79a6e47b5fbc..984713b35892 100644
>> --- a/drivers/char/hw_random/virtio-rng.c
>> +++ b/drivers/char/hw_random/virtio-rng.c
>> @@ -59,6 +59,20 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait)
>> if (vi->hwrng_removed)
>> return -ENODEV;
>>
>> + /*
>> + * If the previous call was non-blocking, we may have got some
>> + * randomness already.
>> + */
>> + if (vi->busy && completion_done(&vi->have_data)) {
>> + unsigned int len;
>> +
&...
2017 Sep 25
2
[PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.
A bit late to a party, but:
On Mon, Dec 8, 2014 at 12:50 AM, Amos Kong <akong at redhat.com> wrote:
> From: Rusty Russell <rusty at rustcorp.com.au>
>
> There's currently a big lock around everything, and it means that we
> can't query sysfs (eg /sys/devices/virtual/misc/hw_random/rng_current)
> while the rng is reading. This is a real problem when the rng is
2017 Sep 25
2
[PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.
A bit late to a party, but:
On Mon, Dec 8, 2014 at 12:50 AM, Amos Kong <akong at redhat.com> wrote:
> From: Rusty Russell <rusty at rustcorp.com.au>
>
> There's currently a big lock around everything, and it means that we
> can't query sysfs (eg /sys/devices/virtual/misc/hw_random/rng_current)
> while the rng is reading. This is a real problem when the rng is