Show pagesourceOld revisionsBacklinksFold/unfold allBack to top Share via Share via... Twitter LinkedIn Facebook Pinterest Telegram WhatsApp Yammer Reddit TeamsRecent ChangesSend via e-MailPrintPermalink × « X10DRi seems to support boot from NVMe devices FreeBSD's "cp" doesn't copy extended attributes (in FreeBSD 12 currently) » About "kern.random.harvest.mask" on FreeBSD When finding out FreeBSD's network tuning, any articles say “Optimise the random harvest.” I wondered why random number is related even though I looked at the network, but FreeBSD Handbook made sense to me: random(4)とrandom_harvest(9), random_harvest(9). This information is as of FreeBSD 12.1-RELEASE. First about the random harvest. FreeBSD has a special file /dev/random to get random numbers. It is normally PRN (Pseudo Random Number) generator, thus it is nothing but return definite numbers generated by formula which looks like random. Maintaining randomness is important to keep good entropy state. FreeBSD seems to call this mechanism “random harvest.” I think this naming pretty fits in the behaviour which growing good entropy and using it. The entropy source is controlled by the kern.random.harvest.mask kernel variable. This value is bit field which each bit corresponds to a source, “1” means the source is enabled, “0” means disabled. Aliased “mask” variables, “mask_symbolic” and “mask_bin” should be useful rather than unfriendly decimal value. Their values are below on my PC: $ sysctl kern.random kern.random.fortuna.minpoolsize: 64 kern.random.harvest.mask_symbolic: PURE_RDRAND,[UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED kern.random.harvest.mask_bin: 00000010000000111111111 kern.random.harvest.mask: 66047 kern.random.random_sources: 'Intel Secure Key RNG' As you see, “mask_bin” is binary representation, and “mask_symbolic” is more human readable representation of the mask value which contains all available entropy sources on the system. The source enclosed in square brackets means disabled source. As of FreeBSD 12.1-RELEASE, 24 entropy sources are defined at sys/sys/random.h. In my case, NET_ETHER is used as one of entropy sources. They say the reason why it affects network performance is because of race conditions on a lock between the harvesting and network communicating. The affect is said not to be negligible especially on high speed network like over 10Gb/s. I see how it is. References random(4) random_harvest(9) Tuning FreeBSD for routing and firewalling(PDF) Comments Name E-Mail Website Please fill all the letters into the box to prove you're human. Please keep this field empty: Preview Comment en/blog/2020/2020-01-07.txt Last modified: 2022-01-21 09:28by Decomo