bcm2835-rng: Performance regression since 96cb9d055445

Stefan Wahren wahrenst at gmx.net
Wed Aug 30 10:55:55 PDT 2023


Hi,

Am 30.08.23 um 12:38 schrieb Thorsten Leemhuis:
> /me gets the impression he has to chime in here
>
> On 25.08.23 14:14, Stefan Wahren wrote:
>> Am 25.08.23 um 13:26 schrieb Jason A. Donenfeld:
>>> On Fri, Aug 25, 2023 at 01:14:55PM +0200, Stefan Wahren wrote:
>>>> i didn't find the time to fix the performance regression in bcm2835-rng
>>>> which affects Raspberry Pi 0 - 3, so report it at least. AFAIK the first
>>>> report about this issue was here [1] and identified the offending
>>>> commit:
>>>>
>>>> 96cb9d055445 ("hwrng: bcm2835 - use hwrng_msleep() instead of
>>>>     cpu_relax()")
>>>>
>>>> #regzbot introduced: 96cb9d055445
>>>>
>>>> I was able to reproduce this issue with a Raspberry Pi 3 B+ on Linux
>>>> 6.5-rc6 (arm64/defconfig).
>>>>
>>>> Before:
>>>> time sudo dd if=/dev/hwrng of=/dev/urandom count=1 bs=4096 status=none
>>>>
>>>> real    3m29,002s
>>>> user    0m0,018s
>>>> sys    0m0,054s
>>> That's not surprising. But also, does it matter? That script has
>>> *always* been wrong. Writing to /dev/urandom like that has *never*
>>> ensured that those bytes are taken into account immediately after. It's
>>> just not how that interface works. So any assumptions based on that are
>>> bogus, and that line effectively does nothing.
>>>
>>> Fortunately, however, the kernel itself incorporates hwrng output into
>>> the rng pool, so you don't need to think about doing it yourself.
>>>
>>> So go ahead and remove that line from your script.
>> Thanks for your explanation. Unfortunately this isn't my script.
> And I assume it's in the standard install of the RpiOS or similarly
> widespread?
the repo / script is specific for Raspberry Pi / Debian.
>
>> I'm
>> just a former BCM2835 maintainer and interested that more user stick to
>> the mainline kernel instead of the vendor ones. I will try to report the
>> script owner.
> thx

I made a pull request [1] in order to avoid longer discussions and today
it has been merged :)

[1] - https://github.com/RPi-Distro/raspberrypi-sys-mods/pull/77



More information about the linux-arm-kernel mailing list