TencentOS-kernel/drivers/char
mengensun ace0b7c6ac random: add a switch of using rdrand ins in _extract_crng
on some old AMD CPU(eg: older then AMD EPYC 7K62) , rdrand is slowly,
random using rdrand to make the random num more hard to be guessed.
while the randomness is not really affect by rdrand.

when user not using random for security case, (eg: just geting some
random num, not using it to generate password) using rdrand on old
amd processor is so expensive.

so, add a swith to rdrand, by default using the rdrand, when closed
using tsc, jiffies, and entropy from the fast_pool to emulate the rdrand

testing on AMD EPYC 7K62 like follow:

---

echo 1 > /proc/sys/kernel/random/tos_use_rdrand
stress-ng --urandom 2 --timeout 10s --times --metrics
bogo ops real time  usr time  sys time   bogo ops/s   bogo ops/s
           (secs)    (secs)    (secs)   (real time) (usr+sys time)
   16542     10.00      0.00     19.98      1654.09       827.93

---

echo 0 > /proc/sys/kernel/random/tos_use_rdrand
stress-ng --urandom 2 --timeout 10s --times --metrics
bogo ops real time  usr time  sys time   bogo ops/s   bogo ops/s
           (secs)    (secs)    (secs)   (real time) (usr+sys time)
  222005     10.00      0.05     19.93     22200.41     11111.36

/dev/urandom reading and geturandom  syscall 13 times faster then using
really rdrand.

Signed-off-by: mengensun <mengensun@tencent.com>
Reviewed-by: frankjpliu <frankjpliu@tencent.com>
Reviewed-by: anakinzhang <anakinzhang@tencent.com>
Reviewed-by: Ruippan <Ruippan@tencent.com>
2022-05-12 10:56:20 +08:00
..
agp parisc: parisc-agp requires SBA IOMMU driver 2021-05-20 16:06:56 +08:00
hw_random hwrng: timeriomem - Fix cooldown period calculation 2021-04-12 12:52:21 +08:00
ipmi ipmi_si: Fix wrong return value in try_smi_init() 2021-03-16 16:38:45 +08:00
mwave Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pcmcia Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
tpm tpm: vtpm_proxy: Avoid reading host log when using a virtual device 2021-05-20 16:07:34 +08:00
xilinx_hwicap Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
xillybus Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kconfig Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Makefile Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
adi.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
apm-emulation.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
applicom.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
applicom.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
bsr.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ds1620.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
dsp56k.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
dtlk.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
efirtc.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
hangcheck-timer.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
hpet.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
lp.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mem.c /dev/mem: Add missing memory barriers for devmem_inode 2021-03-16 16:32:37 +08:00
misc.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mspec.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nsc_gpio.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nvram.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nwbutton.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nwbutton.h Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
nwflash.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pc8736x_gpio.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
powernv-op-panel.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ppdev.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ps3flash.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
random.c random: add a switch of using rdrand ins in _extract_crng 2022-05-12 10:56:20 +08:00
raw.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
rtc.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
scx200_gpio.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
sonypi.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
tb0219.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
tlclk.c drivers: char: tlclk.c: Avoid data race between init and interrupt handler 2021-03-16 16:37:13 +08:00
toshiba.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ttyprintk.c ttyprintk: Add TTY hangup callback. 2021-05-20 16:07:51 +08:00
uv_mmtimer.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
virtio_console.c virtio: virtio_console: fix DMA memory allocation for rproc serial 2021-03-16 16:40:54 +08:00