Displaying 20 results from an estimated 67 matches for "add_device_randomness".
2014 Jul 02
2
[PATCH 1/2] hwrng: don't fetch rng from sources without init
...rivers/char/hw_random/core.c
> @@ -347,9 +347,11 @@ int hwrng_register(struct hwrng *rng)
> INIT_LIST_HEAD(&rng->list);
> list_add_tail(&rng->list, &rng_list);
>
> - bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> - if (bytes_read > 0)
> - add_device_randomness(bytes, bytes_read);
> + if (!rng->init) {
> + bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> + if (bytes_read > 0)
> + add_device_randomness(bytes, bytes_read);
> + }
afaict, this is redundant at initialization time. current_rng shouldn't
be set yet, so hw...
2014 Jul 02
2
[PATCH 1/2] hwrng: don't fetch rng from sources without init
...rivers/char/hw_random/core.c
> @@ -347,9 +347,11 @@ int hwrng_register(struct hwrng *rng)
> INIT_LIST_HEAD(&rng->list);
> list_add_tail(&rng->list, &rng_list);
>
> - bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> - if (bytes_read > 0)
> - add_device_randomness(bytes, bytes_read);
> + if (!rng->init) {
> + bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> + if (bytes_read > 0)
> + add_device_randomness(bytes, bytes_read);
> + }
afaict, this is redundant at initialization time. current_rng shouldn't
be set yet, so hw...
2014 Jul 02
6
[PATCH 0/2] hwrng: don't fetch data before device init
Hi,
When booting a recent kernel under KVM with the virtio-rng device
enabled, the boot process was stalling. Bisect pointed to a commit
made during the 3.15 window to fetch randomness from newly-registered
devices in the hwrng core. The details are in the patches.
I considered a couple of approaches, but basing on the init() function
being registered, as is done in patch 1 here, seems like
2014 Jul 02
6
[PATCH 0/2] hwrng: don't fetch data before device init
Hi,
When booting a recent kernel under KVM with the virtio-rng device
enabled, the boot process was stalling. Bisect pointed to a commit
made during the 3.15 window to fetch randomness from newly-registered
devices in the hwrng core. The details are in the patches.
I considered a couple of approaches, but basing on the init() function
being registered, as is done in patch 1 here, seems like
2014 Jul 02
3
[PATCH 1/2 v2] hwrng: Allow drivers to disable reading during probe
...gt; @@ -347,9 +347,11 @@ int hwrng_register(struct hwrng *rng)
> > INIT_LIST_HEAD(&rng->list);
> > list_add_tail(&rng->list, &rng_list);
> >
> > - bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> > - if (bytes_read > 0)
> > - add_device_randomness(bytes, bytes_read);
> > + if (!(rng->flags & HWRNG_NO_READ_AT_PROBE)) {
> > + bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> > + if (bytes_read > 0)
> > + add_device_randomness(bytes, bytes_read);
> > + }
>
> But this has the inverse pr...
2014 Jul 02
3
[PATCH 1/2 v2] hwrng: Allow drivers to disable reading during probe
...gt; @@ -347,9 +347,11 @@ int hwrng_register(struct hwrng *rng)
> > INIT_LIST_HEAD(&rng->list);
> > list_add_tail(&rng->list, &rng_list);
> >
> > - bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> > - if (bytes_read > 0)
> > - add_device_randomness(bytes, bytes_read);
> > + if (!(rng->flags & HWRNG_NO_READ_AT_PROBE)) {
> > + bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> > + if (bytes_read > 0)
> > + add_device_randomness(bytes, bytes_read);
> > + }
>
> But this has the inverse pr...
2014 Jul 02
1
[PATCH 1/2 v2] hwrng: Allow drivers to disable reading during probe
...ivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -347,9 +347,11 @@ int hwrng_register(struct hwrng *rng)
INIT_LIST_HEAD(&rng->list);
list_add_tail(&rng->list, &rng_list);
- bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
- if (bytes_read > 0)
- add_device_randomness(bytes, bytes_read);
+ if (!(rng->flags & HWRNG_NO_READ_AT_PROBE)) {
+ bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
+ if (bytes_read > 0)
+ add_device_randomness(bytes, bytes_read);
+ }
out_unlock:
mutex_unlock(&rng_mutex);
out:
diff --git a/include/linux/hw_random....
2014 Jul 05
6
[PATCH v2 0/2] hwrng, virtio-rng: init-time fixes
v2:
- this now separates both the patches; the virtio-rng fix is self-contained
- re-work hwrng core to fetch randomness at device init time if
->init() is registered by the device, instead of not calling it at all.
- virtio-rng: introduce a probe_done bool to ensure we don't ask host
for data before successful probe
Hi,
When booting a recent kernel under KVM with the virtio-rng
2014 Jul 05
6
[PATCH v2 0/2] hwrng, virtio-rng: init-time fixes
v2:
- this now separates both the patches; the virtio-rng fix is self-contained
- re-work hwrng core to fetch randomness at device init time if
->init() is registered by the device, instead of not calling it at all.
- virtio-rng: introduce a probe_done bool to ensure we don't ask host
for data before successful probe
Hi,
When booting a recent kernel under KVM with the virtio-rng
2014 Jul 02
0
[PATCH 1/2] hwrng: don't fetch rng from sources without init
...gt; @@ -347,9 +347,11 @@ int hwrng_register(struct hwrng *rng)
> > INIT_LIST_HEAD(&rng->list);
> > list_add_tail(&rng->list, &rng_list);
> >
> > - bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> > - if (bytes_read > 0)
> > - add_device_randomness(bytes, bytes_read);
> > + if (!rng->init) {
> > + bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> > + if (bytes_read > 0)
> > + add_device_randomness(bytes, bytes_read);
> > + }
>
> afaict, this is redundant at initialization time. current_...
2014 Jul 02
0
[PATCH 1/2 v2] hwrng: Allow drivers to disable reading during probe
...rivers/char/hw_random/core.c
> @@ -347,9 +347,11 @@ int hwrng_register(struct hwrng *rng)
> INIT_LIST_HEAD(&rng->list);
> list_add_tail(&rng->list, &rng_list);
>
> - bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> - if (bytes_read > 0)
> - add_device_randomness(bytes, bytes_read);
> + if (!(rng->flags & HWRNG_NO_READ_AT_PROBE)) {
> + bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> + if (bytes_read > 0)
> + add_device_randomness(bytes, bytes_read);
> + }
But this has the inverse problem: if there are two hwrngs in t...
2014 Jul 02
0
[PATCH 1/2] hwrng: don't fetch rng from sources without init
...ivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -347,9 +347,11 @@ int hwrng_register(struct hwrng *rng)
INIT_LIST_HEAD(&rng->list);
list_add_tail(&rng->list, &rng_list);
- bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
- if (bytes_read > 0)
- add_device_randomness(bytes, bytes_read);
+ if (!rng->init) {
+ bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
+ if (bytes_read > 0)
+ add_device_randomness(bytes, bytes_read);
+ }
out_unlock:
mutex_unlock(&rng_mutex);
out:
--
1.9.3
2014 Jul 05
0
[PATCH v2 1/2] hwrng: fetch randomness only after device init
...ait);
+
static size_t rng_buffer_size(void)
{
return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES;
}
+static void add_early_randomness(struct hwrng *rng)
+{
+ unsigned char bytes[16];
+ int bytes_read;
+
+ bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
+ if (bytes_read > 0)
+ add_device_randomness(bytes, bytes_read);
+}
+
static inline int hwrng_init(struct hwrng *rng)
{
+ int ret;
+
if (!rng->init)
return 0;
- return rng->init(rng);
+
+ ret = rng->init(rng);
+ if (ret)
+ return ret;
+
+ add_early_randomness(rng);
+ return ret;
}
static inline void hwrng_cleanup(struct...
2014 Jul 10
0
[PATCH v3 1/2] hwrng: fetch randomness only after device init
...ait);
+
static size_t rng_buffer_size(void)
{
return SMP_CACHE_BYTES < 32 ? 32 : SMP_CACHE_BYTES;
}
+static void add_early_randomness(struct hwrng *rng)
+{
+ unsigned char bytes[16];
+ int bytes_read;
+
+ bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
+ if (bytes_read > 0)
+ add_device_randomness(bytes, bytes_read);
+}
+
static inline int hwrng_init(struct hwrng *rng)
{
- if (!rng->init)
- return 0;
- return rng->init(rng);
+ if (rng->init) {
+ int ret;
+
+ ret = rng->init(rng);
+ if (ret)
+ return ret;
+ }
+ add_early_randomness(rng);
+ return 0;
}
static inline vo...
2014 Jul 14
2
[RFC PATCH 1/3] hw_random: allow RNG devices to give early randomness after a delay
...32 : SMP_CACHE_BYTES;
> }
>
> -static void add_early_randomness(struct hwrng *rng)
> +static void get_early_randomness(struct hwrng *rng)
> {
> unsigned char bytes[16];
> int bytes_read;
> @@ -79,6 +79,21 @@ static void add_early_randomness(struct hwrng *rng)
> add_device_randomness(bytes, bytes_read);
> }
>
> +static void sched_init_random(struct work_struct *work)
> +{
> + struct hwrng *rng = container_of(work, struct hwrng, dwork.work);
> +
> + get_early_randomness(rng);
> +}
> +
> +static void add_early_randomness(struct hwrng *rng)
The ad...
2014 Jul 02
0
[PATCH 1/2 v2] hwrng: Allow drivers to disable reading during probe
...ster(struct hwrng *rng)
>> > INIT_LIST_HEAD(&rng->list);
>> > list_add_tail(&rng->list, &rng_list);
>> >
>> > - bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
>> > - if (bytes_read > 0)
>> > - add_device_randomness(bytes, bytes_read);
>> > + if (!(rng->flags & HWRNG_NO_READ_AT_PROBE)) {
>> > + bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
>> > + if (bytes_read > 0)
>> > + add_device_randomness(bytes, bytes_read);...
2014 Jul 14
2
[RFC PATCH 1/3] hw_random: allow RNG devices to give early randomness after a delay
...32 : SMP_CACHE_BYTES;
> }
>
> -static void add_early_randomness(struct hwrng *rng)
> +static void get_early_randomness(struct hwrng *rng)
> {
> unsigned char bytes[16];
> int bytes_read;
> @@ -79,6 +79,21 @@ static void add_early_randomness(struct hwrng *rng)
> add_device_randomness(bytes, bytes_read);
> }
>
> +static void sched_init_random(struct work_struct *work)
> +{
> + struct hwrng *rng = container_of(work, struct hwrng, dwork.work);
> +
> + get_early_randomness(rng);
> +}
> +
> +static void add_early_randomness(struct hwrng *rng)
The ad...
2014 Jul 02
0
[PATCH 1/2 v2] hwrng: Allow drivers to disable reading during probe
...wrng_register(struct hwrng *rng)
> > > INIT_LIST_HEAD(&rng->list);
> > > list_add_tail(&rng->list, &rng_list);
> > >
> > > - bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> > > - if (bytes_read > 0)
> > > - add_device_randomness(bytes, bytes_read);
> > > + if (!(rng->flags & HWRNG_NO_READ_AT_PROBE)) {
> > > + bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
> > > + if (bytes_read > 0)
> > > + add_device_randomness(bytes, bytes_read);
> > > + }
> >
&g...
2014 Jul 14
4
[RFC PATCH 0/3] hw_random: support for delayed init randomness requests
Hello,
This series introduces a way to allow devices to contribute to initial
system randomness after a certain delay. Specifically, the virtio-rng
device can contribute initial randomness only after a successful
probe().
A delayed workqueue item is queued in the system queue to fetch this
randomness if the device indicates it's capable of contributing only
after a delay, via the new
2014 Jul 14
4
[RFC PATCH 0/3] hw_random: support for delayed init randomness requests
Hello,
This series introduces a way to allow devices to contribute to initial
system randomness after a certain delay. Specifically, the virtio-rng
device can contribute initial randomness only after a successful
probe().
A delayed workqueue item is queued in the system queue to fetch this
randomness if the device indicates it's capable of contributing only
after a delay, via the new