linux/drivers/char/hw_random
Jason A. Donenfeld 96cb9d0554 hwrng: bcm2835 - use hwrng_msleep() instead of cpu_relax()
Rather than busy looping, yield back to the scheduler and sleep for a
bit in the event that there's no data. This should hopefully prevent the
stalls that Mark reported:

<6>[    3.362859] Freeing initrd memory: 16196K
<3>[   23.160131] rcu: INFO: rcu_sched self-detected stall on CPU
<3>[   23.166057] rcu:  0-....: (2099 ticks this GP) idle=03b4/1/0x40000002 softirq=28/28 fqs=1050
<4>[   23.174895]       (t=2101 jiffies g=-1147 q=2353 ncpus=4)
<4>[   23.180203] CPU: 0 PID: 49 Comm: hwrng Not tainted 6.0.0 #1
<4>[   23.186125] Hardware name: BCM2835
<4>[   23.189837] PC is at bcm2835_rng_read+0x30/0x6c
<4>[   23.194709] LR is at hwrng_fillfn+0x71/0xf4
<4>[   23.199218] pc : [<c07ccdc8>]    lr : [<c07cb841>]    psr: 40000033
<4>[   23.205840] sp : f093df70  ip : 00000000  fp : 00000000
<4>[   23.211404] r10: c3c7e800  r9 : 00000000  r8 : c17e6b20
<4>[   23.216968] r7 : c17e6b64  r6 : c18b0a74  r5 : c07ccd99  r4 : c3f171c0
<4>[   23.223855] r3 : 000fffff  r2 : 00000040  r1 : c3c7e800  r0 : c3f171c0
<4>[   23.230743] Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA Thumb  Segment none
<4>[   23.238426] Control: 50c5387d  Table: 0020406a  DAC: 00000051
<4>[   23.244519] CPU: 0 PID: 49 Comm: hwrng Not tainted 6.0.0 #1

Link: https://lore.kernel.org/all/Y0QJLauamRnCDUef@sirena.org.uk/
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2022-10-14 19:03:09 +08:00
..
amd-rng.c hwrng: rename 'mod_init' & 'mod_exit' functions to be module-specific 2021-07-16 15:49:36 +08:00
arm_smccc_trng.c hwrng: arm-smccc-trng - fix NO_ENTROPY handling 2022-08-19 18:39:35 +08:00
atmel-rng.c hwrng: atmel - remove extra line 2022-03-03 10:46:19 +12:00
ba431-rng.c
bcm2835-rng.c hwrng: bcm2835 - use hwrng_msleep() instead of cpu_relax() 2022-10-14 19:03:09 +08:00
cavium-rng-vf.c hwrng: cavium - fix NULL but dereferenced coccicheck error 2022-03-03 10:49:22 +12:00
cavium-rng.c hwrng: cavium - Check health status while reading random data 2021-11-20 15:02:07 +11:00
cctrng.c hwrng: cctrng - delete redundant printing of return value 2021-03-19 21:59:47 +11:00
cctrng.h
cn10k-rng.c hwrng: cn10k - Make check_rng_health() return an error code 2022-04-21 17:53:55 +08:00
core.c hwrng: core - start hwrng kthread also for untrusted sources 2022-09-30 13:59:12 +08:00
exynos-trng.c hwrng: exynos - Use pm_runtime_resume_and_get() to replace open coding 2021-06-03 20:24:04 +08:00
geode-rng.c hwrng: rename 'mod_init' & 'mod_exit' functions to be module-specific 2021-07-16 15:49:36 +08:00
hisi-rng.c
imx-rngc.c hwrng: imx-rngc - Moving IRQ handler registering after imx_rngc_irq_mask_clear() 2022-09-02 18:37:23 +08:00
ingenic-rng.c
ingenic-trng.c
intel-rng.c hwrng: rename 'mod_init' & 'mod_exit' functions to be module-specific 2021-07-16 15:49:36 +08:00
iproc-rng200.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_30.RULE (part 1) 2022-06-10 14:51:35 +02:00
ixp4xx-rng.c hwrng: ixp4xx - Make use of the helper function devm_platform_ioremap_resource() 2021-09-17 11:06:14 +08:00
Kconfig hwrng: bcm2835: bcmbca: Replace ARCH_BCM_63XX with ARCH_BCMBCA 2022-07-10 19:11:00 -07:00
ks-sa-rng.c hwrng: ks-sa - Use pm_runtime_resume_and_get() to replace open coding 2021-06-03 20:24:04 +08:00
Makefile hwrng: mpfs - add polarfire soc hwrng support 2022-04-15 16:34:28 +08:00
meson-rng.c hwrng: meson - Improve error handling for core clock 2021-10-01 14:41:23 +08:00
mpfs-rng.c hwrng: mpfs - add polarfire soc hwrng support 2022-04-15 16:34:28 +08:00
mtk-rng.c hwrng: mtk - Force runtime pm ops for sleep ops 2021-10-08 20:02:47 +08:00
mxc-rnga.c
n2-asm.S
n2-drv.c
n2rng.h
nomadik-rng.c hwrng: nomadik - Change clk_disable to clk_disable_unprepare 2022-03-14 14:45:44 +12:00
npcm-rng.c
octeon-rng.c
omap3-rom-rng.c hwrng: omap3-rom - fix using wrong clk_disable() in omap_rom_rng_runtime_resume() 2022-05-20 13:54:45 +08:00
omap-rng.c hwrng: omap - Use pm_runtime_resume_and_get() to replace open coding 2021-06-03 20:24:04 +08:00
optee-rng.c hwrng: optee - remove redundant initialization to variable rng_size 2022-04-29 13:44:58 +08:00
pasemi-rng.c
pic32-rng.c
powernv-rng.c powerpc/powernv: rename remaining rng powernv_ functions to pnv_ 2022-07-28 16:22:15 +10:00
pseries-rng.c char: hw_random: pseries-rng: Demote non-conformant kernel-doc header 2021-05-21 10:09:30 +02:00
s390-trng.c s390 updates for 5.20 merge window 2022-08-06 17:05:21 -07:00
st-rng.c
stm32-rng.c
timeriomem-rng.c
via-rng.c hwrng: via - Fix comment typo 2022-07-22 16:22:04 +08:00
virtio-rng.c virtio-rng: make device ready before making request 2022-06-08 08:56:03 -04:00
xgene-rng.c
xiphera-trng.c