Go to file
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
Documentation backport from bbdbc11804ff0b4130e7550113b452e96a74d16e 2022-04-25 19:57:46 +08:00
LICENSES Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
arch fix gcc compile floating-point computation program when using option -march=native 2022-04-26 17:35:16 +08:00
block Merge pull request #185 from Tencent/tk4/haisuwang 2022-04-19 16:50:14 +08:00
certs certs: Fix blacklist flag type confusion 2021-04-12 12:52:25 +08:00
crypto crypto: rng - fix crypto_rng_reset() refcounting when !CRYPTO_STATS 2021-05-20 16:07:34 +08:00
drivers random: add a switch of using rdrand ins in _extract_crng 2022-05-12 10:56:20 +08:00
fs Merge pull request #177 from lanxinyuchs/lanxinyu/tk4/sysctl-write-forbid 2022-04-20 14:58:24 +08:00
include Merge pull request #194 from chenmengc/dev/sli_merge_main 2022-04-20 15:17:37 +08:00
init cgroup: bpf: make v1 support eBPF 2022-02-17 12:58:28 +08:00
ipc ipc/util.c: sysvipc_find_ipc() incorrectly updates position index 2021-03-16 16:27:51 +08:00
kernel Merge pull request #194 from chenmengc/dev/sli_merge_main 2022-04-20 15:17:37 +08:00
lib bug: Remove redundant condition check in report_bug 2021-05-20 16:07:55 +08:00
mm Merge pull request #194 from chenmengc/dev/sli_merge_main 2022-04-20 15:17:37 +08:00
net net: bpf: fix used-after-free BUG in inet_twsk_kill 2022-04-08 10:07:50 +08:00
package arm64/config: enable CONFIG_GENEVE=m 2022-04-27 17:01:21 +08:00
samples kfifo: fix ternary sign extension bugs 2021-05-20 16:08:01 +08:00
scripts kabi: kabi check support 2021-06-23 07:24:18 +00:00
security security: commoncap: fix -Wstringop-overread warning 2021-05-20 16:07:35 +08:00
sound ALSA: usb: midi: don't return -ENOMEM when usb_urb_ep_type_check fails 2021-05-20 16:07:59 +08:00
tools bpf: selftests: add bind retry for post_bind{4, 6} 2022-02-16 19:17:40 +08:00
usr Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
virt KVM: Stop looking for coalesced MMIO zones if the bus is destroyed 2021-05-20 16:07:44 +08:00
.clang-format Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
.cocciconfig Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
.get_maintainer.ignore Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
.gitattributes Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
.gitignore Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
COPYING Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
CREDITS Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
Kbuild 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
MAINTAINERS x86/sgx: Update MAINTAINERS 2021-07-12 08:56:46 +00:00
Makefile Rebase to linux long term 5.4.119 2021-05-20 16:08:02 +08:00
README Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
README.md Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
backport_remove_lists.txt Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
tools_key.pub Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00

README.md

Tencent Linux Kernel 4.0