Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Use rnd_getmore as intended. No more essay needed ...



details:   https://anonhg.NetBSD.org/src/rev/9db272beb47c
branches:  trunk
changeset: 345353:9db272beb47c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat May 21 15:33:40 2016 +0000

description:
Use rnd_getmore as intended.  No more essay needed here.

Workaround for buffering got pushed into rnd_getmore, closer to the
actual cause of the problem.

diffstat:

 sys/kern/kern_rndsink.c |  21 +++++----------------
 1 files changed, 5 insertions(+), 16 deletions(-)

diffs (43 lines):

diff -r d062dc3038a9 -r 9db272beb47c sys/kern/kern_rndsink.c
--- a/sys/kern/kern_rndsink.c   Sat May 21 15:27:15 2016 +0000
+++ b/sys/kern/kern_rndsink.c   Sat May 21 15:33:40 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_rndsink.c,v 1.16 2015/04/21 04:24:16 riastradh Exp $      */
+/*     $NetBSD: kern_rndsink.c,v 1.17 2016/05/21 15:33:40 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndsink.c,v 1.16 2015/04/21 04:24:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndsink.c,v 1.17 2016/05/21 15:33:40 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -142,21 +142,10 @@
 
        KASSERT(mutex_owned(&rndsinks.lock));
 
-       /*
-        * XXX This should request only rndsink->rs_bytes bytes of
-        * entropy, but that might get buffered up indefinitely because
-        * kern_rndq has no bound on the duration before it will
-        * process queued entropy samples.  To work around this, we are
-        * a little too incestuous with kern_rndq: we avoid marking polled
-        * sources "fast" there, and know here that for non-fast sources,
-        * that code will buffer two ints worth of data per source.
-        * Later, we ought to (a) bound the duration before
-        * queued entropy samples get processed, and (b) add a target
-        * or something -- as soon as we get that much from the entropy
-        * sources, distribute it.
-        */
-       rnd_getmore(MAX(rndsink->rsink_bytes, 2 * sizeof(uint32_t)));
+       /* Kick on-demand entropy sources.  */
+       rnd_getmore(rndsink->rsink_bytes);
 
+       /* Ensure this rndsink is on the queue.  */
        switch (rndsink->rsink_state) {
        case RNDSINK_IDLE:
                /* Not on the queue and nobody is handling it.  */



Home | Main Index | Thread Index | Old Index