aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorStefan Wahren <[email protected]>2023-09-06 01:27:57 +0200
committerHerbert Xu <[email protected]>2023-09-15 18:29:45 +0800
commitb58a36008bfa1aadf55f516bcbfae40c779eb54b (patch)
treef689c99a598d2773bcdbb72c01a5c1a6b85ef070 /include/linux
parentc977950146720abff14e46d8c53f5638b06a9182 (diff)
hwrng: bcm2835 - Fix hwrng throughput regression
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/[email protected]/ Signed-off-by: Stefan Wahren <[email protected]> Reviewed-by: Jason A. Donenfeld <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hw_random.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 8a3115516a1b..136e9842120e 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -63,5 +63,6 @@ extern void hwrng_unregister(struct hwrng *rng);
extern void devm_hwrng_unregister(struct device *dve, struct hwrng *rng);
extern long hwrng_msleep(struct hwrng *rng, unsigned int msecs);
+extern long hwrng_yield(struct hwrng *rng);
#endif /* LINUX_HWRANDOM_H_ */