Skip to content

RFC Alternate sclable urandom patchset

George Spelvin lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4random: Reduce stack usage in _xfer_secondary_pooldrivers/char/random.c+36 -120 replies
2/4random: Remove two unused arguments from extract_entropy()drivers/char/random.c+4 -40 replies
3/4random: Only do mixback once per readdrivers/char/random.c+50 -201 reply
4/4random: Make non-blocking mixback non-blockingdrivers/char/random.c+100 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/4] Alternate sclable urandom patchset

Sent as separate patches to make things easier to review; the action is all in #4.

The first two are minor cleanups I've had in my tree for a while and felt like working on top of rather than backing out.

The third I'm not happy with, but will serve as a proof-of-concept stub that I'll rewrite if the rest meets with approval.

Since writing it, I've remembered that we already have a per-CPU "nonce pool" in the form of the get_random_int_hash array, and I should take advantage of that. Another thing I don't like is the mixback is only 160 bits, 80 of which are private. I'd rather have twice that, if the read is large enough. But that requires more code refactoring.

But it does illustrate the basic idea of using a nonce to avoid the need to do synchronous mixback. We can do many calls to extract_buf, from the same or different processors, without doing mixback.

The fourth is where the fun is.

The names of things is certainly up for debate; creating a subclass of struct entropy_store called "entropy_store_plus" is not my proudest moment. I also considered just making the extra fields global variables. If someone wants to suggest an arrangement that's good for cache line sharing, that would be appreciated.

But I think the nonblocking_mixback() function came out rather nice.

This uses two locks, rather that the one in the idea I most recently posted, because add_interrupt_randomness() needs to take the lock, and I didn't want to force it to do an unbounded amount of mixback work.

Using two locks avoids the need for interrupt handlers to do any mixback, and for readers to loop and thus possibly livelock.

George Spelvin (4):
random: Reduce stack usage in _xfer_secondary_pool
random: Remove two unused arguments from extract_entropy()
random: Only do mixback once per read
random: Make non-blocking mixback non-blocking

 drivers/char/random.c | 218 ++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 184 insertions(+), 34 deletions(-)
Signature · 1 line
2.6.1