search for: bytes_read

Displaying 20 results from an estimated 122 matches for "bytes_read".

2014 Jul 02
2
[PATCH 1/2] hwrng: don't fetch rng from sources without init
...core.c > index 334601c..3f3941d 100644 > --- a/drivers/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)...
2014 Jul 02
2
[PATCH 1/2] hwrng: don't fetch rng from sources without init
...core.c > index 334601c..3f3941d 100644 > --- a/drivers/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)...
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
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
...100644 > > --- a/drivers/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...
2014 Jul 02
3
[PATCH 1/2 v2] hwrng: Allow drivers to disable reading during probe
...100644 > > --- a/drivers/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...
2015 Jun 14
2
Sound glitch when using libvorbisfile and libao
Hi Gunter, I think this problem started happening when I upgraded from Debian Wheezy to Debian Jessie. If nothing looks amiss in my code, it probably is a sound driver problem. But since it works 100% of the time in ogg123, I feel I must have missed some corner case. My audio driver is almost always active. I usually have my music player going in the background when I do my testing. The problem
2014 Jul 02
1
[PATCH 1/2 v2] hwrng: Allow drivers to disable reading during probe
...re.c b/drivers/char/hw_random/core.c index 334601cc81cf..b7b6c48ca682 100644 --- a/drivers/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_rea...
2014 Jul 05
0
[PATCH v2 1/2] hwrng: fetch randomness only after device init
...uffer; +static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size, + int wait); + 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...
2014 Jul 10
0
[PATCH v3 1/2] hwrng: fetch randomness only after device init
...uffer; +static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size, + int wait); + 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 = rn...
2014 Dec 08
0
[PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.
...read functions, data_avail, rng_buffer and rng_fillbuf */ +static DEFINE_MUTEX(reading_mutex); static int data_avail; static u8 *rng_buffer, *rng_fillbuf; static unsigned short current_quality; @@ -81,7 +84,9 @@ static void add_early_randomness(struct hwrng *rng) unsigned char bytes[16]; int bytes_read; + mutex_lock(&reading_mutex); bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1); + mutex_unlock(&reading_mutex); if (bytes_read > 0) add_device_randomness(bytes, bytes_read); } @@ -128,6 +133,7 @@ static inline int rng_get_data(struct hwrng *rng, u8 *buffer, size_t size,...
2015 Jun 27
0
Sound glitch when using libvorbisfile and libao
...I just pulled this code from ogg123: #define PRIMAGIC (2*2*2*2*3*3*3*5*7) #define AUDIO_CHUNK_SIZE ((16384 + PRIMAGIC - 1)/ PRIMAGIC * PRIMAGIC) char convbuffer[AUDIO_CHUNK_SIZE]; const int convsize = AUDIO_CHUNK_SIZE; The loop is now more convoluted. Here's the old one, for reference: long bytes_read = 0; do { bytes_read = decode_vorbisfile(&vf); ao_play(device, pcmout, bytes_read); } while (bytes_read > 0); Here's the new loop, which now works: long bytes_filled = 0; long bytes_remaining = convsize; while (1) { while (bytes_remaining >= 4096) { int current_s...
2014 Jul 10
5
[PATCH v3 0/2] hwrng, virtio-rng: init-time fixes
v3: - Kees Cook pointed out a weird side-effect: devices which have ->init() registered get their randomness added to the system each time they're switched in, but devices that don't have the init callback don't contribute to system randomness more than once. The weirdness is resolved here by using the randomness each time hwrng_init() is attempted, irrespective of
2014 Jul 10
5
[PATCH v3 0/2] hwrng, virtio-rng: init-time fixes
v3: - Kees Cook pointed out a weird side-effect: devices which have ->init() registered get their randomness added to the system each time they're switched in, but devices that don't have the init callback don't contribute to system randomness more than once. The weirdness is resolved here by using the randomness each time hwrng_init() is attempted, irrespective of
2014 Dec 08
8
[PATCH v5 REPOST 0/6] fix hw_random stuck
When I hotunplug a busy virtio-rng device or try to access hwrng attributes in non-smp guest, it gets stuck. My hotplug tests: | test 0: | hotunplug rng device from qemu monitor | | test 1: | guest) # dd if=/dev/hwrng of=/dev/null & | hotunplug rng device from qemu monitor | | test 2: | guest) # dd if=/dev/random of=/dev/null & | hotunplug rng device from qemu monitor | | test
2014 Dec 08
8
[PATCH v5 REPOST 0/6] fix hw_random stuck
When I hotunplug a busy virtio-rng device or try to access hwrng attributes in non-smp guest, it gets stuck. My hotplug tests: | test 0: | hotunplug rng device from qemu monitor | | test 1: | guest) # dd if=/dev/hwrng of=/dev/null & | hotunplug rng device from qemu monitor | | test 2: | guest) # dd if=/dev/random of=/dev/null & | hotunplug rng device from qemu monitor | | test
2017 Sep 25
2
[PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.
...ata; the thread takes the mutex and calls rng_get_data() that blocks until RNG responds. This means that even user specified O_NONBLOCK here we'll be waiting until [hwrng] thread releases reading_mutex before we can continue. > if (!data_avail) { > bytes_read = rng_get_data(current_rng, rng_buffer, > rng_buffer_size(), > !(filp->f_flags & O_NONBLOCK)); > if (bytes_read < 0) { > err = bytes_read; > -...
2017 Sep 25
2
[PATCH v5 REPOST 1/6] hw_random: place mutex around read functions and buffers.
...ata; the thread takes the mutex and calls rng_get_data() that blocks until RNG responds. This means that even user specified O_NONBLOCK here we'll be waiting until [hwrng] thread releases reading_mutex before we can continue. > if (!data_avail) { > bytes_read = rng_get_data(current_rng, rng_buffer, > rng_buffer_size(), > !(filp->f_flags & O_NONBLOCK)); > if (bytes_read < 0) { > err = bytes_read; > -...