Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1469085 > unrolled thread
| Started by | Corentin LABBE <clabbe.montjoie@gmail.com> |
|---|---|
| First post | 2016-08-24 07:50 +0200 |
| Last post | 2016-08-25 01:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v2 2/2] HWRNG: thunderx: Add Cavium HWRNG driver for ThunderX SoC. Corentin LABBE <clabbe.montjoie@gmail.com> - 2016-08-24 07:50 +0200
Re: [PATCH v2 2/2] HWRNG: thunderx: Add Cavium HWRNG driver for ThunderX SoC. David Daney <ddaney.cavm@gmail.com> - 2016-08-25 01:10 +0200
| From | Corentin LABBE <clabbe.montjoie@gmail.com> |
|---|---|
| Date | 2016-08-24 07:50 +0200 |
| Subject | Re: [PATCH v2 2/2] HWRNG: thunderx: Add Cavium HWRNG driver for ThunderX SoC. |
| Message-ID | <s9zex-6kx-9@gated-at.bofh.it> |
Hello
> +/* Read data from the RNG unit */
> +static int cavium_rng_read(struct hwrng *rng, void *dat, size_t max, bool wait)
> +{
> + struct cavium_rng *p = container_of(rng, struct cavium_rng, ops);
> + unsigned int size = max;
> +
> + while (size >= 8) {
> + *((u64 *)dat) = readq(p->result);
> + size -= 8;
> + dat += 8;
> + }
I think you could use readsq()
This will increase throughput
Regards
LABBE Corentin
[toc] | [next] | [standalone]
| From | David Daney <ddaney.cavm@gmail.com> |
|---|---|
| Date | 2016-08-25 01:10 +0200 |
| Subject | Re: [PATCH v2 2/2] HWRNG: thunderx: Add Cavium HWRNG driver for ThunderX SoC. |
| Message-ID | <s9PsZ-ZV-1@gated-at.bofh.it> |
| In reply to | #1469085 |
On 08/23/2016 10:46 PM, Corentin LABBE wrote:
> Hello
>
>> +/* Read data from the RNG unit */
>> +static int cavium_rng_read(struct hwrng *rng, void *dat, size_t max, bool wait)
>> +{
>> + struct cavium_rng *p = container_of(rng, struct cavium_rng, ops);
>> + unsigned int size = max;
>> +
>> + while (size >= 8) {
>> + *((u64 *)dat) = readq(p->result);
>> + size -= 8;
>> + dat += 8;
>> + }
>
> I think you could use readsq()
> This will increase throughput
If you look at the implementation of readsq(), you will see that it is a
similar loop. Since the overhead is primarily I/O latency from the RNG
hardware, the throughput cannot really be changed with micro
optimizations to this simple loop.
Also, on big-endian kernels, it appears that a loop of readq() and
readsq() will give different results as readq will byte swap the result
and readsq does not. Since this is a RNG, the byte swapping is not
important, but it is a difference.
Because of this, I think it should be acceptable to stick with the loop
we currently have.
If the hwrng maintainers want to change the loop, to a readsq(), we
might investigate this more.
Thanks,
David Daney
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web