[PATCH V2] hwrng: bcm2835: Fix hwrng throughput regression

Jason A. Donenfeld Jason at zx2c4.com
Tue Sep 5 16:48:45 PDT 2023


On Wed, Sep 06, 2023 at 01:27:57AM +0200, Stefan Wahren wrote:
> The last RCU stall fix caused a massive throughput regression of the
> hwrng on Raspberry Pi 0 - 3. hwrng_msleep doesn't sleep precisely enough
> and usleep_range doesn't allow scheduling. So try to restore the
> best possible throughput by introducing hwrng_yield which interruptable
> sleeps for one jiffy.
> 
> Some performance measurements on Raspberry Pi 3B+ (arm64/defconfig):
> 
> sudo dd if=/dev/hwrng of=/dev/null count=1 bs=10000
> 
> cpu_relax              ~138025 Bytes / sec
> hwrng_msleep(1000)         ~13 Bytes / sec
> hwrng_yield              ~2510 Bytes / sec
> 
> Fixes: 96cb9d055445 ("hwrng: bcm2835 - use hwrng_msleep() instead of cpu_relax()")
> Link: https://lore.kernel.org/linux-arm-kernel/bc97ece5-44a3-4c4e-77da-2db3eb66b128@gmx.net/
> Signed-off-by: Stefan Wahren <wahrenst at gmx.net>

Thanks, looks good to me.

Reviewed-by: Jason A. Donenfeld <Jason at zx2c4.com>



More information about the linux-arm-kernel mailing list