Re: Patch: cprng_fast performance - please review.
Mindaugas Rasiukevicius <[email protected]> Wed, 23 Apr 2014 12:50:47 +0100
| Newsgroups | gmane.os.netbsd.devel.crypto,gmane.os.netbsd.devel.kernel |
|---|---|
| Message-ID | <[email protected]> |
Thor Lancelot Simon <[email protected]> wrote: > On Wed, Apr 16, 2014 at 09:52:22PM -0400, Thor Lancelot Simon wrote: > > > > Attached is a patch which makes cprng_fast per-CPU and lockless. *IT > > IS NOT WELL TESTED YET (I haven't even run test vectors) AND IS ONLY > > FOR REVIEW.* > > New diff, with some missing files and incorporating some more comments > from Taylor. > > Thor Few notes: - Please do not provide the interface as inline functions in the headers. They are just not worth. It is much more beneficial to keep the internals abstracted within subr_cprng.c and to not expose any structures! - Are there legitimate users of CPRNG from the interrupts above IPL_VM? I think there should not be any and cprng_fast() should be under splvm(). In the long term, we could probably use a lockless buffer, but I am fine with splvm() for now. - I would still replace division/modulus using sizeof(uint32_t) with bitwise operations, just to make sure that compiler is not silly. - Just merge cprng_fast() macro with _cprng_fast_inexact(). Simplify, since what we really care about it cprng_fast32(). -- Mindaugas